annotate client/src/store/map.js @ 2996:888a3454c3ae

Extracted WFS style functions and styles to avoid massive memory allocation.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 10 Apr 2019 15:17:06 +0200
parents 1b8bb4f89227
children 707e1bc24d93
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1362
ca33ad696594 remove the first empyty lines
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1361
diff changeset
1 /* This is Free Software under GNU Affero General Public License v >= 3.0
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 975
diff changeset
2 * without warranty, see README.md and license for details.
1361
ea3a89a1813a remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1313
diff changeset
3 *
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 975
diff changeset
4 * SPDX-License-Identifier: AGPL-3.0-or-later
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 975
diff changeset
5 * License-Filename: LICENSES/AGPL-3.0.txt
1361
ea3a89a1813a remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1313
diff changeset
6 *
1927
5a37ee321651 client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents: 1879
diff changeset
7 * Copyright (C) 2018, 2019 by via donau
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 975
diff changeset
8 * – Österreichische Wasserstraßen-Gesellschaft mbH
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 975
diff changeset
9 * Software engineering by Intevation GmbH
1361
ea3a89a1813a remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1313
diff changeset
10 *
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 975
diff changeset
11 * Author(s):
1927
5a37ee321651 client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents: 1879
diff changeset
12 * * Bernhard Reiter <bernhard.reiter@intevation.de>
5a37ee321651 client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents: 1879
diff changeset
13 * * Markus Kottländer <markus@intevation.de>
5a37ee321651 client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents: 1879
diff changeset
14 * * Thomas Junk <thomas.junk@intevation.de>
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 975
diff changeset
15 */
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 975
diff changeset
16
585
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
17 //import { HTTP } from "../lib/http";
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
18
2985
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2957
diff changeset
19 import TileWMS from "ol/source/TileWMS";
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2957
diff changeset
20 import { Tile as TileLayer, Vector as VectorLayer } from "ol/layer";
1099
1f4799bab8a6 deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents: 1096
diff changeset
21 import OSM from "ol/source/OSM";
2985
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2957
diff changeset
22 import Draw from "ol/interaction/Draw";
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2957
diff changeset
23 import { Icon, Stroke, Style, Fill, Text, Circle } from "ol/style";
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2957
diff changeset
24 import VectorSource from "ol/source/Vector";
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2957
diff changeset
25 import Point from "ol/geom/Point";
1099
1f4799bab8a6 deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents: 1096
diff changeset
26 import { bbox as bboxStrategy } from "ol/loadingstrategy";
2947
a6eea3002e6e client: cleanup import paths
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2932
diff changeset
27 import { HTTP } from "@/lib/http";
1158
da75faa8043f added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents: 1144
diff changeset
28 import { fromLonLat } from "ol/proj";
2985
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2957
diff changeset
29 import { getLength, getArea } from "ol/sphere";
1435
7fa030127b05 fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents: 1395
diff changeset
30 import { unByKey } from "ol/Observable";
7fa030127b05 fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents: 1395
diff changeset
31 import { getCenter } from "ol/extent";
2985
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2957
diff changeset
32 import { transformExtent } from "ol/proj";
2132
7a2eedc182f7 staging: zoomable stretches. zoomToExtent etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2125
diff changeset
33 import bbox from "@turf/bbox";
2947
a6eea3002e6e client: cleanup import paths
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2932
diff changeset
34 import app from "@/main";
585
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
35
2186
d0498088894f map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents: 2166
diff changeset
36 const moveMap = ({ view, extent, zoom, preventZoomOut }) => {
d0498088894f map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents: 2166
diff changeset
37 const currentZoom = view.getZoom();
2713
b79f5c5404c2 client: made zoom optional in moveMap/moveToExtent
Markus Kottlaender <markus@intevation.de>
parents: 2643
diff changeset
38 zoom = zoom || currentZoom;
2186
d0498088894f map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents: 2166
diff changeset
39 view.fit(extent, {
d0498088894f map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents: 2166
diff changeset
40 maxZoom: preventZoomOut ? Math.max(zoom, currentZoom) : zoom,
d0498088894f map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents: 2166
diff changeset
41 duration: 700
d0498088894f map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents: 2166
diff changeset
42 });
d0498088894f map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents: 2166
diff changeset
43 };
d0498088894f map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents: 2166
diff changeset
44
2996
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
45 const blue1 = new Style({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
46 stroke: new Stroke({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
47 color: "rgba(0, 0, 255, 0.8)",
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
48 lineDash: [2, 4],
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
49 lineCap: "round",
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
50 width: 2
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
51 }),
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
52 fill: new Fill({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
53 color: "rgba(240, 230, 0, 0.2)"
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
54 })
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
55 });
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
56 const blue2 = new Style({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
57 stroke: new Stroke({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
58 color: "rgba(0, 0, 255, 0.9)",
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
59 lineDash: [3, 6],
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
60 lineCap: "round",
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
61 width: 2
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
62 }),
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
63 fill: new Fill({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
64 color: "rgba(240, 230, 0, 0.1)"
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
65 })
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
66 });
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
67 const blue3 = new Style({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
68 stroke: new Stroke({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
69 color: "rgba(0, 0, 255, 1.0)",
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
70 width: 2
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
71 }),
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
72 fill: new Fill({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
73 color: "rgba(255, 255, 255, 0.4)"
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
74 })
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
75 });
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
76 const yellow1 = new Style({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
77 stroke: new Stroke({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
78 color: "rgba(230, 230, 10, .8)",
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
79 width: 4
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
80 }),
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
81 fill: new Fill({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
82 color: "rgba(230, 230, 10, .3)"
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
83 })
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
84 });
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
85 const yellow2 = new Style({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
86 stroke: new Stroke({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
87 color: "rgba(250, 200, 0, .8)",
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
88 width: 2
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
89 }),
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
90 fill: new Fill({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
91 color: "rgba(250, 200, 10, .3)"
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
92 })
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
93 });
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
94 const yellow3 = new Style({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
95 stroke: new Stroke({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
96 color: "rgba(250, 240, 10, .9)",
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
97 width: 5
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
98 }),
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
99 fill: new Fill({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
100 color: "rgba(250, 240, 0, .7)"
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
101 })
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
102 });
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
103 const red1 = new Style({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
104 stroke: new Stroke({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
105 color: "rgba(255, 0, 0, 1)",
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
106 width: 4
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
107 })
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
108 })
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
109
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
110 const circleBlue = new Style({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
111 image: new Circle({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
112 radius: 5,
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
113 fill: new Fill({ color: "rgba(255, 0, 0, 0.1)" }),
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
114 stroke: new Stroke({ color: "blue", width: 1 })
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
115 })
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
116 });
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
117
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
118 const textFW1 = new Style({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
119 text: new Text({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
120 font: 'bold 12px "Open Sans", "sans-serif"',
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
121 placement: "line",
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
122 fill: new Fill({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
123 color: "black"
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
124 }),
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
125 text: "LOS: 1"
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
126 //, zIndex: 10
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
127 })
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
128 });
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
129 const textFW2 = new Style({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
130 text: new Text({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
131 font: 'bold 12px "Open Sans", "sans-serif"',
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
132 placement: "line",
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
133 fill: new Fill({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
134 color: "black"
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
135 }),
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
136 text: "LOS: 2"
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
137 //, zIndex: 10
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
138 })
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
139 });
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
140 const textFW3 = new Style({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
141 text: new Text({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
142 font: 'bold 12px "Open Sans", "sans-serif"',
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
143 placement: "line",
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
144 fill: new Fill({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
145 color: "black"
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
146 }),
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
147 text: "LOS: 3"
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
148 //, zIndex: 10
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
149 })
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
150 });
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
151
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
152 const stretchesStyle = feature => {
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
153 let style = yellow2;
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
154 if (feature.get("highlighted")) {
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
155 style = yellow3;
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
156 }
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
157 return style;
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
158 };
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
159 const fwd1Style = () => {
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
160 return [blue1, textFW1];
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
161 };
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
162 const fwd2Style = () => {
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
163 return [blue2, textFW2];
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
164 };
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
165 const fwd3Style = () => {
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
166 return [blue3, textFW3];
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
167 };
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
168 const bottleneckStyle = () => {
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
169 return yellow1;
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
170 };
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
171 const bottleneckStatusStyle = (feature, resolution, isLegend) => {
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
172 let styles = [];
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
173 if ((feature.get("fa_critical") && resolution > 15) || isLegend) {
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
174 let bnCenter = getCenter(feature.getGeometry().getExtent());
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
175 styles.push(
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
176 new Style({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
177 geometry: new Point(bnCenter),
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
178 image: new Icon({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
179 src: require("@/assets/marker-bottleneck-critical.png"),
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
180 anchor: [0.5, 0.5],
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
181 scale: isLegend ? 0.5 : 1
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
182 })
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
183 })
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
184 );
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
185 }
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
186 if (feature.get("fa_critical") && !isLegend) {
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
187 styles.push(red1);
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
188 }
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
189 return styles;
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
190 };
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
191 const dmaStyle = (feature, resolution) => {
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
192 if (resolution < 10) {
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
193 var s = circleBlue;
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
194 if (resolution < 6) {
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
195 s.setText(
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
196 new Text({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
197 offsetY: 12,
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
198 font: '10px "Open Sans", "sans-serif"',
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
199 fill: new Fill({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
200 color: "black"
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
201 }),
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
202 text: (feature.get("hectometre") / 10).toString()
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
203 })
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
204 );
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
205 }
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
206 return s;
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
207 } else {
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
208 return [];
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
209 }
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
210 }
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
211 const gaugeStyle = (feature, resolution, isLegend) => {
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
212 return [
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
213 new Style({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
214 image: new Icon({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
215 src: require("@/assets/marker-gauge.png"),
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
216 anchor: [0.5, isLegend ? 0.5 : 1],
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
217 scale: isLegend ? 0.5 : 1
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
218 }),
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
219 text: new Text({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
220 font: '10px "Open Sans", "sans-serif"',
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
221 offsetY: 8,
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
222 fill: new Fill({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
223 color: "white"
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
224 }),
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
225 text: feature.get("objname")
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
226 })
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
227 }),
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
228 new Style({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
229 text: new Text({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
230 font: '10px "Open Sans", "sans-serif"',
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
231 offsetY: 7,
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
232 offsetX: -1,
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
233 fill: new Fill({
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
234 color: "black"
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
235 }),
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
236 text: feature.get("objname")
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
237 })
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
238 })
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
239 ];
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
240 };
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
241
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
242
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
243
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
244 // initial state
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
245 const init = () => {
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
246 return {
783
ab9604a46075 client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents: 782
diff changeset
247 openLayersMap: null,
2310
92b21df288e2 client: use user specific extent only on initial load
Markus Kottlaender <markus@intevation.de>
parents: 2309
diff changeset
248 initialLoad: true,
1313
e4e35fb2d995 save map extent (center/zoom) in store, to not lose it when switching between map and admin area
Markus Kottlaender <markus@intevation.de>
parents: 1296
diff changeset
249 extent: {
e4e35fb2d995 save map extent (center/zoom) in store, to not lose it when switching between map and admin area
Markus Kottlaender <markus@intevation.de>
parents: 1296
diff changeset
250 lat: 6155376,
e4e35fb2d995 save map extent (center/zoom) in store, to not lose it when switching between map and admin area
Markus Kottlaender <markus@intevation.de>
parents: 1296
diff changeset
251 lon: 1819178,
e4e35fb2d995 save map extent (center/zoom) in store, to not lose it when switching between map and admin area
Markus Kottlaender <markus@intevation.de>
parents: 1296
diff changeset
252 zoom: 11
e4e35fb2d995 save map extent (center/zoom) in store, to not lose it when switching between map and admin area
Markus Kottlaender <markus@intevation.de>
parents: 1296
diff changeset
253 },
1435
7fa030127b05 fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents: 1395
diff changeset
254 identifyTool: null, // event binding (singleclick, dblclick)
1140
2e06bc53b002 separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents: 1122
diff changeset
255 identifiedFeatures: [], // map features identified by clicking on the map
1247
c14353e2cdb9 repositioning of buttons (issue225)
Markus Kottlaender <markus@intevation.de>
parents: 1237
diff changeset
256 currentMeasurement: null, // distance or area from line-/polygon-/cutTool
1237
74562dc29e10 refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents: 1197
diff changeset
257 lineTool: null, // open layers interaction object (Draw)
74562dc29e10 refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents: 1197
diff changeset
258 polygonTool: null, // open layers interaction object (Draw)
1140
2e06bc53b002 separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents: 1122
diff changeset
259 cutTool: null, // open layers interaction object (Draw)
1927
5a37ee321651 client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents: 1879
diff changeset
260 isolinesLegendImgDataURL: "",
2932
173ce013a021 layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents: 2910
diff changeset
261 differencesLegendImgDataURL: "",
2870
35f6e4383161 layer structure overhaul
Thomas Junk <thomas.junk@intevation.de>
parents: 2868
diff changeset
262 layers: {
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
263 OPENSTREETMAP: new TileLayer({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
264 label: "Open Streetmap",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
265 visible: true,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
266 source: new OSM()
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
267 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
268 INLANDECDIS: new TileLayer({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
269 label: "Inland ECDIS chart Danube",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
270 visible: true,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
271 source: new TileWMS({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
272 preload: 1,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
273 url: "https://service.d4d-portal.info/wms/",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
274 crossOrigin: "anonymous",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
275 params: { LAYERS: "d4d", VERSION: "1.1.1", TILED: true }
2951
1ac58e024942 client: map layers: optimized setting visibility
Markus Kottlaender <markus@intevation.de>
parents: 2947
diff changeset
276 })
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
277 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
278 WATERWAYAREA: new VectorLayer({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
279 label: "Waterway Area",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
280 visible: true,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
281 source: new VectorSource({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
282 strategy: bboxStrategy
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
283 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
284 style: new Style({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
285 stroke: new Stroke({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
286 color: "rgba(0, 102, 0, 1)",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
287 width: 2
1099
1f4799bab8a6 deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents: 1096
diff changeset
288 })
2951
1ac58e024942 client: map layers: optimized setting visibility
Markus Kottlaender <markus@intevation.de>
parents: 2947
diff changeset
289 })
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
290 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
291 STRETCHES: new VectorLayer({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
292 label: "Stretches",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
293 visible: false,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
294 source: new VectorSource({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
295 strategy: bboxStrategy
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
296 }),
2996
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
297 style: stretchesStyle
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
298 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
299 FAIRWAYDIMENSIONSLOS1: new VectorLayer({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
300 label: "LOS 1 Fairway Dimensions",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
301 visible: false,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
302 source: new VectorSource(),
2996
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
303 style: fwd1Style
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
304 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
305 FAIRWAYDIMENSIONSLOS2: new VectorLayer({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
306 label: "LOS 2 Fairway Dimensions",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
307 visible: false,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
308 source: new VectorSource(),
2996
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
309 style: fwd2Style
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
310 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
311 FAIRWAYDIMENSIONSLOS3: new VectorLayer({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
312 label: "LOS 3 Fairway Dimensions",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
313 visible: true,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
314 source: new VectorSource(),
2996
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
315 style: fwd3Style
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
316 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
317 WATERWAYAXIS: new VectorLayer({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
318 label: "Waterway Axis",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
319 visible: true,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
320 source: new VectorSource({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
321 strategy: bboxStrategy
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
322 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
323 style: new Style({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
324 stroke: new Stroke({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
325 color: "rgba(0, 0, 255, .5)",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
326 lineDash: [5, 5],
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
327 width: 2
1099
1f4799bab8a6 deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents: 1096
diff changeset
328 })
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
329 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
330 // TODO: Set layer in layertree active/inactive depending on
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
331 // resolution.
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
332 maxResolution: 5,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
333 minResolution: 0
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
334 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
335 WATERWAYPROFILES: new VectorLayer({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
336 label: "Waterway Profiles",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
337 visible: true,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
338 source: new VectorSource({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
339 strategy: bboxStrategy
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
340 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
341 style: new Style({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
342 stroke: new Stroke({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
343 color: "rgba(0, 0, 255, .5)",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
344 lineDash: [5, 5],
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
345 width: 2
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
346 })
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
347 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
348 maxResolution: 2.5,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
349 minResolution: 0
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
350 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
351 BOTTLENECKS: new VectorLayer({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
352 label: "Bottlenecks",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
353 visible: true,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
354 source: new VectorSource({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
355 strategy: bboxStrategy
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
356 }),
2996
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
357 style: bottleneckStyle
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
358 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
359 BOTTLENECKISOLINE: new TileLayer({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
360 label: "Bottleneck isolines",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
361 visible: false,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
362 source: new TileWMS({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
363 preload: 0,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
364 projection: "EPSG:3857",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
365 url: window.location.origin + "/api/internal/wms",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
366 params: {
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
367 LAYERS: "sounding_results_contour_lines_geoserver",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
368 VERSION: "1.1.1",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
369 TILED: true
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
370 },
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
371 tileLoadFunction: function(tile, src) {
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
372 // console.log("calling for", tile, src);
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
373 HTTP.get(src, {
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
374 headers: {
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
375 "X-Gemma-Auth": localStorage.getItem("token")
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
376 },
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
377 responseType: "blob"
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
378 }).then(response => {
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
379 tile.getImage().src = URL.createObjectURL(response.data);
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
380 });
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
381 } // TODO tile.setState(TileState.ERROR);
2951
1ac58e024942 client: map layers: optimized setting visibility
Markus Kottlaender <markus@intevation.de>
parents: 2947
diff changeset
382 })
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
383 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
384 DIFFERENCES: new TileLayer({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
385 label: "Bottleneck Differences",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
386 visible: false,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
387 source: new TileWMS({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
388 preload: 0,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
389 projection: "EPSG:4326",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
390 url: window.location.origin + "/api/internal/wms",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
391 params: {
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
392 LAYERS: "sounding_differences",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
393 VERSION: "1.1.1",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
394 TILED: true
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
395 },
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
396 tileLoadFunction: function(tile, src) {
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
397 // console.log("calling for", tile, src);
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
398 HTTP.get(src, {
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
399 headers: {
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
400 "X-Gemma-Auth": localStorage.getItem("token")
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
401 },
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
402 responseType: "blob"
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
403 }).then(response => {
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
404 tile.getImage().src = URL.createObjectURL(response.data);
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
405 });
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
406 } // TODO tile.setState(TileState.ERROR);
2951
1ac58e024942 client: map layers: optimized setting visibility
Markus Kottlaender <markus@intevation.de>
parents: 2947
diff changeset
407 })
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
408 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
409 BOTTLENECKSTATUS: new VectorLayer({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
410 label: "Critical Bottlenecks",
2506
89c439721db2 client: new symbold for critical bottlenecks, normal bottlenecks are not marked anymore
Markus Kottlaender <markus@intevation.de>
parents: 2491
diff changeset
411 forLegendStyle: { point: true, resolution: 16 },
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
412 visible: true,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
413 source: new VectorSource({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
414 strategy: bboxStrategy
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
415 }),
2996
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
416 style: bottleneckStatusStyle
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
417 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
418 DISTANCEMARKS: new VectorLayer({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
419 label: "Distance marks",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
420 forLegendStyle: { point: true, resolution: 8 },
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
421 visible: false,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
422 source: new VectorSource({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
423 strategy: bboxStrategy
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
424 })
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
425 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
426 DISTANCEMARKSAXIS: new VectorLayer({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
427 label: "Distance marks, Axis",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
428 forLegendStyle: { point: true, resolution: 8 },
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
429 visible: true,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
430 source: new VectorSource({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
431 strategy: bboxStrategy
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
432 }),
2996
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
433 style: dmaStyle
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
434 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
435 GAUGES: new VectorLayer({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
436 label: "Gauges",
1099
1f4799bab8a6 deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents: 1096
diff changeset
437 forLegendStyle: { point: true, resolution: 8 },
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
438 visible: true,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
439 source: new VectorSource({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
440 strategy: bboxStrategy
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
441 }),
2996
888a3454c3ae Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2985
diff changeset
442 style: gaugeStyle,
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
443 maxResolution: 100,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
444 minResolution: 0
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
445 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
446 DRAWTOOL: new VectorLayer({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
447 label: "Draw Tool",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
448 visible: true,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
449 source: new VectorSource({ wrapX: false }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
450 style: function(feature) {
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
451 // adapted from OpenLayer's LineString Arrow Example
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
452 var geometry = feature.getGeometry();
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
453 var styles = [
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
454 // linestring
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
455 new Style({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
456 stroke: new Stroke({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
457 color: "#369aca",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
458 width: 2
2451
960550ccca55 Added gauges layer.
Sascha Wilde <wilde@intevation.de>
parents: 2446
diff changeset
459 })
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
460 })
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
461 ];
1121
035dc35e1dfc moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents: 1115
diff changeset
462
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
463 if (geometry.getType() === "LineString") {
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
464 geometry.forEachSegment(function(start, end) {
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
465 var dx = end[0] - start[0];
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
466 var dy = end[1] - start[1];
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
467 var rotation = Math.atan2(dy, dx);
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
468 // arrows
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
469 styles.push(
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
470 new Style({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
471 geometry: new Point(end),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
472 image: new Icon({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
473 // we need to make sure the image is loaded by Vue Loader
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
474 src: require("@/assets/linestring_arrow.png"),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
475 // fiddling with the anchor's y value does not help to
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
476 // position the image more centered on the line ending, as the
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
477 // default line style seems to be slightly uncentered in the
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
478 // anti-aliasing, but the image is not placed with subpixel
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
479 // precision
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
480 anchor: [0.75, 0.5],
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
481 rotateWithView: true,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
482 rotation: -rotation
1121
035dc35e1dfc moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents: 1115
diff changeset
483 })
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
484 })
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
485 );
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
486 });
1121
035dc35e1dfc moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents: 1115
diff changeset
487 }
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
488 return styles;
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
489 }
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
490 }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
491 CUTTOOL: new VectorLayer({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
492 label: "Cut Tool",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
493 visible: true,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
494 source: new VectorSource({ wrapX: false }),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
495 style: function(feature) {
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
496 // adapted from OpenLayer's LineString Arrow Example
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
497 var geometry = feature.getGeometry();
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
498 var styles = [
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
499 // linestring
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
500 new Style({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
501 stroke: new Stroke({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
502 color: "#333333",
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
503 width: 2,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
504 lineDash: [7, 7]
1140
2e06bc53b002 separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents: 1122
diff changeset
505 })
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
506 })
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
507 ];
1140
2e06bc53b002 separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents: 1122
diff changeset
508
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
509 if (geometry.getType() === "LineString") {
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
510 geometry.forEachSegment(function(start, end) {
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
511 var dx = end[0] - start[0];
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
512 var dy = end[1] - start[1];
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
513 var rotation = Math.atan2(dy, dx);
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
514 // arrows
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
515 styles.push(
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
516 new Style({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
517 geometry: new Point(end),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
518 image: new Icon({
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
519 // we need to make sure the image is loaded by Vue Loader
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
520 src: require("@/assets/linestring_arrow_grey.png"),
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
521 // fiddling with the anchor's y value does not help to
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
522 // position the image more centered on the line ending, as the
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
523 // default line style seems to be slightly uncentered in the
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
524 // anti-aliasing, but the image is not placed with subpixel
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
525 // precision
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
526 anchor: [0.75, 0.5],
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
527 rotateWithView: true,
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
528 rotation: -rotation
1140
2e06bc53b002 separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents: 1122
diff changeset
529 })
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
530 })
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
531 );
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
532 });
1140
2e06bc53b002 separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents: 1122
diff changeset
533 }
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
534 return styles;
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
535 }
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
536 })
2870
35f6e4383161 layer structure overhaul
Thomas Junk <thomas.junk@intevation.de>
parents: 2868
diff changeset
537 }
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
538 };
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
539 };
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
540
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
541 export default {
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
542 init,
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
543 namespaced: true,
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
544 state: init(),
585
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
545 getters: {
2370
7fe2f5d334dc client: improved identify tool readability
Markus Kottlaender <markus@intevation.de>
parents: 2314
diff changeset
546 filteredIdentifiedFeatures: state => {
7fe2f5d334dc client: improved identify tool readability
Markus Kottlaender <markus@intevation.de>
parents: 2314
diff changeset
547 return state.identifiedFeatures.filter(f => f.getId());
585
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
548 }
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
549 },
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
550 mutations: {
2310
92b21df288e2 client: use user specific extent only on initial load
Markus Kottlaender <markus@intevation.de>
parents: 2309
diff changeset
551 initialLoad: (state, initialLoad) => {
92b21df288e2 client: use user specific extent only on initial load
Markus Kottlaender <markus@intevation.de>
parents: 2309
diff changeset
552 state.initialLoad = initialLoad;
92b21df288e2 client: use user specific extent only on initial load
Markus Kottlaender <markus@intevation.de>
parents: 2309
diff changeset
553 },
1313
e4e35fb2d995 save map extent (center/zoom) in store, to not lose it when switching between map and admin area
Markus Kottlaender <markus@intevation.de>
parents: 1296
diff changeset
554 extent: (state, extent) => {
e4e35fb2d995 save map extent (center/zoom) in store, to not lose it when switching between map and admin area
Markus Kottlaender <markus@intevation.de>
parents: 1296
diff changeset
555 state.extent = extent;
e4e35fb2d995 save map extent (center/zoom) in store, to not lose it when switching between map and admin area
Markus Kottlaender <markus@intevation.de>
parents: 1296
diff changeset
556 },
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
557 openLayersMap: (state, map) => {
783
ab9604a46075 client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents: 782
diff changeset
558 state.openLayersMap = map;
1112
2c3d32322126 moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents: 1099
diff changeset
559 },
1435
7fa030127b05 fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents: 1395
diff changeset
560 identifyTool: (state, events) => {
7fa030127b05 fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents: 1395
diff changeset
561 state.identifyTool = events;
7fa030127b05 fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents: 1395
diff changeset
562 },
1112
2c3d32322126 moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents: 1099
diff changeset
563 setIdentifiedFeatures: (state, identifiedFeatures) => {
2c3d32322126 moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents: 1099
diff changeset
564 state.identifiedFeatures = identifiedFeatures;
2c3d32322126 moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents: 1099
diff changeset
565 },
2c3d32322126 moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents: 1099
diff changeset
566 setCurrentMeasurement: (state, measurement) => {
2c3d32322126 moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents: 1099
diff changeset
567 state.currentMeasurement = measurement;
1115
1b160eda22cf moved drawMode to map store
Markus Kottlaender <markus@intevation.de>
parents: 1114
diff changeset
568 },
1237
74562dc29e10 refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents: 1197
diff changeset
569 lineTool: (state, lineTool) => {
74562dc29e10 refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents: 1197
diff changeset
570 state.lineTool = lineTool;
1140
2e06bc53b002 separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents: 1122
diff changeset
571 },
1237
74562dc29e10 refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents: 1197
diff changeset
572 polygonTool: (state, polygonTool) => {
74562dc29e10 refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents: 1197
diff changeset
573 state.polygonTool = polygonTool;
1140
2e06bc53b002 separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents: 1122
diff changeset
574 },
2e06bc53b002 separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents: 1122
diff changeset
575 cutTool: (state, cutTool) => {
2e06bc53b002 separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents: 1122
diff changeset
576 state.cutTool = cutTool;
1158
da75faa8043f added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents: 1144
diff changeset
577 },
2186
d0498088894f map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents: 2166
diff changeset
578 moveToBoundingBox: (state, { boundingBox, zoom, preventZoomOut }) => {
d0498088894f map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents: 2166
diff changeset
579 const extent = transformExtent(boundingBox, "EPSG:4326", "EPSG:3857");
d0498088894f map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents: 2166
diff changeset
580 let view = state.openLayersMap.getView();
d0498088894f map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents: 2166
diff changeset
581 moveMap({ view, extent, zoom, preventZoomOut });
d0498088894f map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents: 2166
diff changeset
582 },
2132
7a2eedc182f7 staging: zoomable stretches. zoomToExtent etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2125
diff changeset
583 moveToExtent: (state, { feature, zoom, preventZoomOut }) => {
7a2eedc182f7 staging: zoomable stretches. zoomToExtent etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2125
diff changeset
584 const boundingBox = bbox(feature.geometry);
7a2eedc182f7 staging: zoomable stretches. zoomToExtent etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2125
diff changeset
585 const extent = transformExtent(boundingBox, "EPSG:4326", "EPSG:3857");
2108
cac5d2fba591 bbox tool from turfjs added. zoomToExtent function added to map.js
Thomas Junk <thomas.junk@intevation.de>
parents: 2101
diff changeset
586 let view = state.openLayersMap.getView();
2186
d0498088894f map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents: 2166
diff changeset
587 moveMap({ view, extent, zoom, preventZoomOut });
2108
cac5d2fba591 bbox tool from turfjs added. zoomToExtent function added to map.js
Thomas Junk <thomas.junk@intevation.de>
parents: 2101
diff changeset
588 },
1158
da75faa8043f added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents: 1144
diff changeset
589 moveMap: (state, { coordinates, zoom, preventZoomOut }) => {
da75faa8043f added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents: 1144
diff changeset
590 let view = state.openLayersMap.getView();
da75faa8043f added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents: 1144
diff changeset
591 const currentZoom = view.getZoom();
2713
b79f5c5404c2 client: made zoom optional in moveMap/moveToExtent
Markus Kottlaender <markus@intevation.de>
parents: 2643
diff changeset
592 zoom = zoom || currentZoom;
1158
da75faa8043f added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents: 1144
diff changeset
593 view.animate({
da75faa8043f added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents: 1144
diff changeset
594 zoom: preventZoomOut ? Math.max(zoom, currentZoom) : zoom,
da75faa8043f added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents: 1144
diff changeset
595 center: fromLonLat(coordinates, view.getProjection()),
da75faa8043f added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents: 1144
diff changeset
596 duration: 700
da75faa8043f added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents: 1144
diff changeset
597 });
1927
5a37ee321651 client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents: 1879
diff changeset
598 },
5a37ee321651 client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents: 1879
diff changeset
599 isolinesLegendImgDataURL: (state, isolinesLegendImgDataURL) => {
5a37ee321651 client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents: 1879
diff changeset
600 state.isolinesLegendImgDataURL = isolinesLegendImgDataURL;
2932
173ce013a021 layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents: 2910
diff changeset
601 },
173ce013a021 layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents: 2910
diff changeset
602 differencesLegendImgDataURL: (state, differencesLegendImgDataURL) => {
173ce013a021 layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents: 2910
diff changeset
603 state.differencesLegendImgDataURL = differencesLegendImgDataURL;
1144
5f98d0c9d738 linted code
Markus Kottlaender <markus@intevation.de>
parents: 1140
diff changeset
604 }
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
605 },
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
606 actions: {
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
607 openLayersMap({ commit, dispatch, state }, map) {
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
608 const drawVectorSrc = state.layers.DRAWTOOL.getSource();
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
609 const cutVectorSrc = state.layers.CUTTOOL.getSource();
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
610
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
611 // init line tool
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
612 const lineTool = new Draw({
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
613 source: drawVectorSrc,
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
614 type: "LineString",
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
615 maxPoints: 2
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
616 });
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
617 lineTool.setActive(false);
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
618 lineTool.on("drawstart", () => {
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
619 drawVectorSrc.clear();
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
620 commit("setCurrentMeasurement", null);
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
621 });
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
622 lineTool.on("drawend", event => {
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
623 commit("setCurrentMeasurement", {
1524
a0a16577261a Translation: mark some strings for translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1438
diff changeset
624 quantity: app.$gettext("Length"),
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
625 unitSymbol: "m",
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
626 value: Math.round(getLength(event.feature.getGeometry()) * 10) / 10
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
627 });
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
628 commit("application/showIdentify", true, { root: true });
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
629 });
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
630
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
631 // init polygon tool
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
632 const polygonTool = new Draw({
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
633 source: drawVectorSrc,
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
634 type: "Polygon",
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
635 maxPoints: 50
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
636 });
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
637 polygonTool.setActive(false);
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
638 polygonTool.on("drawstart", () => {
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
639 drawVectorSrc.clear();
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
640 commit("setCurrentMeasurement", null);
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
641 });
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
642 polygonTool.on("drawend", event => {
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
643 const areaSize = getArea(event.feature.getGeometry());
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
644 commit("setCurrentMeasurement", {
1524
a0a16577261a Translation: mark some strings for translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1438
diff changeset
645 quantity: app.$gettext("Area"),
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
646 unitSymbol: areaSize > 100000 ? "km²" : "m²",
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
647 value:
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
648 areaSize > 100000
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
649 ? Math.round(areaSize / 1000) / 1000 // convert into 1 km² == 1000*1000 m² and round to 1000 m²
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
650 : Math.round(areaSize)
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
651 });
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
652 commit("application/showIdentify", true, { root: true });
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
653 });
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
654
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
655 // init cut tool
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
656 const cutTool = new Draw({
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
657 source: cutVectorSrc,
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
658 type: "LineString",
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
659 maxPoints: 2,
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
660 style: new Style({
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
661 stroke: new Stroke({
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
662 color: "#444",
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
663 width: 2,
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
664 lineDash: [7, 7]
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
665 }),
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
666 image: new Circle({
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
667 fill: new Fill({ color: "#333" }),
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
668 stroke: new Stroke({ color: "#fff", width: 1.5 }),
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
669 radius: 6
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
670 })
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
671 })
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
672 });
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
673 cutTool.setActive(false);
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
674 cutTool.on("drawstart", () => {
1437
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
675 dispatch("disableIdentifyTool");
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
676 cutVectorSrc.clear();
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
677 });
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
678 cutTool.on("drawend", event => {
1395
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1363
diff changeset
679 commit("fairwayprofile/selectedCut", null, { root: true });
1437
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
680 dispatch("fairwayprofile/cut", event.feature, { root: true }).then(() =>
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
681 // This setTimeout is an ugly workaround. If we would enable the
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
682 // identifyTool here immediately then the click event from ending the
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
683 // cut will trigger it. We don't want that.
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
684 setTimeout(() => dispatch("enableIdentifyTool"), 1000)
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
685 );
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
686 });
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
687
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
688 map.addInteraction(lineTool);
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
689 map.addInteraction(cutTool);
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
690 map.addInteraction(polygonTool);
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
691
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
692 commit("lineTool", lineTool);
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
693 commit("polygonTool", polygonTool);
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
694 commit("cutTool", cutTool);
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
695 commit("openLayersMap", map);
1435
7fa030127b05 fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents: 1395
diff changeset
696 },
7fa030127b05 fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents: 1395
diff changeset
697 disableIdentifyTool({ state }) {
7fa030127b05 fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents: 1395
diff changeset
698 unByKey(state.identifyTool);
1437
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
699 state.identifyTool = null;
1435
7fa030127b05 fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents: 1395
diff changeset
700 },
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
701 enableIdentifyTool({ state, rootState, commit, dispatch }) {
1437
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
702 if (!state.identifyTool) {
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
703 state.identifyTool = state.openLayersMap.on(
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
704 ["singleclick", "dblclick"],
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
705 event => {
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
706 commit("setIdentifiedFeatures", []);
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
707 // checking our WFS layers
2166
69c49301d689 map.js: GetFeaturesAtPixel added hitTolerance:7.
Bjoern Schilberg <bjoern@intevation.de>
parents: 2157
diff changeset
708 var features = state.openLayersMap.getFeaturesAtPixel(event.pixel, {
69c49301d689 map.js: GetFeaturesAtPixel added hitTolerance:7.
Bjoern Schilberg <bjoern@intevation.de>
parents: 2157
diff changeset
709 hitTolerance: 7
69c49301d689 map.js: GetFeaturesAtPixel added hitTolerance:7.
Bjoern Schilberg <bjoern@intevation.de>
parents: 2157
diff changeset
710 });
1437
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
711 if (features) {
2510
f2758dafe390 client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents: 2506
diff changeset
712 let identifiedFeatures = [];
1435
7fa030127b05 fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents: 1395
diff changeset
713
1437
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
714 for (let feature of features) {
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
715 let id = feature.getId();
2511
e958104be9a9 removed console.log, added comment
Markus Kottlaender <markus@intevation.de>
parents: 2510
diff changeset
716 // avoid identifying the same feature twice
2510
f2758dafe390 client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents: 2506
diff changeset
717 if (
f2758dafe390 client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents: 2506
diff changeset
718 identifiedFeatures.findIndex(
f2758dafe390 client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents: 2506
diff changeset
719 f => f.getId() === feature.getId()
f2758dafe390 client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents: 2506
diff changeset
720 ) === -1
f2758dafe390 client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents: 2506
diff changeset
721 ) {
f2758dafe390 client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents: 2506
diff changeset
722 identifiedFeatures.push(feature);
f2758dafe390 client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents: 2506
diff changeset
723 }
f2758dafe390 client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents: 2506
diff changeset
724
f2758dafe390 client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents: 2506
diff changeset
725 // get selected bottleneck
1437
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
726 // RegExp.prototype.test() works with number, str and undefined
2133
602c2096c078 fix: bottleneckselection via identifytool
Thomas Junk <thomas.junk@intevation.de>
parents: 2132
diff changeset
727 if (/^bottlenecks/.test(id)) {
1438
71eb96690f91 avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents: 1437
diff changeset
728 if (
71eb96690f91 avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents: 1437
diff changeset
729 rootState.bottlenecks.selectedBottleneck !=
71eb96690f91 avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents: 1437
diff changeset
730 feature.get("objnam")
71eb96690f91 avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents: 1437
diff changeset
731 ) {
71eb96690f91 avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents: 1437
diff changeset
732 dispatch(
71eb96690f91 avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents: 1437
diff changeset
733 "bottlenecks/setSelectedBottleneck",
71eb96690f91 avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents: 1437
diff changeset
734 feature.get("objnam"),
71eb96690f91 avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents: 1437
diff changeset
735 { root: true }
1565
faa045ebdf0c select first surveydate after identification of bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents: 1524
diff changeset
736 ).then(() => {
faa045ebdf0c select first surveydate after identification of bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents: 1524
diff changeset
737 this.commit("bottlenecks/setFirstSurveySelected");
faa045ebdf0c select first surveydate after identification of bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents: 1524
diff changeset
738 });
1438
71eb96690f91 avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents: 1437
diff changeset
739 commit("moveMap", {
71eb96690f91 avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents: 1437
diff changeset
740 coordinates: getCenter(
71eb96690f91 avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents: 1437
diff changeset
741 feature
71eb96690f91 avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents: 1437
diff changeset
742 .getGeometry()
71eb96690f91 avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents: 1437
diff changeset
743 .clone()
71eb96690f91 avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents: 1437
diff changeset
744 .transform("EPSG:3857", "EPSG:4326")
71eb96690f91 avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents: 1437
diff changeset
745 .getExtent()
71eb96690f91 avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents: 1437
diff changeset
746 ),
71eb96690f91 avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents: 1437
diff changeset
747 zoom: 17,
71eb96690f91 avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents: 1437
diff changeset
748 preventZoomOut: true
71eb96690f91 avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents: 1437
diff changeset
749 });
71eb96690f91 avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents: 1437
diff changeset
750 }
1437
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
751 }
2590
1686ec185155 client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents: 2568
diff changeset
752
1686ec185155 client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents: 2568
diff changeset
753 // get selected gauge
1686ec185155 client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents: 2568
diff changeset
754 if (/^gauges/.test(id)) {
2596
8774054959a7 client: added Gauges dialog/tool to show waterlevel diagrams
Markus Kottlaender <markus@intevation.de>
parents: 2590
diff changeset
755 if (
2643
27933e66e848 client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents: 2604
diff changeset
756 rootState.gauges.selectedGaugeISRS !==
27933e66e848 client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents: 2604
diff changeset
757 feature.get("isrs_code")
2596
8774054959a7 client: added Gauges dialog/tool to show waterlevel diagrams
Markus Kottlaender <markus@intevation.de>
parents: 2590
diff changeset
758 ) {
2604
85f9bf4a6eba client: gauge waterlevel diagram: draw reference waterlevels
Markus Kottlaender <markus@intevation.de>
parents: 2596
diff changeset
759 dispatch(
2643
27933e66e848 client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents: 2604
diff changeset
760 "gauges/selectedGaugeISRS",
27933e66e848 client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents: 2604
diff changeset
761 feature.get("isrs_code"),
2604
85f9bf4a6eba client: gauge waterlevel diagram: draw reference waterlevels
Markus Kottlaender <markus@intevation.de>
parents: 2596
diff changeset
762 {
85f9bf4a6eba client: gauge waterlevel diagram: draw reference waterlevels
Markus Kottlaender <markus@intevation.de>
parents: 2596
diff changeset
763 root: true
85f9bf4a6eba client: gauge waterlevel diagram: draw reference waterlevels
Markus Kottlaender <markus@intevation.de>
parents: 2596
diff changeset
764 }
85f9bf4a6eba client: gauge waterlevel diagram: draw reference waterlevels
Markus Kottlaender <markus@intevation.de>
parents: 2596
diff changeset
765 );
2590
1686ec185155 client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents: 2568
diff changeset
766 commit("moveMap", {
1686ec185155 client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents: 2568
diff changeset
767 coordinates: getCenter(
1686ec185155 client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents: 2568
diff changeset
768 feature
1686ec185155 client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents: 2568
diff changeset
769 .getGeometry()
1686ec185155 client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents: 2568
diff changeset
770 .clone()
1686ec185155 client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents: 2568
diff changeset
771 .transform("EPSG:3857", "EPSG:4326")
1686ec185155 client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents: 2568
diff changeset
772 .getExtent()
1686ec185155 client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents: 2568
diff changeset
773 ),
2713
b79f5c5404c2 client: made zoom optional in moveMap/moveToExtent
Markus Kottlaender <markus@intevation.de>
parents: 2643
diff changeset
774 zoom: null,
2590
1686ec185155 client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents: 2568
diff changeset
775 preventZoomOut: true
1686ec185155 client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents: 2568
diff changeset
776 });
1686ec185155 client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents: 2568
diff changeset
777 }
1686ec185155 client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents: 2568
diff changeset
778 }
2910
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
779
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
780 // get selected stretch
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
781 if (/^stretches/.test(id)) {
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
782 if (rootState.imports.selectedStretchId === feature.getId()) {
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
783 commit("imports/selectedStretchId", null, { root: true });
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
784 } else {
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
785 commit("imports/selectedStretchId", feature.getId(), {
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
786 root: true
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
787 });
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
788 commit("moveMap", {
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
789 coordinates: getCenter(
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
790 feature
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
791 .getGeometry()
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
792 .clone()
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
793 .transform("EPSG:3857", "EPSG:4326")
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
794 .getExtent()
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
795 ),
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
796 zoom: null,
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
797 preventZoomOut: true
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
798 });
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
799 }
c8c7122047a2 client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents: 2909
diff changeset
800 }
1435
7fa030127b05 fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents: 1395
diff changeset
801 }
2510
f2758dafe390 client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents: 2506
diff changeset
802
f2758dafe390 client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents: 2506
diff changeset
803 commit("setIdentifiedFeatures", identifiedFeatures);
1435
7fa030127b05 fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents: 1395
diff changeset
804 }
1437
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
805
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
806 // DEBUG output and example how to remove the GeometryName
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
807 /*
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
808 for (let feature of features) {
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
809 console.log("Identified:", feature.getId());
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
810 for (let key of feature.getKeys()) {
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
811 if (key != feature.getGeometryName()) {
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
812 console.log(key, feature.get(key));
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
813 }
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
814 }
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
815 }
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
816 */
1435
7fa030127b05 fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents: 1395
diff changeset
817
1437
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
818 // trying the GetFeatureInfo way for WMS
2957
b74ebeb2bdc8 client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents: 2951
diff changeset
819 var wmsSource = state.layers.INLANDECDIS.getSource();
1437
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
820 var url = wmsSource.getGetFeatureInfoUrl(
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
821 event.coordinate,
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
822 100 /* resolution */,
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
823 "EPSG:3857",
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
824 // { INFO_FORMAT: "application/vnd.ogc.gml" } // not allowed by d4d
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
825 { INFO_FORMAT: "text/plain" }
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
826 );
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
827
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
828 if (url) {
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
829 // cannot directly query here because of SOP
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
830 console.log("GetFeatureInfo url:", url);
1435
7fa030127b05 fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents: 1395
diff changeset
831 }
7fa030127b05 fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents: 1395
diff changeset
832 }
1437
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
833 );
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
834 }
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
835 }
585
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
836 }
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
837 };