Mercurial > gemma
annotate client/src/store/map.js @ 3054:1ef2f4179d30
client: map store: merged/renamed method(s)
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Tue, 16 Apr 2019 09:00:42 +0200 |
parents | 61e4feb04a35 |
children | 87e0422cffa7 |
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 |
2985
1b8bb4f89227
client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
17 import Draw from "ol/interaction/Draw"; |
3006
44493664d40e
client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents:
2997
diff
changeset
|
18 import { Stroke, Style, Fill, Circle } from "ol/style"; |
1158
da75faa8043f
added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
19 import { fromLonLat } from "ol/proj"; |
2985
1b8bb4f89227
client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
20 import { getLength, getArea } from "ol/sphere"; |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
21 import { getCenter } from "ol/extent"; |
2985
1b8bb4f89227
client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents:
2957
diff
changeset
|
22 import { transformExtent } from "ol/proj"; |
2132
7a2eedc182f7
staging: zoomable stretches. zoomToExtent etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2125
diff
changeset
|
23 import bbox from "@turf/bbox"; |
2947
a6eea3002e6e
client: cleanup import paths
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2932
diff
changeset
|
24 import app from "@/main"; |
3029
81c2e561fe03
Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3006
diff
changeset
|
25 import { HTTP } from "@/lib/http"; |
81c2e561fe03
Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3006
diff
changeset
|
26 import Feature from "ol/Feature"; |
81c2e561fe03
Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3006
diff
changeset
|
27 import Point from "ol/geom/Point"; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
28 |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
29 // initial state |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
30 const init = () => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
31 return { |
3044
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
32 openLayersMaps: [], |
2310
92b21df288e2
client: use user specific extent only on initial load
Markus Kottlaender <markus@intevation.de>
parents:
2309
diff
changeset
|
33 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
|
34 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
|
35 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
|
36 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
|
37 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
|
38 }, |
3051
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
39 identifyToolEnabled: true, // event binding (singleclick, dblclick) |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
40 identifiedFeatures: [], // map features identified by clicking on the map |
1247
c14353e2cdb9
repositioning of buttons (issue225)
Markus Kottlaender <markus@intevation.de>
parents:
1237
diff
changeset
|
41 currentMeasurement: null, // distance or area from line-/polygon-/cutTool |
1237
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
42 lineTool: null, // open layers interaction object (Draw) |
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
43 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
|
44 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
|
45 isolinesLegendImgDataURL: "", |
3006
44493664d40e
client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents:
2997
diff
changeset
|
46 differencesLegendImgDataURL: "" |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
47 }; |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
48 }; |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
49 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
50 export default { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
51 init, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
52 namespaced: true, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
53 state: init(), |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
54 getters: { |
3044
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
55 openLayersMap: state => { |
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
56 return state.openLayersMaps.length ? state.openLayersMaps[0] : null; |
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
57 }, |
2370
7fe2f5d334dc
client: improved identify tool readability
Markus Kottlaender <markus@intevation.de>
parents:
2314
diff
changeset
|
58 filteredIdentifiedFeatures: state => { |
7fe2f5d334dc
client: improved identify tool readability
Markus Kottlaender <markus@intevation.de>
parents:
2314
diff
changeset
|
59 return state.identifiedFeatures.filter(f => f.getId()); |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
60 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
61 }, |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
62 mutations: { |
2310
92b21df288e2
client: use user specific extent only on initial load
Markus Kottlaender <markus@intevation.de>
parents:
2309
diff
changeset
|
63 initialLoad: (state, initialLoad) => { |
92b21df288e2
client: use user specific extent only on initial load
Markus Kottlaender <markus@intevation.de>
parents:
2309
diff
changeset
|
64 state.initialLoad = initialLoad; |
92b21df288e2
client: use user specific extent only on initial load
Markus Kottlaender <markus@intevation.de>
parents:
2309
diff
changeset
|
65 }, |
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
|
66 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
|
67 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
|
68 }, |
3044
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
69 addOpenLayersMap: (state, map) => { |
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
70 state.openLayersMaps.push(map); |
1112
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
71 }, |
3052
01210542e028
client: remove openlayers map objects after removing a map component from the view
Markus Kottlaender <markus@intevation.de>
parents:
3051
diff
changeset
|
72 removeOpenLayersMap: (state, map) => { |
01210542e028
client: remove openlayers map objects after removing a map component from the view
Markus Kottlaender <markus@intevation.de>
parents:
3051
diff
changeset
|
73 let index = state.openLayersMaps.findIndex( |
01210542e028
client: remove openlayers map objects after removing a map component from the view
Markus Kottlaender <markus@intevation.de>
parents:
3051
diff
changeset
|
74 m => m.getTarget() === map.getTarget() |
01210542e028
client: remove openlayers map objects after removing a map component from the view
Markus Kottlaender <markus@intevation.de>
parents:
3051
diff
changeset
|
75 ); |
01210542e028
client: remove openlayers map objects after removing a map component from the view
Markus Kottlaender <markus@intevation.de>
parents:
3051
diff
changeset
|
76 if (index !== -1) { |
01210542e028
client: remove openlayers map objects after removing a map component from the view
Markus Kottlaender <markus@intevation.de>
parents:
3051
diff
changeset
|
77 state.openLayersMaps.splice(index); |
01210542e028
client: remove openlayers map objects after removing a map component from the view
Markus Kottlaender <markus@intevation.de>
parents:
3051
diff
changeset
|
78 } |
01210542e028
client: remove openlayers map objects after removing a map component from the view
Markus Kottlaender <markus@intevation.de>
parents:
3051
diff
changeset
|
79 }, |
3051
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
80 identifyToolEnabled: (state, enabled) => { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
81 state.identifyToolEnabled = enabled; |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
82 }, |
1112
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
83 setIdentifiedFeatures: (state, identifiedFeatures) => { |
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
84 state.identifiedFeatures = identifiedFeatures; |
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
85 }, |
3029
81c2e561fe03
Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3006
diff
changeset
|
86 addIdentifiedFeatures: (state, identifiedFeatures) => { |
3031 | 87 state.identifiedFeatures = state.identifiedFeatures.concat( |
88 identifiedFeatures | |
89 ); | |
3029
81c2e561fe03
Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3006
diff
changeset
|
90 }, |
1112
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
91 setCurrentMeasurement: (state, measurement) => { |
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
92 state.currentMeasurement = measurement; |
1115
1b160eda22cf
moved drawMode to map store
Markus Kottlaender <markus@intevation.de>
parents:
1114
diff
changeset
|
93 }, |
1237
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
94 lineTool: (state, lineTool) => { |
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
95 state.lineTool = lineTool; |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
96 }, |
1237
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
97 polygonTool: (state, polygonTool) => { |
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
98 state.polygonTool = polygonTool; |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
99 }, |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
100 cutTool: (state, cutTool) => { |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
101 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
|
102 }, |
1927
5a37ee321651
client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents:
1879
diff
changeset
|
103 isolinesLegendImgDataURL: (state, isolinesLegendImgDataURL) => { |
5a37ee321651
client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents:
1879
diff
changeset
|
104 state.isolinesLegendImgDataURL = isolinesLegendImgDataURL; |
2932
173ce013a021
layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents:
2910
diff
changeset
|
105 }, |
173ce013a021
layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents:
2910
diff
changeset
|
106 differencesLegendImgDataURL: (state, differencesLegendImgDataURL) => { |
173ce013a021
layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents:
2910
diff
changeset
|
107 state.differencesLegendImgDataURL = differencesLegendImgDataURL; |
1144 | 108 } |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
109 }, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
110 actions: { |
3006
44493664d40e
client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents:
2997
diff
changeset
|
111 openLayersMap({ commit, dispatch }, map) { |
44493664d40e
client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents:
2997
diff
changeset
|
112 const drawVectorSrc = map.getLayer("DRAWTOOL").getSource(); |
44493664d40e
client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents:
2997
diff
changeset
|
113 const cutVectorSrc = map.getLayer("CUTTOOL").getSource(); |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
114 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
115 // init line tool |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
116 const lineTool = new Draw({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
117 source: drawVectorSrc, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
118 type: "LineString", |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
119 maxPoints: 2 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
120 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
121 lineTool.setActive(false); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
122 lineTool.on("drawstart", () => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
123 drawVectorSrc.clear(); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
124 commit("setCurrentMeasurement", null); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
125 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
126 lineTool.on("drawend", event => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
127 commit("setCurrentMeasurement", { |
1524
a0a16577261a
Translation: mark some strings for translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1438
diff
changeset
|
128 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
|
129 unitSymbol: "m", |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
130 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
|
131 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
132 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
|
133 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
134 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
135 // init polygon tool |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
136 const polygonTool = new Draw({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
137 source: drawVectorSrc, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
138 type: "Polygon", |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
139 maxPoints: 50 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
140 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
141 polygonTool.setActive(false); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
142 polygonTool.on("drawstart", () => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
143 drawVectorSrc.clear(); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
144 commit("setCurrentMeasurement", null); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
145 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
146 polygonTool.on("drawend", event => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
147 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
|
148 commit("setCurrentMeasurement", { |
1524
a0a16577261a
Translation: mark some strings for translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1438
diff
changeset
|
149 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
|
150 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
|
151 value: |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
152 areaSize > 100000 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
153 ? 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
|
154 : Math.round(areaSize) |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
155 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
156 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
|
157 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
158 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
159 // init cut tool |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
160 const cutTool = new Draw({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
161 source: cutVectorSrc, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
162 type: "LineString", |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
163 maxPoints: 2, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
164 style: new Style({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
165 stroke: new Stroke({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
166 color: "#444", |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
167 width: 2, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
168 lineDash: [7, 7] |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
169 }), |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
170 image: new Circle({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
171 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
|
172 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
|
173 radius: 6 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
174 }) |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
175 }) |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
176 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
177 cutTool.setActive(false); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
178 cutTool.on("drawstart", () => { |
3051
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
179 commit("identifyToolEnabled", false); |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
180 cutVectorSrc.clear(); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
181 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
182 cutTool.on("drawend", event => { |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1363
diff
changeset
|
183 commit("fairwayprofile/selectedCut", null, { root: true }); |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
184 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
|
185 // 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
|
186 // 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
|
187 // cut will trigger it. We don't want that. |
3051
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
188 setTimeout(() => commit("identifyToolEnabled", true), 1000) |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
189 ); |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
190 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
191 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
192 map.addInteraction(lineTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
193 map.addInteraction(cutTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
194 map.addInteraction(polygonTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
195 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
196 commit("lineTool", lineTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
197 commit("polygonTool", polygonTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
198 commit("cutTool", cutTool); |
3044
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
199 commit("addOpenLayersMap", map); |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
200 }, |
3051
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
201 initIdentifyTool({ state, rootState, commit, dispatch }, map) { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
202 map.on(["singleclick", "dblclick"], event => { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
203 if (!state.identifyToolEnabled) return; |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
204 commit("setIdentifiedFeatures", []); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
205 // checking our WFS layers |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
206 var features = map.getFeaturesAtPixel(event.pixel, { hitTolerance: 7 }); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
207 if (features) { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
208 let identifiedFeatures = []; |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
209 |
3051
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
210 for (let feature of features) { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
211 let id = feature.getId(); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
212 // avoid identifying the same feature twice |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
213 if ( |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
214 identifiedFeatures.findIndex( |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
215 f => f.getId() === feature.getId() |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
216 ) === -1 |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
217 ) { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
218 identifiedFeatures.push(feature); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
219 } |
2510
f2758dafe390
client: identify tool: avoid identifying the same feature twice
Markus Kottlaender <markus@intevation.de>
parents:
2506
diff
changeset
|
220 |
3051
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
221 // get selected bottleneck |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
222 // RegExp.prototype.test() works with number, str and undefined |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
223 if (/^bottlenecks/.test(id)) { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
224 if ( |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
225 rootState.bottlenecks.selectedBottleneck != |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
226 feature.get("objnam") |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
227 ) { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
228 dispatch( |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
229 "bottlenecks/setSelectedBottleneck", |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
230 feature.get("objnam"), |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
231 { root: true } |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
232 ).then(() => { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
233 this.commit("bottlenecks/setFirstSurveySelected"); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
234 }); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
235 dispatch("moveMap", { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
236 coordinates: getCenter( |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
237 feature |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
238 .getGeometry() |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
239 .clone() |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
240 .transform("EPSG:3857", "EPSG:4326") |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
241 .getExtent() |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
242 ), |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
243 zoom: 17, |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
244 preventZoomOut: true |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
245 }); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
246 } |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
247 } |
2590
1686ec185155
client: added gauge waterlevel example diagram
Markus Kottlaender <markus@intevation.de>
parents:
2568
diff
changeset
|
248 |
3051
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
249 // get selected gauge |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
250 if (/^gauges/.test(id)) { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
251 if ( |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
252 rootState.gauges.selectedGaugeISRS !== feature.get("isrs_code") |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
253 ) { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
254 dispatch("gauges/selectedGaugeISRS", feature.get("isrs_code"), { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
255 root: true |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
256 }); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
257 dispatch("moveMap", { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
258 coordinates: getCenter( |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
259 feature |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
260 .getGeometry() |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
261 .clone() |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
262 .transform("EPSG:3857", "EPSG:4326") |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
263 .getExtent() |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
264 ), |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
265 zoom: null, |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
266 preventZoomOut: true |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
267 }); |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
268 } |
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
269 } |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
270 |
3051
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
271 // get selected stretch |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
272 if (/^stretches/.test(id)) { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
273 if (rootState.imports.selectedStretchId === feature.getId()) { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
274 commit("imports/selectedStretchId", null, { root: true }); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
275 } else { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
276 commit("imports/selectedStretchId", feature.getId(), { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
277 root: true |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
278 }); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
279 dispatch("moveMap", { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
280 coordinates: getCenter( |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
281 feature |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
282 .getGeometry() |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
283 .clone() |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
284 .transform("EPSG:3857", "EPSG:4326") |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
285 .getExtent() |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
286 ), |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
287 zoom: null, |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
288 preventZoomOut: true |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
289 }); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
290 } |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
291 } |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
292 } |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
293 |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
294 commit("setIdentifiedFeatures", identifiedFeatures); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
295 } |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
296 |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
297 // DEBUG output and example how to remove the GeometryName |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
298 /* |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
299 for (let feature of features) { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
300 console.log("Identified:", feature.getId()); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
301 for (let key of feature.getKeys()) { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
302 if (key != feature.getGeometryName()) { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
303 console.log(key, feature.get(key)); |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
304 } |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
305 } |
3051
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
306 } |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
307 */ |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
308 |
3051
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
309 var waterwayAxisSource = map.getLayer("WATERWAYAXIS").getSource(); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
310 var waxisUrl = waterwayAxisSource.getGetFeatureInfoUrl( |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
311 event.coordinate, |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
312 100 /* resolution */, |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
313 "EPSG:3857", |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
314 // { INFO_FORMAT: "application/vnd.ogc.gml" } // not allowed by d4d |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
315 { INFO_FORMAT: "application/json" } |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
316 ); |
3047
e0b77d7463e7
Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3044
diff
changeset
|
317 |
3051
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
318 if (waxisUrl) { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
319 // cannot directly query here because of SOP |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
320 HTTP.get(waxisUrl, { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
321 headers: { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
322 "X-Gemma-Auth": localStorage.getItem("token") |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
323 } |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
324 }).then(response => { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
325 let features = response.data.features.map(f => { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
326 let feat = new Feature({ |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
327 geometry: new Point(f.geometry.coordinates) |
3047
e0b77d7463e7
Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3044
diff
changeset
|
328 }); |
3051
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
329 feat.setId(f.id); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
330 feat.setProperties(f.properties); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
331 return feat; |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
332 }); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
333 commit("addIdentifiedFeatures", features); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
334 }); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
335 } |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
336 var waterwayAreaSource = map.getLayer("WATERWAYAREA").getSource(); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
337 var wareaUrl = waterwayAreaSource.getGetFeatureInfoUrl( |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
338 event.coordinate, |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
339 100 /* resolution */, |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
340 "EPSG:3857", |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
341 // { INFO_FORMAT: "application/vnd.ogc.gml" } // not allowed by d4d |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
342 { INFO_FORMAT: "application/json" } |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
343 ); |
3047
e0b77d7463e7
Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3044
diff
changeset
|
344 |
3051
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
345 if (wareaUrl) { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
346 // cannot directly query here because of SOP |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
347 HTTP.get(wareaUrl, { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
348 headers: { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
349 "X-Gemma-Auth": localStorage.getItem("token") |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
350 } |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
351 }).then(response => { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
352 let features = response.data.features.map(f => { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
353 let feat = new Feature({ |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
354 geometry: new Point(f.geometry.coordinates) |
3047
e0b77d7463e7
Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3044
diff
changeset
|
355 }); |
3051
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
356 feat.setId(f.id); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
357 feat.setProperties(f.properties); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
358 return feat; |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
359 }); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
360 commit("addIdentifiedFeatures", features); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
361 }); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
362 } |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
363 var dmaSource = map.getLayer("DISTANCEMARKSAXIS").getSource(); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
364 var dmaUrl = dmaSource.getGetFeatureInfoUrl( |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
365 event.coordinate, |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
366 100 /* resolution */, |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
367 "EPSG:3857", |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
368 // { INFO_FORMAT: "application/vnd.ogc.gml" } // not allowed by d4d |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
369 { INFO_FORMAT: "application/json" } |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
370 ); |
3029
81c2e561fe03
Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3006
diff
changeset
|
371 |
3051
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
372 if (dmaUrl) { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
373 HTTP.get(dmaUrl, { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
374 headers: { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
375 "X-Gemma-Auth": localStorage.getItem("token") |
3029
81c2e561fe03
Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3006
diff
changeset
|
376 } |
3051
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
377 }).then(response => { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
378 let features = response.data.features.map(f => { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
379 let feat = new Feature({ |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
380 geometry: new Point(f.geometry.coordinates) |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
381 }); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
382 feat.setId(f.id); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
383 feat.setProperties(f.properties); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
384 return feat; |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
385 }); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
386 commit("addIdentifiedFeatures", features); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
387 }); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
388 } |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
389 // trying the GetFeatureInfo way for WMS |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
390 var iecdisSource = map.getLayer("INLANDECDIS").getSource(); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
391 var iecdisUrl = iecdisSource.getGetFeatureInfoUrl( |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
392 event.coordinate, |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
393 100 /* resolution */, |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
394 "EPSG:3857", |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
395 // { INFO_FORMAT: "application/vnd.ogc.gml" } // not allowed by d4d |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
396 { INFO_FORMAT: "text/plain" } |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
397 ); |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
398 |
3051
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
399 if (iecdisUrl) { |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
400 // cannot directly query here because of SOP |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
401 console.log("GetFeatureInfo url:", iecdisUrl); |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
402 } |
051a3f446ac2
client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents:
3047
diff
changeset
|
403 }); |
3044
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
404 }, |
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
405 moveToBoundingBox({ getters }, { boundingBox, zoom, preventZoomOut }) { |
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
406 const extent = transformExtent(boundingBox, "EPSG:4326", "EPSG:3857"); |
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
407 let view = getters.openLayersMap.getView(); |
3054
1ef2f4179d30
client: map store: merged/renamed method(s)
Markus Kottlaender <markus@intevation.de>
parents:
3053
diff
changeset
|
408 const currentZoom = view.getZoom(); |
1ef2f4179d30
client: map store: merged/renamed method(s)
Markus Kottlaender <markus@intevation.de>
parents:
3053
diff
changeset
|
409 zoom = zoom || currentZoom; |
1ef2f4179d30
client: map store: merged/renamed method(s)
Markus Kottlaender <markus@intevation.de>
parents:
3053
diff
changeset
|
410 view.fit(extent, { |
1ef2f4179d30
client: map store: merged/renamed method(s)
Markus Kottlaender <markus@intevation.de>
parents:
3053
diff
changeset
|
411 maxZoom: preventZoomOut ? Math.max(zoom, currentZoom) : zoom, |
1ef2f4179d30
client: map store: merged/renamed method(s)
Markus Kottlaender <markus@intevation.de>
parents:
3053
diff
changeset
|
412 duration: 700 |
1ef2f4179d30
client: map store: merged/renamed method(s)
Markus Kottlaender <markus@intevation.de>
parents:
3053
diff
changeset
|
413 }); |
3044
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
414 }, |
3054
1ef2f4179d30
client: map store: merged/renamed method(s)
Markus Kottlaender <markus@intevation.de>
parents:
3053
diff
changeset
|
415 moveToFeauture({ dispatch }, { feature, zoom, preventZoomOut }) { |
3044
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
416 const boundingBox = bbox(feature.geometry); |
3053
61e4feb04a35
client: avoid code duplication
Markus Kottlaender <markus@intevation.de>
parents:
3052
diff
changeset
|
417 dispatch("moveToBoundingBox", { boundingBox, zoom, preventZoomOut }); |
3044
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
418 }, |
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
419 moveMap({ getters }, { coordinates, zoom, preventZoomOut }) { |
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
420 let view = getters.openLayersMap.getView(); |
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
421 const currentZoom = view.getZoom(); |
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
422 zoom = zoom || currentZoom; |
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
423 view.animate({ |
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
424 zoom: preventZoomOut ? Math.max(zoom, currentZoom) : zoom, |
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
425 center: fromLonLat(coordinates, view.getProjection()), |
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
426 duration: 700 |
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3043
diff
changeset
|
427 }); |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
428 } |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
429 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
430 }; |