annotate client/src/store/map.js @ 3261:916d4c898f08

client: import stretches: prevent map/identify popup from opening when selecting a distance mark on the map
author Markus Kottlaender <markus@intevation.de>
date Tue, 14 May 2019 20:08:10 +0200
parents 985bc5009115
children 5746497085b6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1362
ca33ad696594 remove the first empyty lines
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1361
diff changeset
1 /* This is Free Software under GNU Affero General Public License v >= 3.0
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 975
diff changeset
2 * without warranty, see README.md and license for details.
1361
ea3a89a1813a remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1313
diff changeset
3 *
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 975
diff changeset
4 * SPDX-License-Identifier: AGPL-3.0-or-later
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 975
diff changeset
5 * License-Filename: LICENSES/AGPL-3.0.txt
1361
ea3a89a1813a remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1313
diff changeset
6 *
1927
5a37ee321651 client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents: 1879
diff changeset
7 * Copyright (C) 2018, 2019 by via donau
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 975
diff changeset
8 * – Österreichische Wasserstraßen-Gesellschaft mbH
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 975
diff changeset
9 * Software engineering by Intevation GmbH
1361
ea3a89a1813a remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1313
diff changeset
10 *
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 975
diff changeset
11 * Author(s):
1927
5a37ee321651 client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents: 1879
diff changeset
12 * * Bernhard Reiter <bernhard.reiter@intevation.de>
5a37ee321651 client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents: 1879
diff changeset
13 * * Markus Kottländer <markus@intevation.de>
5a37ee321651 client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents: 1879
diff changeset
14 * * Thomas Junk <thomas.junk@intevation.de>
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 975
diff changeset
15 */
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 975
diff changeset
16
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";
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2957
diff changeset
21 import { transformExtent } from "ol/proj";
2132
7a2eedc182f7 staging: zoomable stretches. zoomToExtent etd
Thomas Junk <thomas.junk@intevation.de>
parents: 2125
diff changeset
22 import bbox from "@turf/bbox";
2947
a6eea3002e6e client: cleanup import paths
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2932
diff changeset
23 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
24 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
25 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
26 import Point from "ol/geom/Point";
3204
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
27 import { toLonLat } from "ol/proj";
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: [],
3086
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3081
diff changeset
33 syncedMaps: [],
3063
333aff79197d client: maps: all map's views are now synced
Markus Kottlaender <markus@intevation.de>
parents: 3062
diff changeset
34 syncedView: null,
3204
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
35 mapPopup: null,
3261
916d4c898f08 client: import stretches: prevent map/identify popup from opening when selecting a distance mark on the map
Markus Kottlaender <markus@intevation.de>
parents: 3259
diff changeset
36 mapPopupEnabled: true,
2310
92b21df288e2 client: use user specific extent only on initial load
Markus Kottlaender <markus@intevation.de>
parents: 2309
diff changeset
37 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
38 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
39 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
40 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
41 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
42 },
1140
2e06bc53b002 separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents: 1122
diff changeset
43 identifiedFeatures: [], // map features identified by clicking on the map
3204
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
44 identifiedCoordinates: null,
1247
c14353e2cdb9 repositioning of buttons (issue225)
Markus Kottlaender <markus@intevation.de>
parents: 1237
diff changeset
45 currentMeasurement: null, // distance or area from line-/polygon-/cutTool
3062
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
46 lineToolEnabled: false,
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
47 polygonToolEnabled: false,
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
48 cutToolEnabled: false,
1927
5a37ee321651 client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents: 1879
diff changeset
49 isolinesLegendImgDataURL: "",
3006
44493664d40e client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents: 2997
diff changeset
50 differencesLegendImgDataURL: ""
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
51 };
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
52 };
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
53
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
54 export default {
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
55 init,
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
56 namespaced: true,
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
57 state: init(),
585
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
58 getters: {
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3078
diff changeset
59 openLayersMap: state => id => {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3078
diff changeset
60 return state.openLayersMaps.find(
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3078
diff changeset
61 map => map.getTarget() === "map-" + (id || "main")
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3078
diff changeset
62 );
3044
c71373594719 client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents: 3043
diff changeset
63 },
2370
7fe2f5d334dc client: improved identify tool readability
Markus Kottlaender <markus@intevation.de>
parents: 2314
diff changeset
64 filteredIdentifiedFeatures: state => {
7fe2f5d334dc client: improved identify tool readability
Markus Kottlaender <markus@intevation.de>
parents: 2314
diff changeset
65 return state.identifiedFeatures.filter(f => f.getId());
585
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
66 }
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
67 },
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
68 mutations: {
2310
92b21df288e2 client: use user specific extent only on initial load
Markus Kottlaender <markus@intevation.de>
parents: 2309
diff changeset
69 initialLoad: (state, initialLoad) => {
92b21df288e2 client: use user specific extent only on initial load
Markus Kottlaender <markus@intevation.de>
parents: 2309
diff changeset
70 state.initialLoad = initialLoad;
92b21df288e2 client: use user specific extent only on initial load
Markus Kottlaender <markus@intevation.de>
parents: 2309
diff changeset
71 },
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
72 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
73 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
74 },
3044
c71373594719 client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents: 3043
diff changeset
75 addOpenLayersMap: (state, map) => {
c71373594719 client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents: 3043
diff changeset
76 state.openLayersMaps.push(map);
1112
2c3d32322126 moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents: 1099
diff changeset
77 },
3052
01210542e028 client: remove openlayers map objects after removing a map component from the view
Markus Kottlaender <markus@intevation.de>
parents: 3051
diff changeset
78 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
79 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
80 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
81 );
01210542e028 client: remove openlayers map objects after removing a map component from the view
Markus Kottlaender <markus@intevation.de>
parents: 3051
diff changeset
82 if (index !== -1) {
3071
53082e5a198a client: maps: fixed removing a map, added missing second param for splice
Markus Kottlaender <markus@intevation.de>
parents: 3069
diff changeset
83 state.openLayersMaps.splice(index, 1);
3052
01210542e028 client: remove openlayers map objects after removing a map component from the view
Markus Kottlaender <markus@intevation.de>
parents: 3051
diff changeset
84 }
01210542e028 client: remove openlayers map objects after removing a map component from the view
Markus Kottlaender <markus@intevation.de>
parents: 3051
diff changeset
85 },
3086
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3081
diff changeset
86 syncedMaps: (state, ids) => {
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3081
diff changeset
87 state.syncedMaps = ids;
a69a8deb56fe client: added button to sync/unsync maps when comparing sounding results
Markus Kottlaender <markus@intevation.de>
parents: 3081
diff changeset
88 },
3063
333aff79197d client: maps: all map's views are now synced
Markus Kottlaender <markus@intevation.de>
parents: 3062
diff changeset
89 syncedView: (state, view) => {
333aff79197d client: maps: all map's views are now synced
Markus Kottlaender <markus@intevation.de>
parents: 3062
diff changeset
90 state.syncedView = view;
333aff79197d client: maps: all map's views are now synced
Markus Kottlaender <markus@intevation.de>
parents: 3062
diff changeset
91 },
3204
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
92 mapPopup: (state, popup) => {
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
93 state.mapPopup = popup;
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
94 },
3261
916d4c898f08 client: import stretches: prevent map/identify popup from opening when selecting a distance mark on the map
Markus Kottlaender <markus@intevation.de>
parents: 3259
diff changeset
95 mapPopupEnabled: (state, enabled) => {
916d4c898f08 client: import stretches: prevent map/identify popup from opening when selecting a distance mark on the map
Markus Kottlaender <markus@intevation.de>
parents: 3259
diff changeset
96 state.mapPopupEnabled = enabled;
916d4c898f08 client: import stretches: prevent map/identify popup from opening when selecting a distance mark on the map
Markus Kottlaender <markus@intevation.de>
parents: 3259
diff changeset
97 },
1112
2c3d32322126 moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents: 1099
diff changeset
98 setIdentifiedFeatures: (state, identifiedFeatures) => {
2c3d32322126 moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents: 1099
diff changeset
99 state.identifiedFeatures = identifiedFeatures;
2c3d32322126 moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents: 1099
diff changeset
100 },
3029
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3006
diff changeset
101 addIdentifiedFeatures: (state, identifiedFeatures) => {
3031
f99f0cbb843f client:linting
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3029
diff changeset
102 state.identifiedFeatures = state.identifiedFeatures.concat(
f99f0cbb843f client:linting
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3029
diff changeset
103 identifiedFeatures
f99f0cbb843f client:linting
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3029
diff changeset
104 );
3029
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3006
diff changeset
105 },
3204
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
106 identifiedCoordinates: (state, coordinates) => {
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
107 state.identifiedCoordinates = coordinates;
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
108 },
1112
2c3d32322126 moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents: 1099
diff changeset
109 setCurrentMeasurement: (state, measurement) => {
2c3d32322126 moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents: 1099
diff changeset
110 state.currentMeasurement = measurement;
1115
1b160eda22cf moved drawMode to map store
Markus Kottlaender <markus@intevation.de>
parents: 1114
diff changeset
111 },
3062
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
112 lineToolEnabled: (state, enabled) => {
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
113 state.lineToolEnabled = enabled;
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
114 state.openLayersMaps.forEach(m => {
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
115 let tool = m
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
116 .getInteractions()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
117 .getArray()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
118 .find(i => i.get("id") === "linetool");
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
119 if (tool) {
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
120 tool.setActive(enabled);
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
121 }
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
122 });
1140
2e06bc53b002 separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents: 1122
diff changeset
123 },
3062
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
124 polygonToolEnabled: (state, enabled) => {
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
125 state.polygonToolEnabled = enabled;
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
126 state.openLayersMaps.forEach(m => {
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
127 let tool = m
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
128 .getInteractions()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
129 .getArray()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
130 .find(i => i.get("id") === "polygontool");
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
131 if (tool) {
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
132 tool.setActive(enabled);
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
133 }
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
134 });
1140
2e06bc53b002 separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents: 1122
diff changeset
135 },
3062
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
136 cutToolEnabled: (state, enabled) => {
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
137 state.cutToolEnabled = enabled;
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
138 state.openLayersMaps.forEach(m => {
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
139 let tool = m
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
140 .getInteractions()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
141 .getArray()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
142 .find(i => i.get("id") === "cuttool");
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
143 if (tool) {
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
144 tool.setActive(enabled);
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
145 }
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
146 });
1158
da75faa8043f added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents: 1144
diff changeset
147 },
1927
5a37ee321651 client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents: 1879
diff changeset
148 isolinesLegendImgDataURL: (state, isolinesLegendImgDataURL) => {
5a37ee321651 client: make isolines legend graphic internally availableo
Bernhard Reiter <bernhard@intevation.de>
parents: 1879
diff changeset
149 state.isolinesLegendImgDataURL = isolinesLegendImgDataURL;
2932
173ce013a021 layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents: 2910
diff changeset
150 },
173ce013a021 layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents: 2910
diff changeset
151 differencesLegendImgDataURL: (state, differencesLegendImgDataURL) => {
173ce013a021 layers: difference layer now contains legend
Thomas Junk <thomas.junk@intevation.de>
parents: 2910
diff changeset
152 state.differencesLegendImgDataURL = differencesLegendImgDataURL;
1144
5f98d0c9d738 linted code
Markus Kottlaender <markus@intevation.de>
parents: 1140
diff changeset
153 }
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
154 },
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
155 actions: {
3062
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
156 openLayersMap({ state, commit, dispatch }, map) {
3006
44493664d40e client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents: 2997
diff changeset
157 const drawVectorSrc = map.getLayer("DRAWTOOL").getSource();
44493664d40e client: refactored layers config
Markus Kottlaender <markus@intevation.de>
parents: 2997
diff changeset
158 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
159
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
160 // init line tool
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
161 const lineTool = new Draw({
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
162 source: drawVectorSrc,
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
163 type: "LineString",
3259
985bc5009115 client: prevent mutual intefering between draw tools and identify tool on openlayers api level
Markus Kottlaender <markus@intevation.de>
parents: 3256
diff changeset
164 maxPoints: 2,
985bc5009115 client: prevent mutual intefering between draw tools and identify tool on openlayers api level
Markus Kottlaender <markus@intevation.de>
parents: 3256
diff changeset
165 stopClick: true
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
166 });
3062
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
167 lineTool.set("id", "linetool");
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
168 lineTool.setActive(false);
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
169 lineTool.on("drawstart", () => {
3062
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
170 state.openLayersMaps.forEach(m => {
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
171 m.getLayer("DRAWTOOL")
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
172 .getSource()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
173 .clear();
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
174 });
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
175 commit("setCurrentMeasurement", null);
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 lineTool.on("drawend", event => {
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
178 commit("setCurrentMeasurement", {
1524
a0a16577261a Translation: mark some strings for translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1438
diff changeset
179 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
180 unitSymbol: "m",
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
181 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
182 });
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
183 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
184 });
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
185
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
186 // init polygon tool
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
187 const polygonTool = new Draw({
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
188 source: drawVectorSrc,
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
189 type: "Polygon",
3259
985bc5009115 client: prevent mutual intefering between draw tools and identify tool on openlayers api level
Markus Kottlaender <markus@intevation.de>
parents: 3256
diff changeset
190 maxPoints: 50,
985bc5009115 client: prevent mutual intefering between draw tools and identify tool on openlayers api level
Markus Kottlaender <markus@intevation.de>
parents: 3256
diff changeset
191 stopClick: true
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
192 });
3062
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
193 polygonTool.set("id", "polygontool");
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
194 polygonTool.setActive(false);
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
195 polygonTool.on("drawstart", () => {
3062
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
196 state.openLayersMaps.forEach(m => {
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
197 m.getLayer("DRAWTOOL")
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
198 .getSource()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
199 .clear();
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
200 });
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
201 commit("setCurrentMeasurement", null);
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
202 });
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
203 polygonTool.on("drawend", event => {
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
204 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
205 commit("setCurrentMeasurement", {
1524
a0a16577261a Translation: mark some strings for translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1438
diff changeset
206 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
207 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
208 value:
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
209 areaSize > 100000
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
210 ? 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
211 : Math.round(areaSize)
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
212 });
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
213 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
214 });
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
215
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
216 // init cut tool
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
217 const cutTool = new Draw({
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
218 source: cutVectorSrc,
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
219 type: "LineString",
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
220 maxPoints: 2,
3259
985bc5009115 client: prevent mutual intefering between draw tools and identify tool on openlayers api level
Markus Kottlaender <markus@intevation.de>
parents: 3256
diff changeset
221 stopClick: true,
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
222 style: new Style({
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
223 stroke: new Stroke({
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
224 color: "#444",
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
225 width: 2,
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
226 lineDash: [7, 7]
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
227 }),
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
228 image: new Circle({
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
229 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
230 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
231 radius: 6
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
232 })
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
233 })
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
234 });
3062
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
235 cutTool.set("id", "cuttool");
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
236 cutTool.setActive(false);
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
237 cutTool.on("drawstart", () => {
3062
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
238 state.openLayersMaps.forEach(m => {
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
239 m.getLayer("CUTTOOL")
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
240 .getSource()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
241 .clear();
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
242 });
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
243 });
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
244 cutTool.on("drawend", event => {
1395
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1363
diff changeset
245 commit("fairwayprofile/selectedCut", null, { root: true });
3069
766384d0ed7a client: identify tool: removed distinct enable flag, identify is enabled as long as no other tools are active
Markus Kottlaender <markus@intevation.de>
parents: 3063
diff changeset
246 dispatch("fairwayprofile/cut", event.feature, { root: true });
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
247 });
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
248
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
249 map.addInteraction(lineTool);
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
250 map.addInteraction(cutTool);
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
251 map.addInteraction(polygonTool);
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
252
3062
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
253 // If there are multiple maps and you enable one of the draw tools, when
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
254 // moving the mouse to another map, the cursor for the draw tool stays
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
255 // visible in the first map, right next to the edge where the cursor left
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
256 // the map. So here we disable all draw layers except the ones in the map
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
257 // that the user currently hovering with the mouse.
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
258 map.getTargetElement().addEventListener("mouseenter", () => {
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
259 if (
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
260 state.lineToolEnabled ||
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
261 state.polygonToolEnabled ||
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
262 state.cutToolEnabled
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
263 ) {
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
264 state.openLayersMaps.forEach(m => {
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
265 let lineTool = m
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
266 .getInteractions()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
267 .getArray()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
268 .find(i => i.get("id") === "linetool");
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
269 let polygonTool = m
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
270 .getInteractions()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
271 .getArray()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
272 .find(i => i.get("id") === "polygontool");
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
273 let cutTool = m
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
274 .getInteractions()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
275 .getArray()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
276 .find(i => i.get("id") === "cuttool");
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
277 if (lineTool) lineTool.setActive(false);
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
278 if (polygonTool) polygonTool.setActive(false);
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
279 if (cutTool) cutTool.setActive(false);
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
280 });
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
281 let lineTool = map
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
282 .getInteractions()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
283 .getArray()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
284 .find(i => i.get("id") === "linetool");
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
285 let polygonTool = map
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
286 .getInteractions()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
287 .getArray()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
288 .find(i => i.get("id") === "polygontool");
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
289 let cutTool = map
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
290 .getInteractions()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
291 .getArray()
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
292 .find(i => i.get("id") === "cuttool");
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
293 if (lineTool && state.lineToolEnabled) lineTool.setActive(true);
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
294 if (polygonTool && state.polygonToolEnabled)
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
295 polygonTool.setActive(true);
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
296 if (cutTool && state.cutToolEnabled) cutTool.setActive(true);
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
297 }
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
298 });
87e0422cffa7 client: draw/cut tools work now with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
299
3044
c71373594719 client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents: 3043
diff changeset
300 commit("addOpenLayersMap", map);
1435
7fa030127b05 fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents: 1395
diff changeset
301 },
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
302 initIdentifyTool({ state, rootState, commit, dispatch }, map) {
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
303 map.on(["singleclick", "dblclick"], event => {
3204
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
304 commit(
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
305 "identifiedCoordinates",
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
306 toLonLat(event.coordinate, map.getView().getProjection())
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
307 );
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
308 state.mapPopup.setPosition(undefined);
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
309 commit("setIdentifiedFeatures", []);
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
310 // checking our WFS layers
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
311 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
312 if (features) {
3204
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
313 let all = [];
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
314 let bottlenecks = [];
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
315 let gauges = [];
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
316 let stretches = [];
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
317 let sections = [];
1435
7fa030127b05 fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents: 1395
diff changeset
318
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
319 for (let feature of features) {
3204
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
320 // avoid identifying the same feature twice
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
321 if (all.findIndex(f => f.getId() === feature.getId()) === -1)
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
322 all.push(feature);
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
323
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
324 let id = feature.getId();
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
325 // RegExp.prototype.test() works with number, str and undefined
3204
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
326 // get selected bottleneck
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
327 if (/^bottlenecks/.test(id)) bottlenecks.push(feature);
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
328 // get selected gauge
3204
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
329 if (/^gauges/.test(id)) gauges.push(feature);
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
330 // get selected stretch
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
331 if (/^stretches/.test(id)) stretches.push(feature);
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
332 // get selected section
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
333 if (/^sections/.test(id)) sections.push(feature);
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
334 }
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
335
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
336 commit("setIdentifiedFeatures", all);
1437
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
337
3204
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
338 // Decide whether we open a related dialog immediately or show the
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
339 // popup with possible options first.
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
340 // The following cases require a manual decision via the popup because
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
341 // the targeted feature is not clear.
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
342 if (
3261
916d4c898f08 client: import stretches: prevent map/identify popup from opening when selecting a distance mark on the map
Markus Kottlaender <markus@intevation.de>
parents: 3259
diff changeset
343 (bottlenecks.length ||
916d4c898f08 client: import stretches: prevent map/identify popup from opening when selecting a distance mark on the map
Markus Kottlaender <markus@intevation.de>
parents: 3259
diff changeset
344 gauges.length > 1 ||
916d4c898f08 client: import stretches: prevent map/identify popup from opening when selecting a distance mark on the map
Markus Kottlaender <markus@intevation.de>
parents: 3259
diff changeset
345 stretches.length > 1 ||
916d4c898f08 client: import stretches: prevent map/identify popup from opening when selecting a distance mark on the map
Markus Kottlaender <markus@intevation.de>
parents: 3259
diff changeset
346 sections.length > 1 ||
916d4c898f08 client: import stretches: prevent map/identify popup from opening when selecting a distance mark on the map
Markus Kottlaender <markus@intevation.de>
parents: 3259
diff changeset
347 (sections.length && stretches.length) ||
916d4c898f08 client: import stretches: prevent map/identify popup from opening when selecting a distance mark on the map
Markus Kottlaender <markus@intevation.de>
parents: 3259
diff changeset
348 (gauges.length && sections.length) ||
916d4c898f08 client: import stretches: prevent map/identify popup from opening when selecting a distance mark on the map
Markus Kottlaender <markus@intevation.de>
parents: 3259
diff changeset
349 (gauges.length && stretches.length)) &&
916d4c898f08 client: import stretches: prevent map/identify popup from opening when selecting a distance mark on the map
Markus Kottlaender <markus@intevation.de>
parents: 3259
diff changeset
350 state.mapPopupEnabled
3204
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
351 ) {
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
352 state.mapPopup.setMap(map);
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
353 state.mapPopup.setPosition(event.coordinate);
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
354 }
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
355 // The following scenarios lead to a distinct action without popup.
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
356 if (
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
357 gauges.length === 1 &&
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
358 !bottlenecks.length &&
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
359 !sections.length &&
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
360 !stretches.length
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
361 ) {
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
362 commit("application/showGauges", true, { root: true });
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
363 dispatch("gauges/selectedGaugeISRS", gauges[0].get("isrs_code"), {
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
364 root: true
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
365 });
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
366 }
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
367 if (
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
368 stretches.length === 1 &&
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
369 !sections.length &&
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
370 !bottlenecks.length &&
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
371 !gauges.length
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
372 ) {
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
373 if (rootState.imports.selectedStretchId === stretches[0].getId()) {
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
374 commit("imports/selectedStretchId", null, {
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
375 root: true
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
376 });
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
377 } else {
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
378 commit("application/showStatistics", true, { root: true });
3207
ba7bc3740fb3 client: renamed store modules to better reflect their context
Markus Kottlaender <markus@intevation.de>
parents: 3206
diff changeset
379 commit("fairwayavailability/type", "stretches", { root: true });
3204
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
380 commit("imports/selectedStretchId", stretches[0].getId(), {
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
381 root: true
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
382 });
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
383 dispatch("moveToFeauture", { feature: stretches[0], zoom: 17 });
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
384 }
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 }
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 // 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
389 /*
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
390 for (let feature of features) {
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
391 console.log("Identified:", feature.getId());
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
392 for (let key of feature.getKeys()) {
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
393 if (key != feature.getGeometryName()) {
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
394 console.log(key, feature.get(key));
1437
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
395 }
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
396 }
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
397 }
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
398 */
1435
7fa030127b05 fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents: 1395
diff changeset
399
3256
48801e13ef18 client: identify: made identification of image layers work with current map resolution
Markus Kottlaender <markus@intevation.de>
parents: 3207
diff changeset
400 let currentResolution = map.getView().getResolution();
48801e13ef18 client: identify: made identification of image layers work with current map resolution
Markus Kottlaender <markus@intevation.de>
parents: 3207
diff changeset
401
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
402 var waterwayAxisSource = map.getLayer("WATERWAYAXIS").getSource();
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
403 var waxisUrl = waterwayAxisSource.getGetFeatureInfoUrl(
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
404 event.coordinate,
3256
48801e13ef18 client: identify: made identification of image layers work with current map resolution
Markus Kottlaender <markus@intevation.de>
parents: 3207
diff changeset
405 currentResolution /* resolution */,
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
406 "EPSG:3857",
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
407 // { 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
408 { INFO_FORMAT: "application/json" }
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
409 );
3047
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3044
diff changeset
410
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
411 if (waxisUrl) {
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
412 // 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
413 HTTP.get(waxisUrl, {
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
414 headers: {
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
415 "X-Gemma-Auth": localStorage.getItem("token")
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
416 }
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
417 }).then(response => {
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
418 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
419 let feat = new Feature({
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
420 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
421 });
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
422 feat.setId(f.id);
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
423 feat.setProperties(f.properties);
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
424 return feat;
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
425 });
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
426 commit("addIdentifiedFeatures", features);
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
427 });
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
428 }
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
429 var waterwayAreaSource = map.getLayer("WATERWAYAREA").getSource();
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
430 var wareaUrl = waterwayAreaSource.getGetFeatureInfoUrl(
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
431 event.coordinate,
3256
48801e13ef18 client: identify: made identification of image layers work with current map resolution
Markus Kottlaender <markus@intevation.de>
parents: 3207
diff changeset
432 currentResolution /* resolution */,
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
433 "EPSG:3857",
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
434 // { 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
435 { INFO_FORMAT: "application/json" }
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
436 );
3047
e0b77d7463e7 Changed Waterway axis and area layer to WMS.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3044
diff changeset
437
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
438 if (wareaUrl) {
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
439 HTTP.get(wareaUrl, {
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
440 headers: {
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
441 "X-Gemma-Auth": localStorage.getItem("token")
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
442 }
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
443 }).then(response => {
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
444 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
445 let feat = new Feature({
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
446 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
447 });
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
448 feat.setId(f.id);
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
449 feat.setProperties(f.properties);
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
450 return feat;
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
451 });
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
452 commit("addIdentifiedFeatures", features);
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
453 });
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
454 }
3081
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
455 var dmSource = map.getLayer("DISTANCEMARKS").getSource();
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
456 var dmUrl = dmSource.getGetFeatureInfoUrl(
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
457 event.coordinate,
3256
48801e13ef18 client: identify: made identification of image layers work with current map resolution
Markus Kottlaender <markus@intevation.de>
parents: 3207
diff changeset
458 currentResolution /* resolution */,
3081
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
459 "EPSG:3857",
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
460 // { INFO_FORMAT: "application/vnd.ogc.gml" } // not allowed by d4d
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
461 { INFO_FORMAT: "application/json" }
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
462 );
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
463
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
464 if (dmUrl) {
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
465 HTTP.get(dmUrl + "&BUFFER=5", {
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
466 headers: {
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
467 "X-Gemma-Auth": localStorage.getItem("token")
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
468 }
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
469 }).then(response => {
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
470 let features = response.data.features.map(f => {
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
471 let feat = new Feature({
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
472 geometry: new Point(f.geometry.coordinates)
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
473 });
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
474 feat.setId(f.id);
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
475 feat.setProperties(f.properties);
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
476 return feat;
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
477 });
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
478 commit("addIdentifiedFeatures", features);
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
479 });
9107c959bb3b client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3079
diff changeset
480 }
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
481 var dmaSource = map.getLayer("DISTANCEMARKSAXIS").getSource();
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
482 var dmaUrl = dmaSource.getGetFeatureInfoUrl(
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
483 event.coordinate,
3256
48801e13ef18 client: identify: made identification of image layers work with current map resolution
Markus Kottlaender <markus@intevation.de>
parents: 3207
diff changeset
484 currentResolution /* resolution */,
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
485 "EPSG:3857",
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
486 // { 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
487 { INFO_FORMAT: "application/json" }
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
488 );
3029
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3006
diff changeset
489
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
490 if (dmaUrl) {
3078
71129566acdf client: Increased click radius for distance marks feature info.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 3071
diff changeset
491 HTTP.get(dmaUrl + "&BUFFER=5", {
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
492 headers: {
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
493 "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
494 }
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
495 }).then(response => {
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
496 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
497 let feat = new Feature({
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
498 geometry: new Point(f.geometry.coordinates)
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
499 });
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
500 feat.setId(f.id);
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
501 feat.setProperties(f.properties);
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
502 return feat;
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
503 });
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
504 commit("addIdentifiedFeatures", features);
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
505 });
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
506 }
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
507 // trying the GetFeatureInfo way for WMS
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
508 var iecdisSource = map.getLayer("INLANDECDIS").getSource();
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
509 var iecdisUrl = iecdisSource.getGetFeatureInfoUrl(
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
510 event.coordinate,
3256
48801e13ef18 client: identify: made identification of image layers work with current map resolution
Markus Kottlaender <markus@intevation.de>
parents: 3207
diff changeset
511 currentResolution /* resolution */,
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
512 "EPSG:3857",
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
513 // { 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
514 { INFO_FORMAT: "text/plain" }
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
515 );
1437
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
516
3051
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
517 if (iecdisUrl) {
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
518 // 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
519 console.log("GetFeatureInfo url:", iecdisUrl);
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
520 }
051a3f446ac2 client: made identify tool work with multiple maps
Markus Kottlaender <markus@intevation.de>
parents: 3047
diff changeset
521 });
3044
c71373594719 client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents: 3043
diff changeset
522 },
3181
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
523 moveToBoundingBox(
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
524 { state },
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
525 { boundingBox, zoom, preventZoomOut, duration }
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
526 ) {
3044
c71373594719 client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents: 3043
diff changeset
527 const extent = transformExtent(boundingBox, "EPSG:4326", "EPSG:3857");
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3078
diff changeset
528 const currentZoom = state.syncedView.getZoom();
3054
1ef2f4179d30 client: map store: merged/renamed method(s)
Markus Kottlaender <markus@intevation.de>
parents: 3053
diff changeset
529 zoom = zoom || currentZoom;
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3078
diff changeset
530 state.syncedView.fit(extent, {
3054
1ef2f4179d30 client: map store: merged/renamed method(s)
Markus Kottlaender <markus@intevation.de>
parents: 3053
diff changeset
531 maxZoom: preventZoomOut ? Math.max(zoom, currentZoom) : zoom,
3181
c122a064fd5e client: map: fixed loading animation for layers
Markus Kottlaender <markus@intevation.de>
parents: 3177
diff changeset
532 duration: duration || 700
3054
1ef2f4179d30 client: map store: merged/renamed method(s)
Markus Kottlaender <markus@intevation.de>
parents: 3053
diff changeset
533 });
3044
c71373594719 client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents: 3043
diff changeset
534 },
3054
1ef2f4179d30 client: map store: merged/renamed method(s)
Markus Kottlaender <markus@intevation.de>
parents: 3053
diff changeset
535 moveToFeauture({ dispatch }, { feature, zoom, preventZoomOut }) {
3204
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
536 const boundingBox = feature.hasOwnProperty("geometry")
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
537 ? bbox(feature.geometry)
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
538 : feature
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
539 .getGeometry()
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
540 .clone()
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
541 .transform("EPSG:3857", "EPSG:4326")
1253fe15e3e3 client: identify: implemented popup when clicking the map and the intention is not clear...
Markus Kottlaender <markus@intevation.de>
parents: 3181
diff changeset
542 .getExtent();
3053
61e4feb04a35 client: avoid code duplication
Markus Kottlaender <markus@intevation.de>
parents: 3052
diff changeset
543 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
544 },
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3078
diff changeset
545 moveMap({ state }, { coordinates, zoom, preventZoomOut }) {
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3078
diff changeset
546 const currentZoom = state.syncedView.getZoom();
3044
c71373594719 client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents: 3043
diff changeset
547 zoom = zoom || currentZoom;
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3078
diff changeset
548 state.syncedView.animate({
3044
c71373594719 client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents: 3043
diff changeset
549 zoom: preventZoomOut ? Math.max(zoom, currentZoom) : zoom,
3079
57255fda7594 client: compare surveys on map
Markus Kottlaender <markus@intevation.de>
parents: 3078
diff changeset
550 center: fromLonLat(coordinates, state.syncedView.getProjection()),
3044
c71373594719 client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents: 3043
diff changeset
551 duration: 700
c71373594719 client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents: 3043
diff changeset
552 });
1296
99c039e86624 replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents: 1272
diff changeset
553 }
585
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
554 }
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
555 };