Mercurial > gemma
annotate client/src/store/map.js @ 2411:27d3e9eda8b6
client: table component: fade transition for adding/removing items
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Thu, 28 Feb 2019 12:16:27 +0100 |
parents | 7fe2f5d334dc |
children | e0f423606929 |
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 |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
19 import TileWMS from "ol/source/TileWMS.js"; |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
20 import { Tile as TileLayer, Vector as VectorLayer } from "ol/layer.js"; |
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"; |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
22 import Draw from "ol/interaction/Draw.js"; |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
23 import { Icon, Stroke, Style, Fill, Text, Circle } from "ol/style.js"; |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
24 import VectorSource from "ol/source/Vector.js"; |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
25 import Point from "ol/geom/Point.js"; |
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"; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
1247
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"; |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
29 import { getLength, getArea } from "ol/sphere.js"; |
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"; |
2132
7a2eedc182f7
staging: zoomable stretches. zoomToExtent etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2125
diff
changeset
|
32 import { transformExtent } from "ol/proj.js"; |
7a2eedc182f7
staging: zoomable stretches. zoomToExtent etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2125
diff
changeset
|
33 import bbox from "@turf/bbox"; |
1524
a0a16577261a
Translation: mark some strings for translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1438
diff
changeset
|
34 import app from "../main"; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
35 |
2140
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
36 const LAYERS = { |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
37 OPENSTREETMAP: "Open Streetmap", |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
38 INLANDECDIS: "Inland ECDIS chart Danube", |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
39 WATERWAYAREA: "Waterway Area", |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
40 STRETCHES: "Stretches", |
2273
4eeaba4ef573
client: rename the Fairway Dimensions layers
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2263
diff
changeset
|
41 FAIRWAYDIMENSIONSLOS1: "LOS 1 Fairway Dimensions", |
4eeaba4ef573
client: rename the Fairway Dimensions layers
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2263
diff
changeset
|
42 FAIRWAYDIMENSIONSLOS2: "LOS 2 Fairway Dimensions", |
4eeaba4ef573
client: rename the Fairway Dimensions layers
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2263
diff
changeset
|
43 FAIRWAYDIMENSIONSLOS3: "LOS 3 Fairway Dimensions", |
2140
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
44 WATERWAYAXIS: "Waterway Axis", |
2157
8be0fbac2297
Added layer for waterway profiles.
Sascha Wilde <wilde@intevation.de>
parents:
2140
diff
changeset
|
45 WATERWAYPROFILES: "Waterway Profiles", |
2140
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
46 BOTTLENECKS: "Bottlenecks", |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
47 BOTTLENECKISOLINE: "Bottleneck isolines", |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
48 DISTANCEMARKS: "Distance marks", |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
49 DISTANCEMARKSAXIS: "Distance marks, Axis", |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
50 DRAWTOOL: "Draw Tool", |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
51 CUTTOOL: "Cut Tool" |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
52 }; |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
53 |
2186
d0498088894f
map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents:
2166
diff
changeset
|
54 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
|
55 const currentZoom = view.getZoom(); |
d0498088894f
map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents:
2166
diff
changeset
|
56 view.fit(extent, { |
d0498088894f
map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents:
2166
diff
changeset
|
57 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
|
58 duration: 700 |
d0498088894f
map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents:
2166
diff
changeset
|
59 }); |
d0498088894f
map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents:
2166
diff
changeset
|
60 }; |
d0498088894f
map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents:
2166
diff
changeset
|
61 |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
62 // initial state |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
63 const init = () => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
64 return { |
783
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
782
diff
changeset
|
65 openLayersMap: null, |
2310
92b21df288e2
client: use user specific extent only on initial load
Markus Kottlaender <markus@intevation.de>
parents:
2309
diff
changeset
|
66 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
|
67 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
|
68 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
|
69 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
|
70 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
|
71 }, |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
72 identifyTool: null, // event binding (singleclick, dblclick) |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
73 identifiedFeatures: [], // map features identified by clicking on the map |
1247
c14353e2cdb9
repositioning of buttons (issue225)
Markus Kottlaender <markus@intevation.de>
parents:
1237
diff
changeset
|
74 currentMeasurement: null, // distance or area from line-/polygon-/cutTool |
1237
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
75 lineTool: null, // open layers interaction object (Draw) |
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
76 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
|
77 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
|
78 isolinesLegendImgDataURL: "", |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
79 layers: [ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
80 { |
2140
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
81 name: LAYERS.OPENSTREETMAP, |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
82 data: new TileLayer({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
83 source: new OSM() |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
84 }), |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
85 isVisible: true, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
86 showInLegend: true |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
87 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
88 { |
2140
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
89 name: LAYERS.INLANDECDIS, |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
90 data: new TileLayer({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
91 source: new TileWMS({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
92 preload: 1, |
1648
53f49b109f0c
client: improve ECDIS WMS map loading
Bernhard Reiter <bernhard@intevation.de>
parents:
1645
diff
changeset
|
93 url: "https://service.d4d-portal.info/wms/", |
1874
bad32adafef2
client: add real pdf generation with jspdf
Bernhard Reiter <bernhard@intevation.de>
parents:
1643
diff
changeset
|
94 crossOrigin: "anonymous", |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
95 params: { LAYERS: "d4d", VERSION: "1.1.1", TILED: true } |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
96 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
97 }), |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
98 isVisible: true, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
99 showInLegend: true |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
100 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
101 { |
2140
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
102 name: LAYERS.WATERWAYAREA, |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
103 data: new VectorLayer({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
104 source: new VectorSource({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
105 strategy: bboxStrategy |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
106 }), |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
107 style: new Style({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
108 stroke: new Stroke({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
109 color: "rgba(0, 102, 0, 1)", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
110 width: 2 |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
111 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
112 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
113 }), |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
114 isVisible: true, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
115 showInLegend: true |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
116 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
117 { |
2140
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
118 name: LAYERS.STRETCHES, |
1943
52a6e63d5dcc
Added stretches layer, removed WW-Area named.
Sascha Wilde <wilde@intevation.de>
parents:
1927
diff
changeset
|
119 data: new VectorLayer({ |
52a6e63d5dcc
Added stretches layer, removed WW-Area named.
Sascha Wilde <wilde@intevation.de>
parents:
1927
diff
changeset
|
120 source: new VectorSource({ |
52a6e63d5dcc
Added stretches layer, removed WW-Area named.
Sascha Wilde <wilde@intevation.de>
parents:
1927
diff
changeset
|
121 strategy: bboxStrategy |
52a6e63d5dcc
Added stretches layer, removed WW-Area named.
Sascha Wilde <wilde@intevation.de>
parents:
1927
diff
changeset
|
122 }), |
52a6e63d5dcc
Added stretches layer, removed WW-Area named.
Sascha Wilde <wilde@intevation.de>
parents:
1927
diff
changeset
|
123 style: new Style({ |
52a6e63d5dcc
Added stretches layer, removed WW-Area named.
Sascha Wilde <wilde@intevation.de>
parents:
1927
diff
changeset
|
124 stroke: new Stroke({ |
52a6e63d5dcc
Added stretches layer, removed WW-Area named.
Sascha Wilde <wilde@intevation.de>
parents:
1927
diff
changeset
|
125 color: "rgba(250, 200, 0, .8)", |
52a6e63d5dcc
Added stretches layer, removed WW-Area named.
Sascha Wilde <wilde@intevation.de>
parents:
1927
diff
changeset
|
126 width: 2 |
52a6e63d5dcc
Added stretches layer, removed WW-Area named.
Sascha Wilde <wilde@intevation.de>
parents:
1927
diff
changeset
|
127 }), |
52a6e63d5dcc
Added stretches layer, removed WW-Area named.
Sascha Wilde <wilde@intevation.de>
parents:
1927
diff
changeset
|
128 fill: new Fill({ |
52a6e63d5dcc
Added stretches layer, removed WW-Area named.
Sascha Wilde <wilde@intevation.de>
parents:
1927
diff
changeset
|
129 color: "rgba(250, 200, 10, .3)" |
52a6e63d5dcc
Added stretches layer, removed WW-Area named.
Sascha Wilde <wilde@intevation.de>
parents:
1927
diff
changeset
|
130 }) |
52a6e63d5dcc
Added stretches layer, removed WW-Area named.
Sascha Wilde <wilde@intevation.de>
parents:
1927
diff
changeset
|
131 }) |
52a6e63d5dcc
Added stretches layer, removed WW-Area named.
Sascha Wilde <wilde@intevation.de>
parents:
1927
diff
changeset
|
132 }), |
52a6e63d5dcc
Added stretches layer, removed WW-Area named.
Sascha Wilde <wilde@intevation.de>
parents:
1927
diff
changeset
|
133 isVisible: false, |
52a6e63d5dcc
Added stretches layer, removed WW-Area named.
Sascha Wilde <wilde@intevation.de>
parents:
1927
diff
changeset
|
134 showInLegend: true |
52a6e63d5dcc
Added stretches layer, removed WW-Area named.
Sascha Wilde <wilde@intevation.de>
parents:
1927
diff
changeset
|
135 }, |
52a6e63d5dcc
Added stretches layer, removed WW-Area named.
Sascha Wilde <wilde@intevation.de>
parents:
1927
diff
changeset
|
136 { |
2250
23c03e2eaf4f
client: make different LOS visually distinct
Bernhard Reiter <bernhard@intevation.de>
parents:
2237
diff
changeset
|
137 name: LAYERS.FAIRWAYDIMENSIONSLOS3, |
1944
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
138 data: new VectorLayer({ |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
139 source: new VectorSource(), |
2125
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
140 style: function() { |
1944
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
141 return [ |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
142 new Style({ |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
143 stroke: new Stroke({ |
2250
23c03e2eaf4f
client: make different LOS visually distinct
Bernhard Reiter <bernhard@intevation.de>
parents:
2237
diff
changeset
|
144 color: "rgba(0, 0, 255, 1.0)", |
2263
7efa29d16e77
client: make different LOS layer visually more distinct
Bernhard Reiter <bernhard@intevation.de>
parents:
2250
diff
changeset
|
145 width: 2 |
2313
ba4dfff74d3f
client: improve styles for LOS layers
Bernhard Reiter <bernhard@intevation.de>
parents:
2309
diff
changeset
|
146 }), |
ba4dfff74d3f
client: improve styles for LOS layers
Bernhard Reiter <bernhard@intevation.de>
parents:
2309
diff
changeset
|
147 fill: new Fill({ |
ba4dfff74d3f
client: improve styles for LOS layers
Bernhard Reiter <bernhard@intevation.de>
parents:
2309
diff
changeset
|
148 color: "rgba(255, 255, 255, 0.4)" |
1944
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
149 }) |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
150 }), |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
151 new Style({ |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
152 text: new Text({ |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
153 font: 'bold 12px "Open Sans", "sans-serif"', |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
154 placement: "line", |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
155 fill: new Fill({ |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
156 color: "black" |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
157 }), |
2250
23c03e2eaf4f
client: make different LOS visually distinct
Bernhard Reiter <bernhard@intevation.de>
parents:
2237
diff
changeset
|
158 text: "LOS: 3" |
2125
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
159 //, zIndex: 10 |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
160 }) |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
161 }) |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
162 ]; |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
163 } |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
164 }), |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
165 isVisible: true, |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
166 showInLegend: true |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
167 }, |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
168 { |
2140
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
169 name: LAYERS.FAIRWAYDIMENSIONSLOS2, |
2125
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
170 data: new VectorLayer({ |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
171 source: new VectorSource(), |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
172 style: function() { |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
173 return [ |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
174 new Style({ |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
175 stroke: new Stroke({ |
2263
7efa29d16e77
client: make different LOS layer visually more distinct
Bernhard Reiter <bernhard@intevation.de>
parents:
2250
diff
changeset
|
176 color: "rgba(0, 0, 255, 0.9)", |
2309
77adbdd24d52
client: fix drawing perormance
Bernhard Reiter <bernhard@intevation.de>
parents:
2273
diff
changeset
|
177 lineDash: [3, 6], |
2263
7efa29d16e77
client: make different LOS layer visually more distinct
Bernhard Reiter <bernhard@intevation.de>
parents:
2250
diff
changeset
|
178 lineCap: "round", |
2125
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
179 width: 2 |
2313
ba4dfff74d3f
client: improve styles for LOS layers
Bernhard Reiter <bernhard@intevation.de>
parents:
2309
diff
changeset
|
180 }), |
ba4dfff74d3f
client: improve styles for LOS layers
Bernhard Reiter <bernhard@intevation.de>
parents:
2309
diff
changeset
|
181 fill: new Fill({ |
ba4dfff74d3f
client: improve styles for LOS layers
Bernhard Reiter <bernhard@intevation.de>
parents:
2309
diff
changeset
|
182 color: "rgba(240, 230, 0, 0.1)" |
2125
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
183 }) |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
184 }), |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
185 new Style({ |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
186 text: new Text({ |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
187 font: 'bold 12px "Open Sans", "sans-serif"', |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
188 placement: "line", |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
189 fill: new Fill({ |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
190 color: "black" |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
191 }), |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
192 text: "LOS: 2" |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
193 //, zIndex: 10 |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
194 }) |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
195 }) |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
196 ]; |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
197 } |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
198 }), |
2263
7efa29d16e77
client: make different LOS layer visually more distinct
Bernhard Reiter <bernhard@intevation.de>
parents:
2250
diff
changeset
|
199 isVisible: false, |
2125
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
200 showInLegend: true |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
201 }, |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
202 { |
2250
23c03e2eaf4f
client: make different LOS visually distinct
Bernhard Reiter <bernhard@intevation.de>
parents:
2237
diff
changeset
|
203 name: LAYERS.FAIRWAYDIMENSIONSLOS1, |
2125
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
204 data: new VectorLayer({ |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
205 source: new VectorSource(), |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
206 style: function() { |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
207 return [ |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
208 new Style({ |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
209 stroke: new Stroke({ |
2263
7efa29d16e77
client: make different LOS layer visually more distinct
Bernhard Reiter <bernhard@intevation.de>
parents:
2250
diff
changeset
|
210 color: "rgba(0, 0, 255, 0.8)", |
2309
77adbdd24d52
client: fix drawing perormance
Bernhard Reiter <bernhard@intevation.de>
parents:
2273
diff
changeset
|
211 lineDash: [2, 4], |
2263
7efa29d16e77
client: make different LOS layer visually more distinct
Bernhard Reiter <bernhard@intevation.de>
parents:
2250
diff
changeset
|
212 lineCap: "round", |
7efa29d16e77
client: make different LOS layer visually more distinct
Bernhard Reiter <bernhard@intevation.de>
parents:
2250
diff
changeset
|
213 width: 2 |
2313
ba4dfff74d3f
client: improve styles for LOS layers
Bernhard Reiter <bernhard@intevation.de>
parents:
2309
diff
changeset
|
214 }), |
ba4dfff74d3f
client: improve styles for LOS layers
Bernhard Reiter <bernhard@intevation.de>
parents:
2309
diff
changeset
|
215 fill: new Fill({ |
ba4dfff74d3f
client: improve styles for LOS layers
Bernhard Reiter <bernhard@intevation.de>
parents:
2309
diff
changeset
|
216 color: "rgba(240, 230, 0, 0.2)" |
2125
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
217 }) |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
218 }), |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
219 new Style({ |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
220 text: new Text({ |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
221 font: 'bold 12px "Open Sans", "sans-serif"', |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
222 placement: "line", |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
223 fill: new Fill({ |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
224 color: "black" |
ea5a0e771b71
Distinct fairway layers per LOS
Markus Kottlaender <markus@intevation.de>
parents:
2108
diff
changeset
|
225 }), |
2250
23c03e2eaf4f
client: make different LOS visually distinct
Bernhard Reiter <bernhard@intevation.de>
parents:
2237
diff
changeset
|
226 text: "LOS: 1" |
1944
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
227 //, zIndex: 10 |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
228 }) |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
229 }) |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
230 ]; |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
231 } |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
232 }), |
2263
7efa29d16e77
client: make different LOS layer visually more distinct
Bernhard Reiter <bernhard@intevation.de>
parents:
2250
diff
changeset
|
233 isVisible: false, |
1944
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
234 showInLegend: true |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
235 }, |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
236 { |
2140
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
237 name: LAYERS.WATERWAYAXIS, |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
238 data: new VectorLayer({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
239 source: new VectorSource({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
240 strategy: bboxStrategy |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
241 }), |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
242 style: new Style({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
243 stroke: new Stroke({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
244 color: "rgba(0, 0, 255, .5)", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
245 lineDash: [5, 5], |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
246 width: 2 |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
247 }) |
2237
a78f19ff7cde
LAYERS.WATERWAYAXIS: Set max- and minResolution. Modelled after d4d.
Bjoern Schilberg <bjoern@intevation.de>
parents:
2235
diff
changeset
|
248 }), |
a78f19ff7cde
LAYERS.WATERWAYAXIS: Set max- and minResolution. Modelled after d4d.
Bjoern Schilberg <bjoern@intevation.de>
parents:
2235
diff
changeset
|
249 // TODO: Set layer in layertree active/inactive depending on |
a78f19ff7cde
LAYERS.WATERWAYAXIS: Set max- and minResolution. Modelled after d4d.
Bjoern Schilberg <bjoern@intevation.de>
parents:
2235
diff
changeset
|
250 // resolution. |
a78f19ff7cde
LAYERS.WATERWAYAXIS: Set max- and minResolution. Modelled after d4d.
Bjoern Schilberg <bjoern@intevation.de>
parents:
2235
diff
changeset
|
251 maxResolution: 5, |
a78f19ff7cde
LAYERS.WATERWAYAXIS: Set max- and minResolution. Modelled after d4d.
Bjoern Schilberg <bjoern@intevation.de>
parents:
2235
diff
changeset
|
252 minResolution: 0 |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
253 }), |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
254 isVisible: true, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
255 showInLegend: true |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
256 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
257 { |
2157
8be0fbac2297
Added layer for waterway profiles.
Sascha Wilde <wilde@intevation.de>
parents:
2140
diff
changeset
|
258 name: LAYERS.WATERWAYPROFILES, |
8be0fbac2297
Added layer for waterway profiles.
Sascha Wilde <wilde@intevation.de>
parents:
2140
diff
changeset
|
259 data: new VectorLayer({ |
8be0fbac2297
Added layer for waterway profiles.
Sascha Wilde <wilde@intevation.de>
parents:
2140
diff
changeset
|
260 source: new VectorSource({ |
8be0fbac2297
Added layer for waterway profiles.
Sascha Wilde <wilde@intevation.de>
parents:
2140
diff
changeset
|
261 strategy: bboxStrategy |
8be0fbac2297
Added layer for waterway profiles.
Sascha Wilde <wilde@intevation.de>
parents:
2140
diff
changeset
|
262 }), |
8be0fbac2297
Added layer for waterway profiles.
Sascha Wilde <wilde@intevation.de>
parents:
2140
diff
changeset
|
263 style: new Style({ |
8be0fbac2297
Added layer for waterway profiles.
Sascha Wilde <wilde@intevation.de>
parents:
2140
diff
changeset
|
264 stroke: new Stroke({ |
8be0fbac2297
Added layer for waterway profiles.
Sascha Wilde <wilde@intevation.de>
parents:
2140
diff
changeset
|
265 color: "rgba(0, 0, 255, .5)", |
8be0fbac2297
Added layer for waterway profiles.
Sascha Wilde <wilde@intevation.de>
parents:
2140
diff
changeset
|
266 lineDash: [5, 5], |
8be0fbac2297
Added layer for waterway profiles.
Sascha Wilde <wilde@intevation.de>
parents:
2140
diff
changeset
|
267 width: 2 |
8be0fbac2297
Added layer for waterway profiles.
Sascha Wilde <wilde@intevation.de>
parents:
2140
diff
changeset
|
268 }) |
2235
39586a34979c
LAYERS.WATERWAYPROFILES: Set max- and minResolution. Modelled after d4d.
Bjoern Schilberg <bjoern@intevation.de>
parents:
2224
diff
changeset
|
269 }), |
39586a34979c
LAYERS.WATERWAYPROFILES: Set max- and minResolution. Modelled after d4d.
Bjoern Schilberg <bjoern@intevation.de>
parents:
2224
diff
changeset
|
270 maxResolution: 2.5, |
39586a34979c
LAYERS.WATERWAYPROFILES: Set max- and minResolution. Modelled after d4d.
Bjoern Schilberg <bjoern@intevation.de>
parents:
2224
diff
changeset
|
271 minResolution: 0 |
2157
8be0fbac2297
Added layer for waterway profiles.
Sascha Wilde <wilde@intevation.de>
parents:
2140
diff
changeset
|
272 }), |
8be0fbac2297
Added layer for waterway profiles.
Sascha Wilde <wilde@intevation.de>
parents:
2140
diff
changeset
|
273 isVisible: true, |
8be0fbac2297
Added layer for waterway profiles.
Sascha Wilde <wilde@intevation.de>
parents:
2140
diff
changeset
|
274 showInLegend: true |
8be0fbac2297
Added layer for waterway profiles.
Sascha Wilde <wilde@intevation.de>
parents:
2140
diff
changeset
|
275 }, |
8be0fbac2297
Added layer for waterway profiles.
Sascha Wilde <wilde@intevation.de>
parents:
2140
diff
changeset
|
276 { |
2140
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
277 name: LAYERS.BOTTLENECKS, |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
278 data: new VectorLayer({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
279 source: new VectorSource({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
280 strategy: bboxStrategy |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
281 }), |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
282 style: new Style({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
283 stroke: new Stroke({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
284 color: "rgba(230, 230, 10, .8)", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
285 width: 4 |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
286 }), |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
287 fill: new Fill({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
288 color: "rgba(230, 230, 10, .3)" |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
289 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
290 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
291 }), |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
292 isVisible: true, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
293 showInLegend: true |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
294 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
295 { |
2140
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
296 name: LAYERS.BOTTLENECKISOLINE, |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
297 data: new TileLayer({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
298 source: new TileWMS({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
299 preload: 0, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
300 projection: "EPSG:3857", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
301 url: window.location.origin + "/api/internal/wms", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
302 params: { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
303 LAYERS: "sounding_results_contour_lines_geoserver", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
304 VERSION: "1.1.1", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
305 TILED: true |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
306 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
307 tileLoadFunction: function(tile, src) { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
308 // console.log("calling for", tile, src); |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
309 HTTP.get(src, { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
310 headers: { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
311 "X-Gemma-Auth": localStorage.getItem("token") |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
312 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
313 responseType: "blob" |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
314 }).then(response => { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
315 tile.getImage().src = URL.createObjectURL(response.data); |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
316 }); |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
317 } // TODO tile.setState(TileState.ERROR); |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
318 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
319 }), |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
320 isVisible: false, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
321 showInLegend: true |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
322 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
323 { |
2140
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
324 name: LAYERS.DISTANCEMARKS, |
1944
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
325 forLegendStyle: { point: true, resolution: 8 }, |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
326 data: new VectorLayer({ |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
327 source: new VectorSource({ |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
328 strategy: bboxStrategy |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
329 }) |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
330 }), |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
331 isVisible: false, |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
332 showInLegend: true |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
333 }, |
ef1184654839
Order layers a bit less arbitrary.
Sascha Wilde <wilde@intevation.de>
parents:
1943
diff
changeset
|
334 { |
2140
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
335 name: LAYERS.DISTANCEMARKSAXIS, |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
336 forLegendStyle: { point: true, resolution: 8 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
337 data: new VectorLayer({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
338 source: new VectorSource({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
339 strategy: bboxStrategy |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
340 }), |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
341 style: function(feature, resolution) { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
342 if (resolution < 10) { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
343 var s = new Style({ |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
344 image: new Circle({ |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
345 radius: 5, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
346 fill: new Fill({ color: "rgba(255, 0, 0, 0.1)" }), |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
347 stroke: new Stroke({ color: "blue", width: 1 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
348 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
349 }); |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
350 if (resolution < 6) { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
351 s.setText( |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
352 new Text({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
353 offsetY: 12, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
354 font: '10px "Open Sans", "sans-serif"', |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
355 fill: new Fill({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
356 color: "black" |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
357 }), |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
358 text: (feature.get("hectometre") / 10).toString() |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
359 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
360 ); |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
361 } |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
362 return s; |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
363 } else { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
364 return []; |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
365 } |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
366 } |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
367 }), |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
368 isVisible: true, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
369 showInLegend: true |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
370 }, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
371 { |
2140
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
372 name: LAYERS.DRAWTOOL, |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
373 data: new VectorLayer({ |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
374 source: new VectorSource({ wrapX: false }), |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
375 style: function(feature) { |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
376 // adapted from OpenLayer's LineString Arrow Example |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
377 var geometry = feature.getGeometry(); |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
378 var styles = [ |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
379 // linestring |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
380 new Style({ |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
381 stroke: new Stroke({ |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
382 color: "#369aca", |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
383 width: 2 |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
384 }) |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
385 }) |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
386 ]; |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
387 |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
388 if (geometry.getType() === "LineString") { |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
389 geometry.forEachSegment(function(start, end) { |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
390 var dx = end[0] - start[0]; |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
391 var dy = end[1] - start[1]; |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
392 var rotation = Math.atan2(dy, dx); |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
393 // arrows |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
394 styles.push( |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
395 new Style({ |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
396 geometry: new Point(end), |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
397 image: new Icon({ |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
398 // we need to make sure the image is loaded by Vue Loader |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
1247
diff
changeset
|
399 src: require("../assets/linestring_arrow.png"), |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
400 // fiddling with the anchor's y value does not help to |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
401 // position the image more centered on the line ending, as the |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
402 // default line style seems to be slightly uncentered in the |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
403 // anti-aliasing, but the image is not placed with subpixel |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
404 // precision |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
405 anchor: [0.75, 0.5], |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
406 rotateWithView: true, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
407 rotation: -rotation |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
408 }) |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
409 }) |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
410 ); |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
411 }); |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
412 } |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
413 return styles; |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
414 } |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
415 }), |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
416 isVisible: true, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
417 showInLegend: false |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
418 }, |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
419 { |
2140
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
420 name: LAYERS.CUTTOOL, |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
421 data: new VectorLayer({ |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
422 source: new VectorSource({ wrapX: false }), |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
423 style: function(feature) { |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
424 // adapted from OpenLayer's LineString Arrow Example |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
425 var geometry = feature.getGeometry(); |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
426 var styles = [ |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
427 // linestring |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
428 new Style({ |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
429 stroke: new Stroke({ |
1197
49740dcba52c
changed cut tool style
Markus Kottlaender <markus@intevation.de>
parents:
1158
diff
changeset
|
430 color: "#333333", |
49740dcba52c
changed cut tool style
Markus Kottlaender <markus@intevation.de>
parents:
1158
diff
changeset
|
431 width: 2, |
49740dcba52c
changed cut tool style
Markus Kottlaender <markus@intevation.de>
parents:
1158
diff
changeset
|
432 lineDash: [7, 7] |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
433 }) |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
434 }) |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
435 ]; |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
436 |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
437 if (geometry.getType() === "LineString") { |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
438 geometry.forEachSegment(function(start, end) { |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
439 var dx = end[0] - start[0]; |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
440 var dy = end[1] - start[1]; |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
441 var rotation = Math.atan2(dy, dx); |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
442 // arrows |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
443 styles.push( |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
444 new Style({ |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
445 geometry: new Point(end), |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
446 image: new Icon({ |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
447 // we need to make sure the image is loaded by Vue Loader |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
1247
diff
changeset
|
448 src: require("../assets/linestring_arrow_grey.png"), |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
449 // fiddling with the anchor's y value does not help to |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
450 // position the image more centered on the line ending, as the |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
451 // default line style seems to be slightly uncentered in the |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
452 // anti-aliasing, but the image is not placed with subpixel |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
453 // precision |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
454 anchor: [0.75, 0.5], |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
455 rotateWithView: true, |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
456 rotation: -rotation |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
457 }) |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
458 }) |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
459 ); |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
460 }); |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
461 } |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
462 return styles; |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
463 } |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
464 }), |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
465 isVisible: true, |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
466 showInLegend: false |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
467 } |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
468 ] |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
469 }; |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
470 }; |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
471 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
472 export default { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
473 init, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
474 namespaced: true, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
475 state: init(), |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
476 getters: { |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
477 layersForLegend: state => { |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
478 return state.layers.filter(layer => layer.showInLegend); |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
479 }, |
754
105c421f99b1
refac: small improvements to code structure
Thomas Junk <thomas.junk@intevation.de>
parents:
747
diff
changeset
|
480 getLayerByName: state => name => { |
105c421f99b1
refac: small improvements to code structure
Thomas Junk <thomas.junk@intevation.de>
parents:
747
diff
changeset
|
481 return state.layers.find(layer => layer.name === name); |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
482 }, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
483 getVSourceByName: (state, getters) => name => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
484 return getters.getLayerByName(name).data.getSource(); |
2370
7fe2f5d334dc
client: improved identify tool readability
Markus Kottlaender <markus@intevation.de>
parents:
2314
diff
changeset
|
485 }, |
7fe2f5d334dc
client: improved identify tool readability
Markus Kottlaender <markus@intevation.de>
parents:
2314
diff
changeset
|
486 filteredIdentifiedFeatures: state => { |
7fe2f5d334dc
client: improved identify tool readability
Markus Kottlaender <markus@intevation.de>
parents:
2314
diff
changeset
|
487 return state.identifiedFeatures.filter(f => f.getId()); |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
488 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
489 }, |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
490 mutations: { |
2310
92b21df288e2
client: use user specific extent only on initial load
Markus Kottlaender <markus@intevation.de>
parents:
2309
diff
changeset
|
491 initialLoad: (state, initialLoad) => { |
92b21df288e2
client: use user specific extent only on initial load
Markus Kottlaender <markus@intevation.de>
parents:
2309
diff
changeset
|
492 state.initialLoad = initialLoad; |
92b21df288e2
client: use user specific extent only on initial load
Markus Kottlaender <markus@intevation.de>
parents:
2309
diff
changeset
|
493 }, |
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
|
494 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
|
495 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
|
496 }, |
2140
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
497 setLayerVisible: (state, name) => { |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
498 const layer = state.layers.findIndex(l => l.name === name); |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
499 state.layers[layer].isVisible = true; |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
500 state.layers[layer].data.setVisible(true); |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
501 }, |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
502 setLayerInvisible: (state, name) => { |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
503 const layer = state.layers.findIndex(l => l.name === name); |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
504 state.layers[layer].isVisible = false; |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
505 state.layers[layer].data.setVisible(false); |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
506 }, |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
507 toggleVisibilityByName: (state, name) => { |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
508 const layer = state.layers.findIndex(l => l.name === name); |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
509 state.layers[layer].isVisible = !state.layers[layer].isVisible; |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
510 state.layers[layer].data.setVisible(state.layers[layer].isVisible); |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
511 }, |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
512 toggleVisibility: (state, layer) => { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
513 state.layers[layer].isVisible = !state.layers[layer].isVisible; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
514 state.layers[layer].data.setVisible(state.layers[layer].isVisible); |
770
c12ec7fde3f2
client: add simple identify top area box
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
515 }, |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
516 openLayersMap: (state, map) => { |
783
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
782
diff
changeset
|
517 state.openLayersMap = map; |
1112
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
518 }, |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
519 identifyTool: (state, events) => { |
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
520 state.identifyTool = events; |
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
521 }, |
1112
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
522 setIdentifiedFeatures: (state, identifiedFeatures) => { |
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
523 state.identifiedFeatures = identifiedFeatures; |
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
524 }, |
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
525 setCurrentMeasurement: (state, measurement) => { |
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
526 state.currentMeasurement = measurement; |
1115
1b160eda22cf
moved drawMode to map store
Markus Kottlaender <markus@intevation.de>
parents:
1114
diff
changeset
|
527 }, |
1237
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
528 lineTool: (state, lineTool) => { |
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
529 state.lineTool = lineTool; |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
530 }, |
1237
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
531 polygonTool: (state, polygonTool) => { |
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
532 state.polygonTool = polygonTool; |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
533 }, |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
534 cutTool: (state, cutTool) => { |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
535 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
|
536 }, |
2186
d0498088894f
map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents:
2166
diff
changeset
|
537 moveToBoundingBox: (state, { boundingBox, zoom, preventZoomOut }) => { |
d0498088894f
map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents:
2166
diff
changeset
|
538 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
|
539 let view = state.openLayersMap.getView(); |
d0498088894f
map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents:
2166
diff
changeset
|
540 moveMap({ view, extent, zoom, preventZoomOut }); |
d0498088894f
map_store: extracted moveMap, etd moveToBoundingBox, refactored moveToExtent
Thomas Junk <thomas.junk@intevation.de>
parents:
2166
diff
changeset
|
541 }, |
2132
7a2eedc182f7
staging: zoomable stretches. zoomToExtent etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2125
diff
changeset
|
542 moveToExtent: (state, { feature, zoom, preventZoomOut }) => { |
7a2eedc182f7
staging: zoomable stretches. zoomToExtent etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2125
diff
changeset
|
543 const boundingBox = bbox(feature.geometry); |
7a2eedc182f7
staging: zoomable stretches. zoomToExtent etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2125
diff
changeset
|
544 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
|
545 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
|
546 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
|
547 }, |
1158
da75faa8043f
added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
548 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
|
549 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
|
550 const currentZoom = view.getZoom(); |
da75faa8043f
added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
551 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
|
552 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
|
553 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
|
554 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
|
555 }); |
1927
5a37ee321651
client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents:
1879
diff
changeset
|
556 }, |
5a37ee321651
client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents:
1879
diff
changeset
|
557 isolinesLegendImgDataURL: (state, isolinesLegendImgDataURL) => { |
5a37ee321651
client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents:
1879
diff
changeset
|
558 state.isolinesLegendImgDataURL = isolinesLegendImgDataURL; |
1144 | 559 } |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
560 }, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
561 actions: { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
562 openLayersMap({ commit, dispatch, getters }, map) { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
563 const drawVectorSrc = getters.getVSourceByName("Draw Tool"); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
564 const cutVectorSrc = getters.getVSourceByName("Cut Tool"); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
565 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
566 // init line tool |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
567 const lineTool = new Draw({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
568 source: drawVectorSrc, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
569 type: "LineString", |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
570 maxPoints: 2 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
571 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
572 lineTool.setActive(false); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
573 lineTool.on("drawstart", () => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
574 drawVectorSrc.clear(); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
575 commit("setCurrentMeasurement", null); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
576 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
577 lineTool.on("drawend", event => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
578 commit("setCurrentMeasurement", { |
1524
a0a16577261a
Translation: mark some strings for translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1438
diff
changeset
|
579 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
|
580 unitSymbol: "m", |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
581 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
|
582 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
583 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
|
584 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
585 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
586 // init polygon tool |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
587 const polygonTool = new Draw({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
588 source: drawVectorSrc, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
589 type: "Polygon", |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
590 maxPoints: 50 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
591 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
592 polygonTool.setActive(false); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
593 polygonTool.on("drawstart", () => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
594 drawVectorSrc.clear(); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
595 commit("setCurrentMeasurement", null); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
596 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
597 polygonTool.on("drawend", event => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
598 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
|
599 commit("setCurrentMeasurement", { |
1524
a0a16577261a
Translation: mark some strings for translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1438
diff
changeset
|
600 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
|
601 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
|
602 value: |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
603 areaSize > 100000 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
604 ? 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
|
605 : Math.round(areaSize) |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
606 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
607 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
|
608 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
609 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
610 // init cut tool |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
611 const cutTool = new Draw({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
612 source: cutVectorSrc, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
613 type: "LineString", |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
614 maxPoints: 2, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
615 style: new Style({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
616 stroke: new Stroke({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
617 color: "#444", |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
618 width: 2, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
619 lineDash: [7, 7] |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
620 }), |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
621 image: new Circle({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
622 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
|
623 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
|
624 radius: 6 |
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 }) |
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 cutTool.setActive(false); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
629 cutTool.on("drawstart", () => { |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
630 dispatch("disableIdentifyTool"); |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
631 cutVectorSrc.clear(); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
632 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
633 cutTool.on("drawend", event => { |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1363
diff
changeset
|
634 commit("fairwayprofile/selectedCut", null, { root: true }); |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
635 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
|
636 // 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
|
637 // 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
|
638 // 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
|
639 setTimeout(() => dispatch("enableIdentifyTool"), 1000) |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
640 ); |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
641 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
642 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
643 map.addInteraction(lineTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
644 map.addInteraction(cutTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
645 map.addInteraction(polygonTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
646 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
647 commit("lineTool", lineTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
648 commit("polygonTool", polygonTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
649 commit("cutTool", cutTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
650 commit("openLayersMap", map); |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
651 }, |
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
652 disableIdentifyTool({ state }) { |
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
653 unByKey(state.identifyTool); |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
654 state.identifyTool = null; |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
655 }, |
1438
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
656 enableIdentifyTool({ state, rootState, commit, dispatch, getters }) { |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
657 if (!state.identifyTool) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
658 state.identifyTool = state.openLayersMap.on( |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
659 ["singleclick", "dblclick"], |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
660 event => { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
661 commit("setIdentifiedFeatures", []); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
662 // checking our WFS layers |
2166
69c49301d689
map.js: GetFeaturesAtPixel added hitTolerance:7.
Bjoern Schilberg <bjoern@intevation.de>
parents:
2157
diff
changeset
|
663 var features = state.openLayersMap.getFeaturesAtPixel(event.pixel, { |
69c49301d689
map.js: GetFeaturesAtPixel added hitTolerance:7.
Bjoern Schilberg <bjoern@intevation.de>
parents:
2157
diff
changeset
|
664 hitTolerance: 7 |
69c49301d689
map.js: GetFeaturesAtPixel added hitTolerance:7.
Bjoern Schilberg <bjoern@intevation.de>
parents:
2157
diff
changeset
|
665 }); |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
666 if (features) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
667 commit("setIdentifiedFeatures", features); |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
668 |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
669 // get selected bottleneck from identified features |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
670 for (let feature of features) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
671 let id = feature.getId(); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
672 // 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
|
673 if (/^bottlenecks/.test(id)) { |
1438
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
674 if ( |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
675 rootState.bottlenecks.selectedBottleneck != |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
676 feature.get("objnam") |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
677 ) { |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
678 dispatch( |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
679 "bottlenecks/setSelectedBottleneck", |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
680 feature.get("objnam"), |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
681 { root: true } |
1565
faa045ebdf0c
select first surveydate after identification of bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents:
1524
diff
changeset
|
682 ).then(() => { |
faa045ebdf0c
select first surveydate after identification of bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents:
1524
diff
changeset
|
683 this.commit("bottlenecks/setFirstSurveySelected"); |
faa045ebdf0c
select first surveydate after identification of bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents:
1524
diff
changeset
|
684 }); |
1438
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
685 commit("moveMap", { |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
686 coordinates: getCenter( |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
687 feature |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
688 .getGeometry() |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
689 .clone() |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
690 .transform("EPSG:3857", "EPSG:4326") |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
691 .getExtent() |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
692 ), |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
693 zoom: 17, |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
694 preventZoomOut: true |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
695 }); |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
696 } |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
697 } |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
698 } |
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
699 } |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
700 |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
701 // 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
|
702 /* |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
703 for (let feature of features) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
704 console.log("Identified:", feature.getId()); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
705 for (let key of feature.getKeys()) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
706 if (key != feature.getGeometryName()) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
707 console.log(key, feature.get(key)); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
708 } |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
709 } |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
710 } |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
711 */ |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
712 |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
713 // trying the GetFeatureInfo way for WMS |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
714 var wmsSource = getters.getVSourceByName( |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
715 "Inland ECDIS chart Danube" |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
716 ); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
717 var url = wmsSource.getGetFeatureInfoUrl( |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
718 event.coordinate, |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
719 100 /* resolution */, |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
720 "EPSG:3857", |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
721 // { 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
|
722 { INFO_FORMAT: "text/plain" } |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
723 ); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
724 |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
725 if (url) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
726 // cannot directly query here because of SOP |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
727 console.log("GetFeatureInfo url:", url); |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
728 } |
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
729 } |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
730 ); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
731 } |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
732 } |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
733 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
734 }; |
2140
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
735 |
55bedb39295a
feat: clicking on stretches activates according layer
Thomas Junk <thomas.junk@intevation.de>
parents:
2133
diff
changeset
|
736 export { LAYERS }; |