Mercurial > gemma
annotate client/src/store/map.js @ 2997:707e1bc24d93
yarn lint --fix
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 10 Apr 2019 15:22:35 +0200 |
parents | 888a3454c3ae |
children | 44493664d40e |
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 }) |
2997 | 108 }); |
2996
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 } |
2997 | 210 }; |
2996
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 |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
242 // initial state |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
243 const init = () => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
244 return { |
783
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
782
diff
changeset
|
245 openLayersMap: null, |
2310
92b21df288e2
client: use user specific extent only on initial load
Markus Kottlaender <markus@intevation.de>
parents:
2309
diff
changeset
|
246 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
|
247 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
|
248 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
|
249 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
|
250 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
|
251 }, |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
252 identifyTool: null, // event binding (singleclick, dblclick) |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
253 identifiedFeatures: [], // map features identified by clicking on the map |
1247
c14353e2cdb9
repositioning of buttons (issue225)
Markus Kottlaender <markus@intevation.de>
parents:
1237
diff
changeset
|
254 currentMeasurement: null, // distance or area from line-/polygon-/cutTool |
1237
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
255 lineTool: null, // open layers interaction object (Draw) |
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
256 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
|
257 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
|
258 isolinesLegendImgDataURL: "", |
2932
173ce013a021
layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents:
2910
diff
changeset
|
259 differencesLegendImgDataURL: "", |
2870
35f6e4383161
layer structure overhaul
Thomas Junk <thomas.junk@intevation.de>
parents:
2868
diff
changeset
|
260 layers: { |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
261 OPENSTREETMAP: new TileLayer({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
262 label: "Open Streetmap", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
263 visible: true, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
264 source: new OSM() |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
265 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
266 INLANDECDIS: new TileLayer({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
267 label: "Inland ECDIS chart Danube", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
268 visible: true, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
269 source: new TileWMS({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
270 preload: 1, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
271 url: "https://service.d4d-portal.info/wms/", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
272 crossOrigin: "anonymous", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
273 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
|
274 }) |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
275 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
276 WATERWAYAREA: new VectorLayer({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
277 label: "Waterway Area", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
278 visible: true, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
279 source: new VectorSource({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
280 strategy: bboxStrategy |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
281 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
282 style: new Style({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
283 stroke: new Stroke({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
284 color: "rgba(0, 102, 0, 1)", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
285 width: 2 |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
286 }) |
2951
1ac58e024942
client: map layers: optimized setting visibility
Markus Kottlaender <markus@intevation.de>
parents:
2947
diff
changeset
|
287 }) |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
288 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
289 STRETCHES: new VectorLayer({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
290 label: "Stretches", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
291 visible: false, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
292 source: new VectorSource({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
293 strategy: bboxStrategy |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
294 }), |
2996
888a3454c3ae
Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2985
diff
changeset
|
295 style: stretchesStyle |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
296 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
297 FAIRWAYDIMENSIONSLOS1: new VectorLayer({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
298 label: "LOS 1 Fairway Dimensions", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
299 visible: false, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
300 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
|
301 style: fwd1Style |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
302 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
303 FAIRWAYDIMENSIONSLOS2: new VectorLayer({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
304 label: "LOS 2 Fairway Dimensions", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
305 visible: false, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
306 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
|
307 style: fwd2Style |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
308 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
309 FAIRWAYDIMENSIONSLOS3: new VectorLayer({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
310 label: "LOS 3 Fairway Dimensions", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
311 visible: true, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
312 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
|
313 style: fwd3Style |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
314 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
315 WATERWAYAXIS: new VectorLayer({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
316 label: "Waterway Axis", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
317 visible: true, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
318 source: new VectorSource({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
319 strategy: bboxStrategy |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
320 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
321 style: new Style({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
322 stroke: new Stroke({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
323 color: "rgba(0, 0, 255, .5)", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
324 lineDash: [5, 5], |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
325 width: 2 |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
326 }) |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
327 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
328 // 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
|
329 // resolution. |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
330 maxResolution: 5, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
331 minResolution: 0 |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
332 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
333 WATERWAYPROFILES: new VectorLayer({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
334 label: "Waterway Profiles", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
335 visible: true, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
336 source: new VectorSource({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
337 strategy: bboxStrategy |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
338 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
339 style: new Style({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
340 stroke: new Stroke({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
341 color: "rgba(0, 0, 255, .5)", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
342 lineDash: [5, 5], |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
343 width: 2 |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
344 }) |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
345 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
346 maxResolution: 2.5, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
347 minResolution: 0 |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
348 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
349 BOTTLENECKS: new VectorLayer({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
350 label: "Bottlenecks", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
351 visible: true, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
352 source: new VectorSource({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
353 strategy: bboxStrategy |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
354 }), |
2996
888a3454c3ae
Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2985
diff
changeset
|
355 style: bottleneckStyle |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
356 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
357 BOTTLENECKISOLINE: new TileLayer({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
358 label: "Bottleneck isolines", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
359 visible: false, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
360 source: new TileWMS({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
361 preload: 0, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
362 projection: "EPSG:3857", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
363 url: window.location.origin + "/api/internal/wms", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
364 params: { |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
365 LAYERS: "sounding_results_contour_lines_geoserver", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
366 VERSION: "1.1.1", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
367 TILED: true |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
368 }, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
369 tileLoadFunction: function(tile, src) { |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
370 // console.log("calling for", tile, src); |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
371 HTTP.get(src, { |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
372 headers: { |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
373 "X-Gemma-Auth": localStorage.getItem("token") |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
374 }, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
375 responseType: "blob" |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
376 }).then(response => { |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
377 tile.getImage().src = URL.createObjectURL(response.data); |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
378 }); |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
379 } // TODO tile.setState(TileState.ERROR); |
2951
1ac58e024942
client: map layers: optimized setting visibility
Markus Kottlaender <markus@intevation.de>
parents:
2947
diff
changeset
|
380 }) |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
381 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
382 DIFFERENCES: new TileLayer({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
383 label: "Bottleneck Differences", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
384 visible: false, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
385 source: new TileWMS({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
386 preload: 0, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
387 projection: "EPSG:4326", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
388 url: window.location.origin + "/api/internal/wms", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
389 params: { |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
390 LAYERS: "sounding_differences", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
391 VERSION: "1.1.1", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
392 TILED: true |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
393 }, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
394 tileLoadFunction: function(tile, src) { |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
395 // console.log("calling for", tile, src); |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
396 HTTP.get(src, { |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
397 headers: { |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
398 "X-Gemma-Auth": localStorage.getItem("token") |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
399 }, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
400 responseType: "blob" |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
401 }).then(response => { |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
402 tile.getImage().src = URL.createObjectURL(response.data); |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
403 }); |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
404 } // TODO tile.setState(TileState.ERROR); |
2951
1ac58e024942
client: map layers: optimized setting visibility
Markus Kottlaender <markus@intevation.de>
parents:
2947
diff
changeset
|
405 }) |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
406 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
407 BOTTLENECKSTATUS: new VectorLayer({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
408 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
|
409 forLegendStyle: { point: true, resolution: 16 }, |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
410 visible: true, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
411 source: new VectorSource({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
412 strategy: bboxStrategy |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
413 }), |
2996
888a3454c3ae
Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2985
diff
changeset
|
414 style: bottleneckStatusStyle |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
415 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
416 DISTANCEMARKS: new VectorLayer({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
417 label: "Distance marks", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
418 forLegendStyle: { point: true, resolution: 8 }, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
419 visible: false, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
420 source: new VectorSource({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
421 strategy: bboxStrategy |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
422 }) |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
423 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
424 DISTANCEMARKSAXIS: new VectorLayer({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
425 label: "Distance marks, Axis", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
426 forLegendStyle: { point: true, resolution: 8 }, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
427 visible: true, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
428 source: new VectorSource({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
429 strategy: bboxStrategy |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
430 }), |
2996
888a3454c3ae
Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2985
diff
changeset
|
431 style: dmaStyle |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
432 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
433 GAUGES: new VectorLayer({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
434 label: "Gauges", |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
435 forLegendStyle: { point: true, resolution: 8 }, |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
436 visible: true, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
437 source: new VectorSource({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
438 strategy: bboxStrategy |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
439 }), |
2996
888a3454c3ae
Extracted WFS style functions and styles to avoid massive memory allocation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2985
diff
changeset
|
440 style: gaugeStyle, |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
441 maxResolution: 100, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
442 minResolution: 0 |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
443 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
444 DRAWTOOL: new VectorLayer({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
445 label: "Draw Tool", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
446 visible: true, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
447 source: new VectorSource({ wrapX: false }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
448 style: function(feature) { |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
449 // adapted from OpenLayer's LineString Arrow Example |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
450 var geometry = feature.getGeometry(); |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
451 var styles = [ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
452 // linestring |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
453 new Style({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
454 stroke: new Stroke({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
455 color: "#369aca", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
456 width: 2 |
2451 | 457 }) |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
458 }) |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
459 ]; |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
460 |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
461 if (geometry.getType() === "LineString") { |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
462 geometry.forEachSegment(function(start, end) { |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
463 var dx = end[0] - start[0]; |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
464 var dy = end[1] - start[1]; |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
465 var rotation = Math.atan2(dy, dx); |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
466 // arrows |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
467 styles.push( |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
468 new Style({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
469 geometry: new Point(end), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
470 image: new Icon({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
471 // 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
|
472 src: require("@/assets/linestring_arrow.png"), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
473 // 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
|
474 // 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
|
475 // 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
|
476 // 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
|
477 // precision |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
478 anchor: [0.75, 0.5], |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
479 rotateWithView: true, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
480 rotation: -rotation |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
481 }) |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
482 }) |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
483 ); |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
484 }); |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
485 } |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
486 return styles; |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
487 } |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
488 }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
489 CUTTOOL: new VectorLayer({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
490 label: "Cut Tool", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
491 visible: true, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
492 source: new VectorSource({ wrapX: false }), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
493 style: function(feature) { |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
494 // adapted from OpenLayer's LineString Arrow Example |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
495 var geometry = feature.getGeometry(); |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
496 var styles = [ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
497 // linestring |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
498 new Style({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
499 stroke: new Stroke({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
500 color: "#333333", |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
501 width: 2, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
502 lineDash: [7, 7] |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
503 }) |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
504 }) |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
505 ]; |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
506 |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
507 if (geometry.getType() === "LineString") { |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
508 geometry.forEachSegment(function(start, end) { |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
509 var dx = end[0] - start[0]; |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
510 var dy = end[1] - start[1]; |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
511 var rotation = Math.atan2(dy, dx); |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
512 // arrows |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
513 styles.push( |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
514 new Style({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
515 geometry: new Point(end), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
516 image: new Icon({ |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
517 // 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
|
518 src: require("@/assets/linestring_arrow_grey.png"), |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
519 // 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
|
520 // 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
|
521 // 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
|
522 // 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
|
523 // precision |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
524 anchor: [0.75, 0.5], |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
525 rotateWithView: true, |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
526 rotation: -rotation |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
527 }) |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
528 }) |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
529 ); |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
530 }); |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
531 } |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
532 return styles; |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
533 } |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
534 }) |
2870
35f6e4383161
layer structure overhaul
Thomas Junk <thomas.junk@intevation.de>
parents:
2868
diff
changeset
|
535 } |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
536 }; |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
537 }; |
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 export default { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
540 init, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
541 namespaced: true, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
542 state: init(), |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
543 getters: { |
2370
7fe2f5d334dc
client: improved identify tool readability
Markus Kottlaender <markus@intevation.de>
parents:
2314
diff
changeset
|
544 filteredIdentifiedFeatures: state => { |
7fe2f5d334dc
client: improved identify tool readability
Markus Kottlaender <markus@intevation.de>
parents:
2314
diff
changeset
|
545 return state.identifiedFeatures.filter(f => f.getId()); |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
546 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
547 }, |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
548 mutations: { |
2310
92b21df288e2
client: use user specific extent only on initial load
Markus Kottlaender <markus@intevation.de>
parents:
2309
diff
changeset
|
549 initialLoad: (state, initialLoad) => { |
92b21df288e2
client: use user specific extent only on initial load
Markus Kottlaender <markus@intevation.de>
parents:
2309
diff
changeset
|
550 state.initialLoad = initialLoad; |
92b21df288e2
client: use user specific extent only on initial load
Markus Kottlaender <markus@intevation.de>
parents:
2309
diff
changeset
|
551 }, |
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
|
552 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
|
553 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
|
554 }, |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
555 openLayersMap: (state, map) => { |
783
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
782
diff
changeset
|
556 state.openLayersMap = map; |
1112
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
557 }, |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
558 identifyTool: (state, events) => { |
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
559 state.identifyTool = events; |
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
560 }, |
1112
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
561 setIdentifiedFeatures: (state, identifiedFeatures) => { |
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
562 state.identifiedFeatures = identifiedFeatures; |
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
563 }, |
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
564 setCurrentMeasurement: (state, measurement) => { |
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
565 state.currentMeasurement = measurement; |
1115
1b160eda22cf
moved drawMode to map store
Markus Kottlaender <markus@intevation.de>
parents:
1114
diff
changeset
|
566 }, |
1237
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
567 lineTool: (state, lineTool) => { |
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
568 state.lineTool = lineTool; |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
569 }, |
1237
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
570 polygonTool: (state, polygonTool) => { |
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
571 state.polygonTool = polygonTool; |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
572 }, |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
573 cutTool: (state, cutTool) => { |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
574 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
|
575 }, |
2186
d0498088894f
map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents:
2166
diff
changeset
|
576 moveToBoundingBox: (state, { boundingBox, zoom, preventZoomOut }) => { |
d0498088894f
map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents:
2166
diff
changeset
|
577 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
|
578 let view = state.openLayersMap.getView(); |
d0498088894f
map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents:
2166
diff
changeset
|
579 moveMap({ view, extent, zoom, preventZoomOut }); |
d0498088894f
map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents:
2166
diff
changeset
|
580 }, |
2132
7a2eedc182f7
staging: zoomable stretches. zoomToExtent etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2125
diff
changeset
|
581 moveToExtent: (state, { feature, zoom, preventZoomOut }) => { |
7a2eedc182f7
staging: zoomable stretches. zoomToExtent etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2125
diff
changeset
|
582 const boundingBox = bbox(feature.geometry); |
7a2eedc182f7
staging: zoomable stretches. zoomToExtent etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2125
diff
changeset
|
583 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
|
584 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
|
585 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
|
586 }, |
1158
da75faa8043f
added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
587 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
|
588 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
|
589 const currentZoom = view.getZoom(); |
2713
b79f5c5404c2
client: made zoom optional in moveMap/moveToExtent
Markus Kottlaender <markus@intevation.de>
parents:
2643
diff
changeset
|
590 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
|
591 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
|
592 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
|
593 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
|
594 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
|
595 }); |
1927
5a37ee321651
client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents:
1879
diff
changeset
|
596 }, |
5a37ee321651
client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents:
1879
diff
changeset
|
597 isolinesLegendImgDataURL: (state, isolinesLegendImgDataURL) => { |
5a37ee321651
client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents:
1879
diff
changeset
|
598 state.isolinesLegendImgDataURL = isolinesLegendImgDataURL; |
2932
173ce013a021
layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents:
2910
diff
changeset
|
599 }, |
173ce013a021
layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents:
2910
diff
changeset
|
600 differencesLegendImgDataURL: (state, differencesLegendImgDataURL) => { |
173ce013a021
layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents:
2910
diff
changeset
|
601 state.differencesLegendImgDataURL = differencesLegendImgDataURL; |
1144 | 602 } |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
603 }, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
604 actions: { |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
605 openLayersMap({ commit, dispatch, state }, map) { |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
606 const drawVectorSrc = state.layers.DRAWTOOL.getSource(); |
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
607 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
|
608 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
609 // init line tool |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
610 const lineTool = new Draw({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
611 source: drawVectorSrc, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
612 type: "LineString", |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
613 maxPoints: 2 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
614 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
615 lineTool.setActive(false); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
616 lineTool.on("drawstart", () => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
617 drawVectorSrc.clear(); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
618 commit("setCurrentMeasurement", null); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
619 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
620 lineTool.on("drawend", event => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
621 commit("setCurrentMeasurement", { |
1524
a0a16577261a
Translation: mark some strings for translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1438
diff
changeset
|
622 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
|
623 unitSymbol: "m", |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
624 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
|
625 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
626 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
|
627 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
628 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
629 // init polygon tool |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
630 const polygonTool = new Draw({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
631 source: drawVectorSrc, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
632 type: "Polygon", |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
633 maxPoints: 50 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
634 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
635 polygonTool.setActive(false); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
636 polygonTool.on("drawstart", () => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
637 drawVectorSrc.clear(); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
638 commit("setCurrentMeasurement", null); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
639 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
640 polygonTool.on("drawend", event => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
641 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
|
642 commit("setCurrentMeasurement", { |
1524
a0a16577261a
Translation: mark some strings for translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1438
diff
changeset
|
643 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
|
644 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
|
645 value: |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
646 areaSize > 100000 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
647 ? 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
|
648 : Math.round(areaSize) |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
649 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
650 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
|
651 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
652 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
653 // init cut tool |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
654 const cutTool = new Draw({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
655 source: cutVectorSrc, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
656 type: "LineString", |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
657 maxPoints: 2, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
658 style: new Style({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
659 stroke: new Stroke({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
660 color: "#444", |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
661 width: 2, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
662 lineDash: [7, 7] |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
663 }), |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
664 image: new Circle({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
665 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
|
666 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
|
667 radius: 6 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
668 }) |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
669 }) |
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 cutTool.setActive(false); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
672 cutTool.on("drawstart", () => { |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
673 dispatch("disableIdentifyTool"); |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
674 cutVectorSrc.clear(); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
675 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
676 cutTool.on("drawend", event => { |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1363
diff
changeset
|
677 commit("fairwayprofile/selectedCut", null, { root: true }); |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
678 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
|
679 // 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
|
680 // 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
|
681 // 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
|
682 setTimeout(() => dispatch("enableIdentifyTool"), 1000) |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
683 ); |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
684 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
685 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
686 map.addInteraction(lineTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
687 map.addInteraction(cutTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
688 map.addInteraction(polygonTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
689 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
690 commit("lineTool", lineTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
691 commit("polygonTool", polygonTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
692 commit("cutTool", cutTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
693 commit("openLayersMap", map); |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
694 }, |
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
695 disableIdentifyTool({ state }) { |
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
696 unByKey(state.identifyTool); |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
697 state.identifyTool = null; |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
698 }, |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
699 enableIdentifyTool({ state, rootState, commit, dispatch }) { |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
700 if (!state.identifyTool) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
701 state.identifyTool = state.openLayersMap.on( |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
702 ["singleclick", "dblclick"], |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
703 event => { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
704 commit("setIdentifiedFeatures", []); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
705 // checking our WFS layers |
2166
69c49301d689
map.js: GetFeaturesAtPixel added hitTolerance:7.
Bjoern Schilberg <bjoern@intevation.de>
parents:
2157
diff
changeset
|
706 var features = state.openLayersMap.getFeaturesAtPixel(event.pixel, { |
69c49301d689
map.js: GetFeaturesAtPixel added hitTolerance:7.
Bjoern Schilberg <bjoern@intevation.de>
parents:
2157
diff
changeset
|
707 hitTolerance: 7 |
69c49301d689
map.js: GetFeaturesAtPixel added hitTolerance:7.
Bjoern Schilberg <bjoern@intevation.de>
parents:
2157
diff
changeset
|
708 }); |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
709 if (features) { |
2510
f2758dafe390
client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents:
2506
diff
changeset
|
710 let identifiedFeatures = []; |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
711 |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
712 for (let feature of features) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
713 let id = feature.getId(); |
2511
e958104be9a9
removed console.log, added comment
Markus Kottlaender <markus@intevation.de>
parents:
2510
diff
changeset
|
714 // 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
|
715 if ( |
f2758dafe390
client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents:
2506
diff
changeset
|
716 identifiedFeatures.findIndex( |
f2758dafe390
client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents:
2506
diff
changeset
|
717 f => f.getId() === feature.getId() |
f2758dafe390
client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents:
2506
diff
changeset
|
718 ) === -1 |
f2758dafe390
client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents:
2506
diff
changeset
|
719 ) { |
f2758dafe390
client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents:
2506
diff
changeset
|
720 identifiedFeatures.push(feature); |
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 |
f2758dafe390
client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents:
2506
diff
changeset
|
723 // get selected bottleneck |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
724 // 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
|
725 if (/^bottlenecks/.test(id)) { |
1438
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
726 if ( |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
727 rootState.bottlenecks.selectedBottleneck != |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
728 feature.get("objnam") |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
729 ) { |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
730 dispatch( |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
731 "bottlenecks/setSelectedBottleneck", |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
732 feature.get("objnam"), |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
733 { root: true } |
1565
faa045ebdf0c
select first surveydate after identification of bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents:
1524
diff
changeset
|
734 ).then(() => { |
faa045ebdf0c
select first surveydate after identification of bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents:
1524
diff
changeset
|
735 this.commit("bottlenecks/setFirstSurveySelected"); |
faa045ebdf0c
select first surveydate after identification of bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents:
1524
diff
changeset
|
736 }); |
1438
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
737 commit("moveMap", { |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
738 coordinates: getCenter( |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
739 feature |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
740 .getGeometry() |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
741 .clone() |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
742 .transform("EPSG:3857", "EPSG:4326") |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
743 .getExtent() |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
744 ), |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
745 zoom: 17, |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
746 preventZoomOut: true |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
747 }); |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
748 } |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
749 } |
2590
1686ec185155
client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents:
2568
diff
changeset
|
750 |
1686ec185155
client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents:
2568
diff
changeset
|
751 // get selected gauge |
1686ec185155
client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents:
2568
diff
changeset
|
752 if (/^gauges/.test(id)) { |
2596
8774054959a7
client: added Gauges dialog/tool to show waterlevel diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2590
diff
changeset
|
753 if ( |
2643
27933e66e848
client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents:
2604
diff
changeset
|
754 rootState.gauges.selectedGaugeISRS !== |
27933e66e848
client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents:
2604
diff
changeset
|
755 feature.get("isrs_code") |
2596
8774054959a7
client: added Gauges dialog/tool to show waterlevel diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2590
diff
changeset
|
756 ) { |
2604
85f9bf4a6eba
client: gauge waterlevel diagram: draw reference waterlevels
Markus Kottlaender <markus@intevation.de>
parents:
2596
diff
changeset
|
757 dispatch( |
2643
27933e66e848
client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents:
2604
diff
changeset
|
758 "gauges/selectedGaugeISRS", |
27933e66e848
client: gauges: use isrs_code as unique id for gauges
Markus Kottlaender <markus@intevation.de>
parents:
2604
diff
changeset
|
759 feature.get("isrs_code"), |
2604
85f9bf4a6eba
client: gauge waterlevel diagram: draw reference waterlevels
Markus Kottlaender <markus@intevation.de>
parents:
2596
diff
changeset
|
760 { |
85f9bf4a6eba
client: gauge waterlevel diagram: draw reference waterlevels
Markus Kottlaender <markus@intevation.de>
parents:
2596
diff
changeset
|
761 root: true |
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 ); |
2590
1686ec185155
client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents:
2568
diff
changeset
|
764 commit("moveMap", { |
1686ec185155
client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents:
2568
diff
changeset
|
765 coordinates: getCenter( |
1686ec185155
client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents:
2568
diff
changeset
|
766 feature |
1686ec185155
client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents:
2568
diff
changeset
|
767 .getGeometry() |
1686ec185155
client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents:
2568
diff
changeset
|
768 .clone() |
1686ec185155
client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents:
2568
diff
changeset
|
769 .transform("EPSG:3857", "EPSG:4326") |
1686ec185155
client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents:
2568
diff
changeset
|
770 .getExtent() |
1686ec185155
client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents:
2568
diff
changeset
|
771 ), |
2713
b79f5c5404c2
client: made zoom optional in moveMap/moveToExtent
Markus Kottlaender <markus@intevation.de>
parents:
2643
diff
changeset
|
772 zoom: null, |
2590
1686ec185155
client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents:
2568
diff
changeset
|
773 preventZoomOut: true |
1686ec185155
client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents:
2568
diff
changeset
|
774 }); |
1686ec185155
client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents:
2568
diff
changeset
|
775 } |
1686ec185155
client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents:
2568
diff
changeset
|
776 } |
2910
c8c7122047a2
client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents:
2909
diff
changeset
|
777 |
c8c7122047a2
client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents:
2909
diff
changeset
|
778 // 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
|
779 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
|
780 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
|
781 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
|
782 } else { |
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", feature.getId(), { |
c8c7122047a2
client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents:
2909
diff
changeset
|
784 root: true |
c8c7122047a2
client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents:
2909
diff
changeset
|
785 }); |
c8c7122047a2
client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents:
2909
diff
changeset
|
786 commit("moveMap", { |
c8c7122047a2
client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents:
2909
diff
changeset
|
787 coordinates: getCenter( |
c8c7122047a2
client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents:
2909
diff
changeset
|
788 feature |
c8c7122047a2
client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents:
2909
diff
changeset
|
789 .getGeometry() |
c8c7122047a2
client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents:
2909
diff
changeset
|
790 .clone() |
c8c7122047a2
client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents:
2909
diff
changeset
|
791 .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
|
792 .getExtent() |
c8c7122047a2
client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents:
2909
diff
changeset
|
793 ), |
c8c7122047a2
client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents:
2909
diff
changeset
|
794 zoom: null, |
c8c7122047a2
client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents:
2909
diff
changeset
|
795 preventZoomOut: true |
c8c7122047a2
client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents:
2909
diff
changeset
|
796 }); |
c8c7122047a2
client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents:
2909
diff
changeset
|
797 } |
c8c7122047a2
client: stretches: select/unselect stretches by clicking on them on the map
Markus Kottlaender <markus@intevation.de>
parents:
2909
diff
changeset
|
798 } |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
799 } |
2510
f2758dafe390
client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents:
2506
diff
changeset
|
800 |
f2758dafe390
client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents:
2506
diff
changeset
|
801 commit("setIdentifiedFeatures", identifiedFeatures); |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
802 } |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
803 |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
804 // 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
|
805 /* |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
806 for (let feature of features) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
807 console.log("Identified:", feature.getId()); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
808 for (let key of feature.getKeys()) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
809 if (key != feature.getGeometryName()) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
810 console.log(key, feature.get(key)); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
811 } |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
812 } |
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 */ |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
815 |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
816 // trying the GetFeatureInfo way for WMS |
2957
b74ebeb2bdc8
client: layers: improved structure of layer configuration
Markus Kottlaender <markus@intevation.de>
parents:
2951
diff
changeset
|
817 var wmsSource = state.layers.INLANDECDIS.getSource(); |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
818 var url = wmsSource.getGetFeatureInfoUrl( |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
819 event.coordinate, |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
820 100 /* resolution */, |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
821 "EPSG:3857", |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
822 // { 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
|
823 { INFO_FORMAT: "text/plain" } |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
824 ); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
825 |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
826 if (url) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
827 // cannot directly query here because of SOP |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
828 console.log("GetFeatureInfo url:", url); |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
829 } |
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
830 } |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
831 ); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
832 } |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
833 } |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
834 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
835 }; |