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