Mercurial > gemma
annotate client/src/map/Maplayer.vue @ 1022:74229d9f7028
refac: restructure maptool for understandability
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 24 Oct 2018 12:03:51 +0200 |
parents | e89be4af3a9f |
children | a55f20dc8d8d |
rev | line source |
---|---|
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
1 <template> |
621
b17a4482d07d
feat: UI adaptation of 4 slots
Thomas Junk <thomas.junk@intevation.de>
parents:
620
diff
changeset
|
2 <div id="map" :class="mapStyle"></div> |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
3 </template> |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
4 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
5 <style lang="scss"> |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
6 .mapsplit { |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
7 height: 50vh; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
8 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
9 |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
10 .mapfull { |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
11 height: 100vh; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
12 } |
879
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
13 |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
14 @media print { |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
15 .mapfull { |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
16 width: 2000px; |
902 | 17 height: 2828px; |
879
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
18 } |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
19 .mapsplit { |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
20 width: 2000px; |
902 | 21 height: 2828px; |
879
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
22 } |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
23 } |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
24 </style> |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
25 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
26 <script> |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
27 /* |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
28 * This is Free Software under GNU Affero General Public License v >= 3.0 |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
29 * without warranty, see README.md and license for details. |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
30 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
31 * SPDX-License-Identifier: AGPL-3.0-or-later |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
32 * License-Filename: LICENSES/AGPL-3.0.txt |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
33 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
34 * Copyright (C) 2018 by via donau |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
35 * – Österreichische Wasserstraßen-Gesellschaft mbH |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
36 * Software engineering by Intevation GmbH |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
37 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
38 * Author(s): |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
39 * Thomas Junk <thomas.junk@intevation.de> |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
975
diff
changeset
|
40 */ |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
41 import { HTTP } from "../application/lib/http"; |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
42 import { mapGetters, mapState } from "vuex"; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
43 import "ol/ol.css"; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
44 import { Map, View } from "ol"; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
45 import { WFS, GeoJSON } from "ol/format.js"; |
709
35fd15711e9e
client: prepare to send profile cut to backend
Bernhard Reiter <bernhard@intevation.de>
parents:
706
diff
changeset
|
46 import LineString from "ol/geom/LineString.js"; |
942
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
47 import Point from "ol/geom/Point.js"; |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
48 import Draw from "ol/interaction/Draw.js"; |
709
35fd15711e9e
client: prepare to send profile cut to backend
Bernhard Reiter <bernhard@intevation.de>
parents:
706
diff
changeset
|
49 import { Vector as VectorLayer } from "ol/layer.js"; |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
50 import { Vector as VectorSource } from "ol/source.js"; |
793
073394629ec6
client: add measurement and improve identify
Bernhard Reiter <bernhard@intevation.de>
parents:
790
diff
changeset
|
51 import { getLength } from "ol/sphere.js"; |
942
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
52 import { Icon, Stroke, Style, Fill } from "ol/style.js"; |
1020
e89be4af3a9f
restructure surveyrequest
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
53 import { generateFeatureRequest } from "../application/lib/geo.js"; |
843
d2aa972df342
client: add example for setting style
Bernhard Reiter <bernhard@intevation.de>
parents:
842
diff
changeset
|
54 |
738
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
55 import distance from "@turf/distance"; |
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
56 import { |
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
57 lineString as turfLineString, |
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
58 polygon as turfPolygon |
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
59 } from "@turf/helpers"; |
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
60 import lineIntersect from "@turf/line-intersect"; |
767
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
765
diff
changeset
|
61 import { displayError } from "../application/lib/errors.js"; |
738
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
62 |
802
327aa4a18a1c
Fairway profile WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
797
diff
changeset
|
63 const DEMODATA = 2.5; |
327aa4a18a1c
Fairway profile WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
797
diff
changeset
|
64 |
848
22f7d33eee65
Make eslint happy again.
Sascha Wilde <wilde@intevation.de>
parents:
843
diff
changeset
|
65 /* for the sake of debugging */ |
22f7d33eee65
Make eslint happy again.
Sascha Wilde <wilde@intevation.de>
parents:
843
diff
changeset
|
66 /* eslint-disable no-console */ |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
67 export default { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
68 name: "maplayer", |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
69 props: ["drawMode", "lat", "long", "zoom", "split"], |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
70 data() { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
71 return { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
72 projection: "EPSG:3857", |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
73 interaction: null, |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
74 vectorLayer: null, |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
75 vectorSource: null |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
76 }; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
77 }, |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
78 computed: { |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
79 ...mapGetters("mapstore", ["layers", "getLayerByName"]), |
975
3da707172772
refac: removed technical debt
Thomas Junk <thomas.junk@intevation.de>
parents:
957
diff
changeset
|
80 ...mapState("mapstore", ["openLayersMap"]), |
3da707172772
refac: removed technical debt
Thomas Junk <thomas.junk@intevation.de>
parents:
957
diff
changeset
|
81 ...mapState("morphstore", ["selectedMorph"]), |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
82 mapStyle() { |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
83 return { |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
84 mapfull: !this.split, |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
85 mapsplit: this.split |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
86 }; |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
87 }, |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
88 layerData() { |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
89 const l = this.layers.map(x => { |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
90 return x.data; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
91 }); |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
92 return [...l, this.vectorLayer]; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
93 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
94 }, |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
95 methods: { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
96 createVectorSource() { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
97 this.vectorSource = new VectorSource({ wrapX: false }); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
98 }, |
942
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
99 drawStyleFunction(feature) { |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
100 // adapted from OpenLayer's LineString Arrow Example |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
101 var geometry = feature.getGeometry(); |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
102 var styles = [ |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
103 // linestring |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
104 new Style({ |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
105 stroke: new Stroke({ |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
106 color: "#369aca", |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
107 width: 2 |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
108 }) |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
109 }) |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
110 ]; |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
111 |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
112 geometry.forEachSegment(function(start, end) { |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
113 var dx = end[0] - start[0]; |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
114 var dy = end[1] - start[1]; |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
115 var rotation = Math.atan2(dy, dx); |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
116 // arrows |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
117 styles.push( |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
118 new Style({ |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
119 geometry: new Point(end), |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
120 image: new Icon({ |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
121 // we need to make sure the image is loaded by Vue Loader |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
122 src: require("../application/assets/linestring_arrow.png"), |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
123 // fiddling with the anchor's y value does not help to |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
124 // position the image more centered on the line ending, as the |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
125 // default line style seems to be slightly uncentered in the |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
126 // anti-aliasing, but the image is not placed with subpixel |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
127 // precision |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
128 anchor: [0.75, 0.5], |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
129 rotateWithView: true, |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
130 rotation: -rotation |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
131 }) |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
132 }) |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
133 ); |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
134 }); |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
135 |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
136 return styles; |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
137 }, |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
138 createVectorLayer() { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
139 this.vectorLayer = new VectorLayer({ |
942
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
140 source: this.vectorSource, |
912d016275ee
client: add arrow to drawn linesegment
Bernhard Reiter <bernhard@intevation.de>
parents:
938
diff
changeset
|
141 style: this.drawStyleFunction |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
142 }); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
143 }, |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
144 removeCurrentInteraction() { |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
145 this.openLayersMap.removeInteraction(this.interaction); |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
146 this.interaction = null; |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
147 }, |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
148 createInteraction() { |
752
f09cbe80a864
refac: small improvements
Thomas Junk <thomas.junk@intevation.de>
parents:
745
diff
changeset
|
149 this.vectorSource.clear(); |
705
6aa09d12157f
client: add detection of drawend
Bernhard Reiter <bernhard@intevation.de>
parents:
703
diff
changeset
|
150 var draw = new Draw({ |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
151 source: this.vectorSource, |
752
f09cbe80a864
refac: small improvements
Thomas Junk <thomas.junk@intevation.de>
parents:
745
diff
changeset
|
152 type: this.drawMode, |
f09cbe80a864
refac: small improvements
Thomas Junk <thomas.junk@intevation.de>
parents:
745
diff
changeset
|
153 maxPoints: 2 |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
154 }); |
793
073394629ec6
client: add measurement and improve identify
Bernhard Reiter <bernhard@intevation.de>
parents:
790
diff
changeset
|
155 draw.on("drawstart", event => { |
752
f09cbe80a864
refac: small improvements
Thomas Junk <thomas.junk@intevation.de>
parents:
745
diff
changeset
|
156 this.vectorSource.clear(); |
975
3da707172772
refac: removed technical debt
Thomas Junk <thomas.junk@intevation.de>
parents:
957
diff
changeset
|
157 this.$store.commit("identifystore/setCurrentMeasurement", null); |
793
073394629ec6
client: add measurement and improve identify
Bernhard Reiter <bernhard@intevation.de>
parents:
790
diff
changeset
|
158 event.feature.setId("drawn.1"); // unique id for new feature |
706
d47fa556a3e8
client: improve draw behaviour
Bernhard Reiter <bernhard@intevation.de>
parents:
705
diff
changeset
|
159 }); |
705
6aa09d12157f
client: add detection of drawend
Bernhard Reiter <bernhard@intevation.de>
parents:
703
diff
changeset
|
160 draw.on("drawend", this.drawEnd); |
6aa09d12157f
client: add detection of drawend
Bernhard Reiter <bernhard@intevation.de>
parents:
703
diff
changeset
|
161 return draw; |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
162 }, |
706
d47fa556a3e8
client: improve draw behaviour
Bernhard Reiter <bernhard@intevation.de>
parents:
705
diff
changeset
|
163 drawEnd(event) { |
793
073394629ec6
client: add measurement and improve identify
Bernhard Reiter <bernhard@intevation.de>
parents:
790
diff
changeset
|
164 const length = getLength(event.feature.getGeometry()); |
975
3da707172772
refac: removed technical debt
Thomas Junk <thomas.junk@intevation.de>
parents:
957
diff
changeset
|
165 this.$store.commit("identifystore/setCurrentMeasurement", length); |
793
073394629ec6
client: add measurement and improve identify
Bernhard Reiter <bernhard@intevation.de>
parents:
790
diff
changeset
|
166 // also place the a rounded length in a property, so identify can show it |
073394629ec6
client: add measurement and improve identify
Bernhard Reiter <bernhard@intevation.de>
parents:
790
diff
changeset
|
167 event.feature.set("length", Math.round(length * 10) / 10); |
073394629ec6
client: add measurement and improve identify
Bernhard Reiter <bernhard@intevation.de>
parents:
790
diff
changeset
|
168 |
829
797063af6dc8
client: complete simple survey selection
Bernhard Reiter <bernhard@intevation.de>
parents:
810
diff
changeset
|
169 // if a survey has been selected, request a profile |
797063af6dc8
client: complete simple survey selection
Bernhard Reiter <bernhard@intevation.de>
parents:
810
diff
changeset
|
170 // TODO an improvement could be to check if the line intersects |
797063af6dc8
client: complete simple survey selection
Bernhard Reiter <bernhard@intevation.de>
parents:
810
diff
changeset
|
171 // with the bottleneck area's polygon before trying the server request |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
172 if (this.selectedMorph) { |
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
173 console.log("requesting profile for", this.selectedMorph); |
1020
e89be4af3a9f
restructure surveyrequest
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
174 const inputLineString = event.feature.getGeometry().clone(); |
e89be4af3a9f
restructure surveyrequest
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
175 inputLineString.transform("EPSG:3857", "EPSG:4326"); |
e89be4af3a9f
restructure surveyrequest
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
176 const [start, end] = inputLineString.getCoordinates(); |
e89be4af3a9f
restructure surveyrequest
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
177 this.$store.commit("fairwayprofile/setStartPoint", start); |
e89be4af3a9f
restructure surveyrequest
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
178 this.$store.commit("fairwayprofile/setEndPoint", end); |
e89be4af3a9f
restructure surveyrequest
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
179 this.requestProfile(start, end, this.selectedMorph); |
829
797063af6dc8
client: complete simple survey selection
Bernhard Reiter <bernhard@intevation.de>
parents:
810
diff
changeset
|
180 } |
797063af6dc8
client: complete simple survey selection
Bernhard Reiter <bernhard@intevation.de>
parents:
810
diff
changeset
|
181 }, |
1020
e89be4af3a9f
restructure surveyrequest
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
182 requestProfile(start, end, survey) { |
829
797063af6dc8
client: complete simple survey selection
Bernhard Reiter <bernhard@intevation.de>
parents:
810
diff
changeset
|
183 // survey has to have the properties bottleneck_id and date_info |
793
073394629ec6
client: add measurement and improve identify
Bernhard Reiter <bernhard@intevation.de>
parents:
790
diff
changeset
|
184 // prepare to send the first line seqment to the server as GeoJSON |
754
105c421f99b1
refac: small improvements to code structure
Thomas Junk <thomas.junk@intevation.de>
parents:
752
diff
changeset
|
185 const profileLine = new LineString([start, end]); |
1020
e89be4af3a9f
restructure surveyrequest
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
186 const geoJSON = generateFeatureRequest(profileLine, survey); |
e89be4af3a9f
restructure surveyrequest
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
187 HTTP.post("/cross", geoJSON, { |
e89be4af3a9f
restructure surveyrequest
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
188 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
e89be4af3a9f
restructure surveyrequest
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
189 }) |
e89be4af3a9f
restructure surveyrequest
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
190 .then(response => { |
e89be4af3a9f
restructure surveyrequest
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
191 this.$store.commit("fairwayprofile/profileLoaded", response); |
e89be4af3a9f
restructure surveyrequest
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
192 }) |
797
644172f201e8
Fairway profile WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
793
diff
changeset
|
193 .then(() => { |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
194 var vectorSource = this.getLayerByName( |
797
644172f201e8
Fairway profile WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
793
diff
changeset
|
195 "Fairway Dimensions" |
644172f201e8
Fairway profile WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
793
diff
changeset
|
196 ).data.getSource(); |
1022
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
197 this.calculateIntersection(vectorSource, profileLine); |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
198 }) |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
199 .then(() => { |
810 | 200 this.$store.commit("application/openSplitScreen"); |
797
644172f201e8
Fairway profile WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
793
diff
changeset
|
201 }) |
767
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
765
diff
changeset
|
202 .catch(error => { |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
765
diff
changeset
|
203 const { status, data } = error.response; |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
765
diff
changeset
|
204 displayError({ |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
765
diff
changeset
|
205 title: "Backend Error", |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
765
diff
changeset
|
206 message: `${status}: ${data.message || data}` |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
765
diff
changeset
|
207 }); |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
765
diff
changeset
|
208 }); |
706
d47fa556a3e8
client: improve draw behaviour
Bernhard Reiter <bernhard@intevation.de>
parents:
705
diff
changeset
|
209 }, |
1022
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
210 calculateIntersection(vectorSource, profileLine) { |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
211 const transformedLine = profileLine |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
212 .clone() |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
213 .transform("EPSG:4326", "EPSG:3857") |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
214 .getExtent(); |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
215 const featureCallback = feature => { |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
216 // transform back to prepare for usage |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
217 var intersectingPolygon = feature |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
218 .getGeometry() |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
219 .clone() |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
220 .transform("EPSG:3857", "EPSG:4326"); |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
221 const fairwayCoordinates = this.calculateFairwayCoordinates( |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
222 profileLine, |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
223 intersectingPolygon, |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
224 DEMODATA |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
225 ); |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
226 this.$store.commit( |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
227 "fairwayprofile/setFairwayCoordinates", |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
228 fairwayCoordinates |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
229 ); |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
230 }; |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
231 vectorSource.forEachFeatureIntersectingExtent( |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
232 // need to use EPSG:3857 which is the proj of vectorSource |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
233 transformedLine, |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
234 featureCallback |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
235 ); |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
236 }, |
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
237 calculateFairwayCoordinates(profileLine, fairwayGeometry, depth) { |
734
1581ba78a360
client: prepare for fairway intersection for profile
Bernhard Reiter <bernhard@intevation.de>
parents:
733
diff
changeset
|
238 // both geometries have to be in EPSG:4326 |
738
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
239 // uses turfjs distance() function |
802
327aa4a18a1c
Fairway profile WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
797
diff
changeset
|
240 let fairwayCoordinates = []; |
738
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
241 var line = turfLineString(profileLine.getCoordinates()); |
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
242 var polygon = turfPolygon(fairwayGeometry.getCoordinates()); |
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
243 var intersects = lineIntersect(line, polygon); |
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
244 var l = intersects.features.length; |
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
245 if (l % 2 != 0) { |
772
990a9d85ac6c
client: readd diagnosis output for fairway rectangle calc
Bernhard Reiter <bernhard@intevation.de>
parents:
770
diff
changeset
|
246 console.log("Ignoring fairway because profile only intersects once."); |
738
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
247 } else { |
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
248 for (let i = 0; i < l; i += 2) { |
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
249 let pStartPoint = profileLine.getCoordinates()[0]; |
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
250 let fStartPoint = intersects.features[i].geometry.coordinates; |
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
251 let fEndPoint = intersects.features[i + 1].geometry.coordinates; |
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
252 let opts = { units: "kilometers" }; |
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
253 |
802
327aa4a18a1c
Fairway profile WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
797
diff
changeset
|
254 fairwayCoordinates.push([ |
738
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
255 distance(pStartPoint, fStartPoint, opts) * 1000, |
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
256 distance(pStartPoint, fEndPoint, opts) * 1000, |
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
257 depth |
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
258 ]); |
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
259 } |
d7530644dde3
client: add calculation of fairway rectangles
Bernhard Reiter <bernhard@intevation.de>
parents:
734
diff
changeset
|
260 } |
1022
74229d9f7028
refac: restructure maptool for understandability
Thomas Junk <thomas.junk@intevation.de>
parents:
1020
diff
changeset
|
261 return fairwayCoordinates; |
734
1581ba78a360
client: prepare for fairway intersection for profile
Bernhard Reiter <bernhard@intevation.de>
parents:
733
diff
changeset
|
262 }, |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
263 activateInteraction() { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
264 const interaction = this.createInteraction(this.drawMode); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
265 this.interaction = interaction; |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
266 this.openLayersMap.addInteraction(interaction); |
701
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
267 }, |
764
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
268 activateIdentifyMode() { |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
269 this.openLayersMap.on("singleclick", event => { |
764
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
270 // console.log("single click on map:", event); |
765
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
271 this.identify(event.coordinate, event.pixel); |
764
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
272 }); |
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
273 }, |
765
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
274 identify(coordinate, pixel) { |
975
3da707172772
refac: removed technical debt
Thomas Junk <thomas.junk@intevation.de>
parents:
957
diff
changeset
|
275 this.$store.commit("identifystore/setIdentifiedFeatures", []); |
765
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
276 // checking our WFS layers |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
277 var features = this.openLayersMap.getFeaturesAtPixel(pixel); |
975
3da707172772
refac: removed technical debt
Thomas Junk <thomas.junk@intevation.de>
parents:
957
diff
changeset
|
278 this.$store.commit("identifystore/setIdentifiedFeatures", features); |
770
c12ec7fde3f2
client: add simple identify top area box
Bernhard Reiter <bernhard@intevation.de>
parents:
767
diff
changeset
|
279 |
c12ec7fde3f2
client: add simple identify top area box
Bernhard Reiter <bernhard@intevation.de>
parents:
767
diff
changeset
|
280 // DEBUG output and example how to remove the GeometryName |
c12ec7fde3f2
client: add simple identify top area box
Bernhard Reiter <bernhard@intevation.de>
parents:
767
diff
changeset
|
281 /* |
765
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
282 for (let feature of features) { |
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
283 console.log("Identified:", feature.getId()); |
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
284 for (let key of feature.getKeys()) { |
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
285 if (key != feature.getGeometryName()) { |
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
286 console.log(key, feature.get(key)); |
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
287 } |
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
288 } |
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
289 } |
770
c12ec7fde3f2
client: add simple identify top area box
Bernhard Reiter <bernhard@intevation.de>
parents:
767
diff
changeset
|
290 */ |
765
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
291 |
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
292 // trying the GetFeatureInfo way for WMS |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
293 var wmsSource = this.getLayerByName( |
765
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
294 "Inland ECDIS chart Danube" |
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
295 ).data.getSource(); |
764
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
296 var url = wmsSource.getGetFeatureInfoUrl( |
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
297 coordinate, |
765
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
298 100 /* resolution */, |
764
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
299 "EPSG:3857", |
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
300 // { INFO_FORMAT: "application/vnd.ogc.gml" } // not allowed by d4d |
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
301 { INFO_FORMAT: "text/plain" } |
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
302 ); |
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
303 |
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
304 if (url) { |
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
305 // cannot directly query here because of SOP |
765
c1baaff348b0
client: add code to identify WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
764
diff
changeset
|
306 console.log("GetFeatureInfo url:", url); |
764
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
307 } |
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
308 }, |
701
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
309 buildVectorLoader(featureRequestOptions, endpoint, vectorSource) { |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
310 // build a function to be used for VectorSource.setLoader() |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
311 // make use of WFS().writeGetFeature to build the request |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
312 // and use our HTTP library to actually do it |
703
e9c28c42c927
client: improve WFS loader
Bernhard Reiter <bernhard@intevation.de>
parents:
702
diff
changeset
|
313 // NOTE: a) the geometryName has to be given in featureRequestOptions, |
e9c28c42c927
client: improve WFS loader
Bernhard Reiter <bernhard@intevation.de>
parents:
702
diff
changeset
|
314 // because we want to load depending on the bbox |
e9c28c42c927
client: improve WFS loader
Bernhard Reiter <bernhard@intevation.de>
parents:
702
diff
changeset
|
315 // b) the VectorSource has to have the option strategy: bbox |
701
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
316 featureRequestOptions["outputFormat"] = "application/json"; |
702
aaf5dbfb9512
client: improve loading of WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
701
diff
changeset
|
317 var loader = function(extent, resolution, projection) { |
701
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
318 featureRequestOptions["bbox"] = extent; |
702
aaf5dbfb9512
client: improve loading of WFS features
Bernhard Reiter <bernhard@intevation.de>
parents:
701
diff
changeset
|
319 featureRequestOptions["srsName"] = projection.getCode(); |
701
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
320 var featureRequest = new WFS().writeGetFeature(featureRequestOptions); |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
321 // DEBUG console.log(featureRequest); |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
322 HTTP.post( |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
323 endpoint, |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
324 new XMLSerializer().serializeToString(featureRequest), |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
325 { |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
326 headers: { |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
327 "X-Gemma-Auth": localStorage.getItem("token"), |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
328 "Content-type": "text/xml; charset=UTF-8" |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
329 } |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
330 } |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
331 ) |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
332 .then(response => { |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
333 var features = new GeoJSON().readFeatures( |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
334 JSON.stringify(response.data) |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
335 ); |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
336 vectorSource.addFeatures(features); |
754
105c421f99b1
refac: small improvements to code structure
Thomas Junk <thomas.junk@intevation.de>
parents:
752
diff
changeset
|
337 // console.log( |
105c421f99b1
refac: small improvements to code structure
Thomas Junk <thomas.junk@intevation.de>
parents:
752
diff
changeset
|
338 // "loaded", |
105c421f99b1
refac: small improvements to code structure
Thomas Junk <thomas.junk@intevation.de>
parents:
752
diff
changeset
|
339 // features.length, |
105c421f99b1
refac: small improvements to code structure
Thomas Junk <thomas.junk@intevation.de>
parents:
752
diff
changeset
|
340 // featureRequestOptions.featureTypes, |
105c421f99b1
refac: small improvements to code structure
Thomas Junk <thomas.junk@intevation.de>
parents:
752
diff
changeset
|
341 // "features" |
105c421f99b1
refac: small improvements to code structure
Thomas Junk <thomas.junk@intevation.de>
parents:
752
diff
changeset
|
342 // ); |
701
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
343 // DEBUG console.log("loaded ", features, "for", vectorSource); |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
344 // eslint-disable-next-line |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
709
diff
changeset
|
345 }) |
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
709
diff
changeset
|
346 .catch(() => { |
701
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
347 vectorSource.removeLoadedExtent(extent); |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
348 }); |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
349 }; |
8149772c62d6
client: add bbox loading strategy to riverkilometre
Bernhard Reiter <bernhard@intevation.de>
parents:
690
diff
changeset
|
350 return loader; |
842
ee6f127f573c
client: add first prototype for bottleneck iso layer
Bernhard Reiter <bernhard@intevation.de>
parents:
832
diff
changeset
|
351 }, |
860
38b682eaa7b1
client: add updateing of bottleneck filter
Bernhard Reiter <bernhard@intevation.de>
parents:
859
diff
changeset
|
352 updateBottleneckFilter(bottleneck_id, datestr) { |
38b682eaa7b1
client: add updateing of bottleneck filter
Bernhard Reiter <bernhard@intevation.de>
parents:
859
diff
changeset
|
353 console.log("updating filter with", bottleneck_id, datestr); |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
354 var layer = this.getLayerByName("Bottleneck isolines"); |
918
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
355 var wmsSrc = layer.data.getSource(); |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
356 |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
357 if (bottleneck_id != "does_not_exist") { |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
358 wmsSrc.updateParams({ |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
359 cql_filter: |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
360 "date_info='" + |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
361 datestr + |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
362 "' AND bottleneck_id='" + |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
363 bottleneck_id + |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
364 "'" |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
365 }); |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
366 layer.isVisible = true; |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
367 layer.data.setVisible(true); |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
368 } else { |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
369 layer.isVisible = false; |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
370 layer.data.setVisible(false); |
054561be4d68
Switch bottleneck isolines layer off, when selection is empty.
Sascha Wilde <wilde@intevation.de>
parents:
902
diff
changeset
|
371 } |
879
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
372 }, |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
373 onBeforePrint(/* evt */) { |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
374 // console.log("onBeforePrint(", evt ,")"); |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
375 // |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
376 // the following code shows how to get the current map canvas |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
377 // and change it, however this does not work well enough, as |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
378 // another mechanism seems to update the size again before the rendering |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
379 // for printing is done: |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
380 // console.log(this.openLayersMap.getViewport()); |
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
381 // var canvas = this.openLayersMap.getViewport().getElementsByTagName("canvas")[0]; |
879
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
382 // console.log(canvas); |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
383 // canvas.width=1000; |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
384 // canvas.height=1414; |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
385 // |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
386 // An experiment which also did not work: |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
387 // this.openLayersMap.setSize([1000, 1414]); // estimate portait DIN A4 |
879
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
388 // |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
389 // according to documentation |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
390 // http://openlayers.org/en/latest/apidoc/module-ol_PluggableMap-PluggableMap.html#updateSize |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
391 // "Force a recalculation of the map viewport size. This should be called when third-party code changes the size of the map viewport." |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
392 // but did not help |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
393 // this.openLayersMap.updateSize(); |
879
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
394 }, |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
395 onAfterPrint(/* evt */) { |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
396 // could be used to undo changes that have been done for printing |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
397 // though https://www.tjvantoll.com/2012/06/15/detecting-print-requests-with-javascript/ |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
398 // reported that this was not feasable (back then). |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
399 // console.log("onAfterPrint(", evt, ")"); |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
400 } |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
401 }, |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
402 watch: { |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
403 drawMode() { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
404 if (this.interaction) { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
405 this.removeCurrentInteraction(); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
406 } else { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
407 this.activateInteraction(); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
408 } |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
409 }, |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
410 split() { |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
411 const map = this.openLayersMap; |
594
6987b5c926b8
fix: leveraging vue.nexttick instead of timeout
Thomas Junk <thomas.junk@intevation.de>
parents:
593
diff
changeset
|
412 this.$nextTick(() => { |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
413 map.updateSize(); |
594
6987b5c926b8
fix: leveraging vue.nexttick instead of timeout
Thomas Junk <thomas.junk@intevation.de>
parents:
593
diff
changeset
|
414 }); |
860
38b682eaa7b1
client: add updateing of bottleneck filter
Bernhard Reiter <bernhard@intevation.de>
parents:
859
diff
changeset
|
415 }, |
38b682eaa7b1
client: add updateing of bottleneck filter
Bernhard Reiter <bernhard@intevation.de>
parents:
859
diff
changeset
|
416 selectedMorph(newSelectedMorph) { |
861
aa4aaf04d41e
client: improve update of bottleneck filters
Bernhard Reiter <bernhard@intevation.de>
parents:
860
diff
changeset
|
417 if (newSelectedMorph) { |
aa4aaf04d41e
client: improve update of bottleneck filters
Bernhard Reiter <bernhard@intevation.de>
parents:
860
diff
changeset
|
418 this.updateBottleneckFilter( |
aa4aaf04d41e
client: improve update of bottleneck filters
Bernhard Reiter <bernhard@intevation.de>
parents:
860
diff
changeset
|
419 newSelectedMorph.bottleneck_id, |
aa4aaf04d41e
client: improve update of bottleneck filters
Bernhard Reiter <bernhard@intevation.de>
parents:
860
diff
changeset
|
420 newSelectedMorph.date_info |
aa4aaf04d41e
client: improve update of bottleneck filters
Bernhard Reiter <bernhard@intevation.de>
parents:
860
diff
changeset
|
421 ); |
aa4aaf04d41e
client: improve update of bottleneck filters
Bernhard Reiter <bernhard@intevation.de>
parents:
860
diff
changeset
|
422 } else { |
aa4aaf04d41e
client: improve update of bottleneck filters
Bernhard Reiter <bernhard@intevation.de>
parents:
860
diff
changeset
|
423 this.updateBottleneckFilter("does_not_exist", "1999-10-01"); |
aa4aaf04d41e
client: improve update of bottleneck filters
Bernhard Reiter <bernhard@intevation.de>
parents:
860
diff
changeset
|
424 } |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
425 } |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
426 }, |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
427 mounted() { |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
428 this.createVectorSource(); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
429 this.createVectorLayer(); |
783
ab9604a46075
client: add move after clicking search result
Bernhard Reiter <bernhard@intevation.de>
parents:
782
diff
changeset
|
430 let map = new Map({ |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
431 layers: this.layerData, |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
432 target: "map", |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
433 controls: [], |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
434 view: new View({ |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
435 center: [this.long, this.lat], |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
436 zoom: this.zoom, |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
437 projection: this.projection |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
438 }) |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
439 }); |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
440 this.$store.commit("mapstore/setOpenLayersMap", map); |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
441 |
733
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
442 // TODO make display of layers more dynamic, e.g. from a list |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
443 |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
444 // loading the full WFS layer, by not setting the loader function |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
445 // and without bboxStrategy |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
446 var featureRequest2 = new WFS().writeGetFeature({ |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
447 srsName: "EPSG:3857", |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
448 featureNS: "gemma", |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
449 featurePrefix: "gemma", |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
450 featureTypes: ["fairway_dimensions"], |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
451 outputFormat: "application/json" |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
452 }); |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
453 |
733
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
454 // NOTE: loading the full fairway_dimensions makes sure |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
455 // that all are available for the intersection with the profile |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
456 HTTP.post( |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
457 "/internal/wfs", |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
458 new XMLSerializer().serializeToString(featureRequest2), |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
459 { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
460 headers: { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
461 "X-Gemma-Auth": localStorage.getItem("token"), |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
462 "Content-type": "text/xml; charset=UTF-8" |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
463 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
464 } |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
465 ).then(response => { |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
466 var features = new GeoJSON().readFeatures(JSON.stringify(response.data)); |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
467 var vectorSrc = this.getLayerByName( |
733
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
468 "Fairway Dimensions" |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
469 ).data.getSource(); |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
470 vectorSrc.addFeatures(features); |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
471 // would scale to the extend of all resulting features |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
472 // this.openLayersMap.getView().fit(vectorSrc.getExtent()); |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
473 }); |
620
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
474 |
733
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
475 // load following layers with bboxStrategy (using our request builder) |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
476 var layer = null; |
620
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
477 |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
478 layer = this.getLayerByName("Waterway Area"); |
733
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
479 layer.data.getSource().setLoader( |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
480 this.buildVectorLoader( |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
481 { |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
482 featurePrefix: "ws-wamos", |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
483 featureTypes: ["ienc_wtware"], |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
484 geometryName: "geom" |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
485 }, |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
486 "/external/d4d", |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
487 layer.data.getSource() |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
488 ) |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
489 ); |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
490 |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
491 layer = this.getLayerByName("Waterway Axis"); |
733
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
492 layer.data.getSource().setLoader( |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
493 this.buildVectorLoader( |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
494 { |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
495 featurePrefix: "ws-wamos", |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
496 featureTypes: ["ienc_wtwaxs"], |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
497 geometryName: "geom" |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
498 }, |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
499 "/external/d4d", |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
500 layer.data.getSource() |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
501 ) |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
502 ); |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
503 |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
504 layer = this.getLayerByName("Distance marks"); |
733
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
505 layer.data.getSource().setLoader( |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
506 this.buildVectorLoader( |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
507 { |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
508 featurePrefix: "ws-wamos", |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
509 featureTypes: ["ienc_dismar"], |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
510 geometryName: "geom" //, |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
511 /* restrict loading approximately to extend of danube in Austria */ |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
512 // filter: bboxFilter("geom", [13.3, 48.0, 17.1, 48.6], "EPSG:4326") |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
513 }, |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
514 "/external/d4d", |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
515 layer.data.getSource() |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
516 ) |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
517 ); |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
518 layer.data.setVisible(layer.isVisible); |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
519 |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
520 layer = this.getLayerByName("Distance marks, Axis"); |
733
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
521 layer.data.getSource().setLoader( |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
522 this.buildVectorLoader( |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
523 { |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
524 featureNS: "gemma", |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
525 featurePrefix: "gemma", |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
526 featureTypes: ["distance_marks_geoserver"], |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
527 geometryName: "geom" |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
528 }, |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
529 "/internal/wfs", |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
530 layer.data.getSource() |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
531 ) |
e57955c1996f
client: improve code structure
Bernhard Reiter <bernhard@intevation.de>
parents:
716
diff
changeset
|
532 ); |
745
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
533 |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
534 layer = this.getLayerByName("Waterway Area, named"); |
745
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
535 layer.data.getSource().setLoader( |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
536 this.buildVectorLoader( |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
537 { |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
538 featureNS: "gemma", |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
539 featurePrefix: "gemma", |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
540 featureTypes: ["hydro_seaare"], |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
541 geometryName: "geom" |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
542 }, |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
543 "/external/d4d", |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
544 layer.data.getSource() |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
545 ) |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
546 ); |
f2691e0d4970
client: add wfs layer for named waterway areas.
Bernhard Reiter <bernhard@intevation.de>
parents:
738
diff
changeset
|
547 layer.data.setVisible(layer.isVisible); |
764
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
548 |
957
93364f153da4
Backed out changeset c2b03f4755b6
Thomas Junk <thomas.junk@intevation.de>
parents:
956
diff
changeset
|
549 layer = this.getLayerByName("Bottlenecks"); |
790
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
550 layer.data.getSource().setLoader( |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
551 this.buildVectorLoader( |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
552 { |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
553 featureNS: "gemma", |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
554 featurePrefix: "gemma", |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
555 featureTypes: ["bottlenecks"], |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
556 geometryName: "area" |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
557 }, |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
558 "/internal/wfs", |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
559 layer.data.getSource() |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
560 ) |
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
561 ); |
858
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
562 HTTP.get("/system/style/Bottlenecks/stroke", { |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
563 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
564 }) |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
565 .then(response => { |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
566 this.btlnStrokeC = response.data.code; |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
567 HTTP.get("/system/style/Bottlenecks/fill", { |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
568 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
569 }) |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
570 .then(response => { |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
571 this.btlnFillC = response.data.code; |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
572 var newstyle = new Style({ |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
573 stroke: new Stroke({ |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
574 color: this.btlnStrokeC, |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
575 width: 4 |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
576 }), |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
577 fill: new Fill({ |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
578 color: this.btlnFillC |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
579 }) |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
580 }); |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
581 layer.data.setStyle(newstyle); |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
582 }) |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
583 .catch(error => { |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
584 console.log(error); |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
585 }); |
848
22f7d33eee65
Make eslint happy again.
Sascha Wilde <wilde@intevation.de>
parents:
843
diff
changeset
|
586 }) |
858
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
587 .catch(error => { |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
588 console.log(error); |
e5ac0fb0c1c5
map styling: Very ugly hack to read bottleneck style from server.
Sascha Wilde <wilde@intevation.de>
parents:
848
diff
changeset
|
589 }); |
790
1b82ae5e637e
client: add bottleneck layer with first styling
Bernhard Reiter <bernhard@intevation.de>
parents:
783
diff
changeset
|
590 |
879
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
591 window.addEventListener("beforeprint", this.onBeforePrint); |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
592 window.addEventListener("afterprint", this.onAfterPrint); |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
865
diff
changeset
|
593 |
842
ee6f127f573c
client: add first prototype for bottleneck iso layer
Bernhard Reiter <bernhard@intevation.de>
parents:
832
diff
changeset
|
594 // so none is shown |
938
fe923c8ef08f
client: add static legend image to contour_lines
Bernhard Reiter <bernhard@intevation.de>
parents:
918
diff
changeset
|
595 this.updateBottleneckFilter("does_not_exist", "1999-10-01"); |
764
a6a8fe89eb84
client: add hooks for identify mode
Bernhard Reiter <bernhard@intevation.de>
parents:
754
diff
changeset
|
596 this.activateIdentifyMode(); |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
597 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
598 }; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
599 </script> |