Mercurial > gemma
annotate client/src/store/map.js @ 1599:5e16d1fbe91f
WFS Capabilities parser: Parse constraints, too.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 17 Dec 2018 11:13:11 +0100 |
parents | faa045ebdf0c |
children | f034371c5d11 |
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 * |
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1313
diff
changeset
|
7 * Copyright (C) 2018 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): |
1363 | 12 * Markus Kottländer <markus@intevation.de> |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
13 * Thomas Junk <thomas.junk@intevation.de> |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
14 */ |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
15 |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
16 //import { HTTP } from "../lib/http"; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
17 |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
18 import TileWMS from "ol/source/TileWMS.js"; |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
19 import { Tile as TileLayer, Vector as VectorLayer } from "ol/layer.js"; |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
20 import OSM from "ol/source/OSM"; |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
21 import Draw from "ol/interaction/Draw.js"; |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
22 import { Icon, Stroke, Style, Fill, Text, Circle } from "ol/style.js"; |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
23 import VectorSource from "ol/source/Vector.js"; |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
24 import Point from "ol/geom/Point.js"; |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
25 import { bbox as bboxStrategy } from "ol/loadingstrategy"; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
1247
diff
changeset
|
26 import { HTTP } from "../lib/http"; |
1158
da75faa8043f
added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
27 import { fromLonLat } from "ol/proj"; |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
28 import { getLength, getArea } from "ol/sphere.js"; |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
29 import { unByKey } from "ol/Observable"; |
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
30 import { getCenter } from "ol/extent"; |
1524
a0a16577261a
Translation: mark some strings for translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1438
diff
changeset
|
31 import app from "../main"; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
32 |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
33 // initial state |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
34 const init = () => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
35 return { |
783
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
782
diff
changeset
|
36 openLayersMap: null, |
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
|
37 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
|
38 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
|
39 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
|
40 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
|
41 }, |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
42 identifyTool: null, // event binding (singleclick, dblclick) |
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 |
1247
c14353e2cdb9
repositioning of buttons (issue225)
Markus Kottlaender <markus@intevation.de>
parents:
1237
diff
changeset
|
44 currentMeasurement: null, // distance or area from line-/polygon-/cutTool |
1237
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
45 lineTool: null, // open layers interaction object (Draw) |
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
46 polygonTool: null, // open layers interaction object (Draw) |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
47 cutTool: null, // open layers interaction object (Draw) |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
48 layers: [ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
49 { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
50 name: "Open Streetmap", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
51 data: new TileLayer({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
52 source: new OSM() |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
53 }), |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
54 isVisible: true, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
55 showInLegend: true |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
56 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
57 { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
58 name: "Inland ECDIS chart Danube", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
59 data: new TileLayer({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
60 source: new TileWMS({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
61 preload: 1, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
62 url: "https://demo.d4d-portal.info/wms", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
63 params: { LAYERS: "d4d", VERSION: "1.1.1", TILED: true } |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
64 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
65 }), |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
66 isVisible: true, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
67 showInLegend: true |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
68 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
69 { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
70 name: "Fairway Dimensions", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
71 data: new VectorLayer({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
72 source: new VectorSource(), |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
73 style: function(feature) { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
74 return [ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
75 new Style({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
76 stroke: new Stroke({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
77 color: "rgba(0, 0, 255, 1.0)", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
78 width: 2 |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
79 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
80 }), |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
81 new Style({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
82 text: new Text({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
83 font: 'bold 12px "Open Sans", "sans-serif"', |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
84 placement: "line", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
85 fill: new Fill({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
86 color: "black" |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
87 }), |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
88 text: "LOS: " + feature.get("level_of_service").toString() |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
89 //, zIndex: 10 |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
90 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
91 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
92 ]; |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
93 } |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
94 }), |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
95 isVisible: true, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
96 showInLegend: true |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
97 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
98 { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
99 name: "Waterway Area, named", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
100 data: new VectorLayer({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
101 source: new VectorSource({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
102 strategy: bboxStrategy |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
103 }), |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
104 style: new Style({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
105 stroke: new Stroke({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
106 color: "rgba(0, 132, 0, 1)", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
107 width: 2 |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
108 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
109 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
110 }), |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
111 isVisible: false, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
112 showInLegend: true |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
113 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
114 { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
115 name: "Waterway Area", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
116 data: new VectorLayer({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
117 source: new VectorSource({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
118 strategy: bboxStrategy |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
119 }), |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
120 style: new Style({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
121 stroke: new Stroke({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
122 color: "rgba(0, 102, 0, 1)", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
123 width: 2 |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
124 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
125 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
126 }), |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
127 isVisible: true, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
128 showInLegend: true |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
129 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
130 { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
131 name: "Waterway Axis", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
132 data: new VectorLayer({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
133 source: new VectorSource({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
134 strategy: bboxStrategy |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
135 }), |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
136 style: new Style({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
137 stroke: new Stroke({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
138 color: "rgba(0, 0, 255, .5)", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
139 lineDash: [5, 5], |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
140 width: 2 |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
141 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
142 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
143 }), |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
144 isVisible: true, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
145 showInLegend: true |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
146 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
147 { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
148 name: "Distance marks", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
149 forLegendStyle: { point: true, resolution: 8 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
150 data: new VectorLayer({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
151 source: new VectorSource({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
152 strategy: bboxStrategy |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
153 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
154 }), |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
155 isVisible: false, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
156 showInLegend: true |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
157 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
158 { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
159 name: "Bottlenecks", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
160 data: new VectorLayer({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
161 source: new VectorSource({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
162 strategy: bboxStrategy |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
163 }), |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
164 style: new Style({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
165 stroke: new Stroke({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
166 color: "rgba(230, 230, 10, .8)", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
167 width: 4 |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
168 }), |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
169 fill: new Fill({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
170 color: "rgba(230, 230, 10, .3)" |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
171 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
172 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
173 }), |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
174 isVisible: true, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
175 showInLegend: true |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
176 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
177 { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
178 name: "Bottleneck isolines", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
179 data: new TileLayer({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
180 source: new TileWMS({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
181 preload: 0, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
182 projection: "EPSG:3857", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
183 url: window.location.origin + "/api/internal/wms", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
184 params: { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
185 LAYERS: "sounding_results_contour_lines_geoserver", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
186 VERSION: "1.1.1", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
187 TILED: true |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
188 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
189 tileLoadFunction: function(tile, src) { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
190 // console.log("calling for", tile, src); |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
191 HTTP.get(src, { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
192 headers: { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
193 "X-Gemma-Auth": localStorage.getItem("token") |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
194 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
195 responseType: "blob" |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
196 }).then(response => { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
197 tile.getImage().src = URL.createObjectURL(response.data); |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
198 }); |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
199 } // TODO tile.setState(TileState.ERROR); |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
200 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
201 }), |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
202 isVisible: false, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
203 showInLegend: true |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
204 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
205 { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
206 name: "Distance marks, Axis", |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
207 forLegendStyle: { point: true, resolution: 8 }, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
208 data: new VectorLayer({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
209 source: new VectorSource({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
210 strategy: bboxStrategy |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
211 }), |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
212 style: function(feature, resolution) { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
213 if (resolution < 10) { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
214 var s = new Style({ |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
215 image: new Circle({ |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
216 radius: 5, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
217 fill: new Fill({ color: "rgba(255, 0, 0, 0.1)" }), |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
218 stroke: new Stroke({ color: "blue", width: 1 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
219 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
220 }); |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
221 if (resolution < 6) { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
222 s.setText( |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
223 new Text({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
224 offsetY: 12, |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
225 font: '10px "Open Sans", "sans-serif"', |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
226 fill: new Fill({ |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
227 color: "black" |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
228 }), |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
229 text: (feature.get("hectometre") / 10).toString() |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
230 }) |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
231 ); |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
232 } |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
233 return s; |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
234 } else { |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
235 return []; |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
236 } |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
237 } |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
238 }), |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
239 isVisible: true, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
240 showInLegend: true |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
241 }, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
242 { |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
243 name: "Draw Tool", |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
244 data: new VectorLayer({ |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
245 source: new VectorSource({ wrapX: false }), |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
246 style: function(feature) { |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
247 // adapted from OpenLayer's LineString Arrow Example |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
248 var geometry = feature.getGeometry(); |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
249 var styles = [ |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
250 // linestring |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
251 new Style({ |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
252 stroke: new Stroke({ |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
253 color: "#369aca", |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
254 width: 2 |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
255 }) |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
256 }) |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
257 ]; |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
258 |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
259 if (geometry.getType() === "LineString") { |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
260 geometry.forEachSegment(function(start, end) { |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
261 var dx = end[0] - start[0]; |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
262 var dy = end[1] - start[1]; |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
263 var rotation = Math.atan2(dy, dx); |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
264 // arrows |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
265 styles.push( |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
266 new Style({ |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
267 geometry: new Point(end), |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
268 image: new Icon({ |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
269 // we need to make sure the image is loaded by Vue Loader |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
1247
diff
changeset
|
270 src: require("../assets/linestring_arrow.png"), |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
271 // fiddling with the anchor's y value does not help to |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
272 // position the image more centered on the line ending, as the |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
273 // default line style seems to be slightly uncentered in the |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
274 // anti-aliasing, but the image is not placed with subpixel |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
275 // precision |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
276 anchor: [0.75, 0.5], |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
277 rotateWithView: true, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
278 rotation: -rotation |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
279 }) |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
280 }) |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
281 ); |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
282 }); |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
283 } |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
284 return styles; |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
285 } |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
286 }), |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
287 isVisible: true, |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
288 showInLegend: false |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
289 }, |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
290 { |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
291 name: "Cut Tool", |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
292 data: new VectorLayer({ |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
293 source: new VectorSource({ wrapX: false }), |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
294 style: function(feature) { |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
295 // adapted from OpenLayer's LineString Arrow Example |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
296 var geometry = feature.getGeometry(); |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
297 var styles = [ |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
298 // linestring |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
299 new Style({ |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
300 stroke: new Stroke({ |
1197
49740dcba52c
changed cut tool style
Markus Kottlaender <markus@intevation.de>
parents:
1158
diff
changeset
|
301 color: "#333333", |
49740dcba52c
changed cut tool style
Markus Kottlaender <markus@intevation.de>
parents:
1158
diff
changeset
|
302 width: 2, |
49740dcba52c
changed cut tool style
Markus Kottlaender <markus@intevation.de>
parents:
1158
diff
changeset
|
303 lineDash: [7, 7] |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
304 }) |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
305 }) |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
306 ]; |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
307 |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
308 if (geometry.getType() === "LineString") { |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
309 geometry.forEachSegment(function(start, end) { |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
310 var dx = end[0] - start[0]; |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
311 var dy = end[1] - start[1]; |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
312 var rotation = Math.atan2(dy, dx); |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
313 // arrows |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
314 styles.push( |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
315 new Style({ |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
316 geometry: new Point(end), |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
317 image: new Icon({ |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
318 // we need to make sure the image is loaded by Vue Loader |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
1247
diff
changeset
|
319 src: require("../assets/linestring_arrow_grey.png"), |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
320 // fiddling with the anchor's y value does not help to |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
321 // position the image more centered on the line ending, as the |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
322 // default line style seems to be slightly uncentered in the |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
323 // anti-aliasing, but the image is not placed with subpixel |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
324 // precision |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
325 anchor: [0.75, 0.5], |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
326 rotateWithView: true, |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
327 rotation: -rotation |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
328 }) |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
329 }) |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
330 ); |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
331 }); |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
332 } |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
333 return styles; |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
334 } |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
335 }), |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
336 isVisible: true, |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
337 showInLegend: false |
1099
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
338 } |
1f4799bab8a6
deleted layers/layers.js and moved content to map store
Markus Kottlaender <markus@intevation.de>
parents:
1096
diff
changeset
|
339 ] |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
340 }; |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
341 }; |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
342 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
343 export default { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
344 init, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
345 namespaced: true, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
346 state: init(), |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
347 getters: { |
1121
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
348 layersForLegend: state => { |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
349 return state.layers.filter(layer => layer.showInLegend); |
035dc35e1dfc
moved draw layer in map store's layers property
Markus Kottlaender <markus@intevation.de>
parents:
1115
diff
changeset
|
350 }, |
754
105c421f99b1
refac: small improvements to code structure
Thomas Junk <thomas.junk@intevation.de>
parents:
747
diff
changeset
|
351 getLayerByName: state => name => { |
105c421f99b1
refac: small improvements to code structure
Thomas Junk <thomas.junk@intevation.de>
parents:
747
diff
changeset
|
352 return state.layers.find(layer => layer.name === name); |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
353 }, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
354 getVSourceByName: (state, getters) => name => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
355 return getters.getLayerByName(name).data.getSource(); |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
356 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
357 }, |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
358 mutations: { |
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
|
359 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
|
360 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
|
361 }, |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
362 toggleVisibility: (state, layer) => { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
363 state.layers[layer].isVisible = !state.layers[layer].isVisible; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
364 state.layers[layer].data.setVisible(state.layers[layer].isVisible); |
770
c12ec7fde3f2
client: add simple identify top area box
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
365 }, |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
366 openLayersMap: (state, map) => { |
783
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
782
diff
changeset
|
367 state.openLayersMap = map; |
1112
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
368 }, |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
369 identifyTool: (state, events) => { |
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
370 state.identifyTool = events; |
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
371 }, |
1112
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
372 setIdentifiedFeatures: (state, identifiedFeatures) => { |
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
373 state.identifiedFeatures = identifiedFeatures; |
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
374 }, |
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
375 setCurrentMeasurement: (state, measurement) => { |
2c3d32322126
moved identifystore properties to mapstore
Markus Kottlaender <markus@intevation.de>
parents:
1099
diff
changeset
|
376 state.currentMeasurement = measurement; |
1115
1b160eda22cf
moved drawMode to map store
Markus Kottlaender <markus@intevation.de>
parents:
1114
diff
changeset
|
377 }, |
1237
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
378 lineTool: (state, lineTool) => { |
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
379 state.lineTool = lineTool; |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
380 }, |
1237
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
381 polygonTool: (state, polygonTool) => { |
74562dc29e10
refactored drawtool
Markus Kottlaender <markus@intevation.de>
parents:
1197
diff
changeset
|
382 state.polygonTool = polygonTool; |
1140
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
383 }, |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
384 cutTool: (state, cutTool) => { |
2e06bc53b002
separating line/polygon/cut tools in UI
Markus Kottlaender <markus@intevation.de>
parents:
1122
diff
changeset
|
385 state.cutTool = cutTool; |
1158
da75faa8043f
added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
386 }, |
da75faa8043f
added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
387 moveMap: (state, { coordinates, zoom, preventZoomOut }) => { |
da75faa8043f
added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
388 let view = state.openLayersMap.getView(); |
da75faa8043f
added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
389 const currentZoom = view.getZoom(); |
da75faa8043f
added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
390 view.animate({ |
da75faa8043f
added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
391 zoom: preventZoomOut ? Math.max(zoom, currentZoom) : zoom, |
da75faa8043f
added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
392 center: fromLonLat(coordinates, view.getProjection()), |
da75faa8043f
added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
393 duration: 700 |
da75faa8043f
added central moveMap method to pan and zoom the map on certain events
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
394 }); |
1144 | 395 } |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
396 }, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
397 actions: { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
398 openLayersMap({ commit, dispatch, getters }, map) { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
399 const drawVectorSrc = getters.getVSourceByName("Draw Tool"); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
400 const cutVectorSrc = getters.getVSourceByName("Cut Tool"); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
401 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
402 // init line tool |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
403 const lineTool = new Draw({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
404 source: drawVectorSrc, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
405 type: "LineString", |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
406 maxPoints: 2 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
407 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
408 lineTool.setActive(false); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
409 lineTool.on("drawstart", () => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
410 drawVectorSrc.clear(); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
411 commit("setCurrentMeasurement", null); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
412 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
413 lineTool.on("drawend", event => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
414 commit("setCurrentMeasurement", { |
1524
a0a16577261a
Translation: mark some strings for translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1438
diff
changeset
|
415 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
|
416 unitSymbol: "m", |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
417 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
|
418 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
419 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
|
420 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
421 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
422 // init polygon tool |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
423 const polygonTool = new Draw({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
424 source: drawVectorSrc, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
425 type: "Polygon", |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
426 maxPoints: 50 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
427 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
428 polygonTool.setActive(false); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
429 polygonTool.on("drawstart", () => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
430 drawVectorSrc.clear(); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
431 commit("setCurrentMeasurement", null); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
432 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
433 polygonTool.on("drawend", event => { |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
434 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
|
435 commit("setCurrentMeasurement", { |
1524
a0a16577261a
Translation: mark some strings for translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1438
diff
changeset
|
436 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
|
437 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
|
438 value: |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
439 areaSize > 100000 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
440 ? 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
|
441 : Math.round(areaSize) |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
442 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
443 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
|
444 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
445 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
446 // init cut tool |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
447 const cutTool = new Draw({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
448 source: cutVectorSrc, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
449 type: "LineString", |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
450 maxPoints: 2, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
451 style: new Style({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
452 stroke: new Stroke({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
453 color: "#444", |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
454 width: 2, |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
455 lineDash: [7, 7] |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
456 }), |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
457 image: new Circle({ |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
458 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
|
459 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
|
460 radius: 6 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
461 }) |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
462 }) |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
463 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
464 cutTool.setActive(false); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
465 cutTool.on("drawstart", () => { |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
466 dispatch("disableIdentifyTool"); |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
467 cutVectorSrc.clear(); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
468 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
469 cutTool.on("drawend", event => { |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1363
diff
changeset
|
470 commit("fairwayprofile/selectedCut", null, { root: true }); |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
471 dispatch("fairwayprofile/cut", event.feature, { root: true }).then(() => |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
472 // This setTimeout is an ugly workaround. If we would enable the |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
473 // identifyTool here immediately then the click event from ending the |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
474 // cut will trigger it. We don't want that. |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
475 setTimeout(() => dispatch("enableIdentifyTool"), 1000) |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
476 ); |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
477 }); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
478 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
479 map.addInteraction(lineTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
480 map.addInteraction(cutTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
481 map.addInteraction(polygonTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
482 |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
483 commit("lineTool", lineTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
484 commit("polygonTool", polygonTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
485 commit("cutTool", cutTool); |
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
486 commit("openLayersMap", map); |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
487 }, |
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
488 disableIdentifyTool({ state }) { |
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
489 unByKey(state.identifyTool); |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
490 state.identifyTool = null; |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
491 }, |
1438
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
492 enableIdentifyTool({ state, rootState, commit, dispatch, getters }) { |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
493 if (!state.identifyTool) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
494 state.identifyTool = state.openLayersMap.on( |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
495 ["singleclick", "dblclick"], |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
496 event => { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
497 commit("setIdentifiedFeatures", []); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
498 // checking our WFS layers |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
499 var features = state.openLayersMap.getFeaturesAtPixel(event.pixel); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
500 if (features) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
501 commit("setIdentifiedFeatures", features); |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
502 |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
503 // get selected bottleneck from identified features |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
504 for (let feature of features) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
505 let id = feature.getId(); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
506 // RegExp.prototype.test() works with number, str and undefined |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
507 if (/^bottlenecks\./.test(id)) { |
1438
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
508 if ( |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
509 rootState.bottlenecks.selectedBottleneck != |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
510 feature.get("objnam") |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
511 ) { |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
512 dispatch( |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
513 "bottlenecks/setSelectedBottleneck", |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
514 feature.get("objnam"), |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
515 { root: true } |
1565
faa045ebdf0c
select first surveydate after identification of bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents:
1524
diff
changeset
|
516 ).then(() => { |
faa045ebdf0c
select first surveydate after identification of bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents:
1524
diff
changeset
|
517 this.commit("bottlenecks/setFirstSurveySelected"); |
faa045ebdf0c
select first surveydate after identification of bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents:
1524
diff
changeset
|
518 }); |
1438
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
519 commit("moveMap", { |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
520 coordinates: getCenter( |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
521 feature |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
522 .getGeometry() |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
523 .clone() |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
524 .transform("EPSG:3857", "EPSG:4326") |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
525 .getExtent() |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
526 ), |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
527 zoom: 17, |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
528 preventZoomOut: true |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
529 }); |
71eb96690f91
avoid unnecessary setSelectedBottleneck call
Markus Kottlaender <markus@intevation.de>
parents:
1437
diff
changeset
|
530 } |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
531 } |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
532 } |
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
533 } |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
534 |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
535 // DEBUG output and example how to remove the GeometryName |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
536 /* |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
537 for (let feature of features) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
538 console.log("Identified:", feature.getId()); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
539 for (let key of feature.getKeys()) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
540 if (key != feature.getGeometryName()) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
541 console.log(key, feature.get(key)); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
542 } |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
543 } |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
544 } |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
545 */ |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
546 |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
547 // trying the GetFeatureInfo way for WMS |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
548 var wmsSource = getters.getVSourceByName( |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
549 "Inland ECDIS chart Danube" |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
550 ); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
551 var url = wmsSource.getGetFeatureInfoUrl( |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
552 event.coordinate, |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
553 100 /* resolution */, |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
554 "EPSG:3857", |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
555 // { INFO_FORMAT: "application/vnd.ogc.gml" } // not allowed by d4d |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
556 { INFO_FORMAT: "text/plain" } |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
557 ); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
558 |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
559 if (url) { |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
560 // cannot directly query here because of SOP |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
561 console.log("GetFeatureInfo url:", url); |
1435
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
562 } |
7fa030127b05
fixed panning problem
Markus Kottlaender <markus@intevation.de>
parents:
1395
diff
changeset
|
563 } |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
564 ); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
565 } |
1296
99c039e86624
replaced manual store cleanup on logout with central store reset
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
566 } |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
567 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
568 }; |