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