Mercurial > gemma
annotate client/src/map/Maplayer.vue @ 649:83081ba6c9c1
feat: Linetool added
In order to draw lines for allocating profiles,
a basic implementation of line drawing was added.
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Thu, 13 Sep 2018 16:55:53 +0200 |
parents | 855cca0142ec |
children | ef658c66cfca |
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 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
13 </style> |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
14 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
15 <script> |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
16 import { HTTP } from "../application/lib/http"; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
17 import "ol/ol.css"; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
18 import { Map, View } from "ol"; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
19 // needed for vector filter example |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
20 // import { greaterThan as greaterThanFilter } from "ol/format/filter.js"; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
21 import { WFS, GeoJSON } from "ol/format.js"; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
22 import { mapGetters } from "vuex"; |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
23 import Draw from "ol/interaction/Draw.js"; |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
24 import { Vector as VectorSource } from "ol/source.js"; |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
25 import { Vector as VectorLayer } from "ol/layer.js"; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
26 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
27 export default { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
28 name: "maplayer", |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
29 props: ["drawMode", "lat", "long", "zoom", "split"], |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
30 data() { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
31 return { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
32 projection: "EPSG:3857", |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
33 openLayersMap: null, |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
34 interaction: null, |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
35 vectorLayer: null, |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
36 vectorSource: null |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
37 }; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
38 }, |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
39 computed: { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
40 ...mapGetters("mapstore", ["layers"]), |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
41 mapStyle() { |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
42 return { |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
43 mapfull: !this.split, |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
44 mapsplit: this.split |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
45 }; |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
46 }, |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
47 layerData() { |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
48 const l = this.layers.map(x => { |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
49 return x.data; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
50 }); |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
51 return [...l, this.vectorLayer]; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
52 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
53 }, |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
54 methods: { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
55 createVectorSource() { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
56 this.vectorSource = new VectorSource({ wrapX: false }); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
57 }, |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
58 createVectorLayer() { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
59 this.vectorLayer = new VectorLayer({ |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
60 source: this.vectorSource |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
61 }); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
62 }, |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
63 removeCurrentInteraction() { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
64 this.openLayersMap.removeInteraction(this.interaction); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
65 this.interaction = null; |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
66 }, |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
67 createInteraction() { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
68 return new Draw({ |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
69 source: this.vectorSource, |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
70 type: this.drawMode |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
71 }); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
72 }, |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
73 activateInteraction() { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
74 const interaction = this.createInteraction(this.drawMode); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
75 this.interaction = interaction; |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
76 this.openLayersMap.addInteraction(interaction); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
77 } |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
78 }, |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
79 watch: { |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
80 drawMode() { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
81 if (this.interaction) { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
82 this.removeCurrentInteraction(); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
83 } else { |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
84 this.activateInteraction(); |
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 }, |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
87 split() { |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
88 const map = this.openLayersMap; |
594
6987b5c926b8
fix: leveraging vue.nexttick instead of timeout
Thomas Junk <thomas.junk@intevation.de>
parents:
593
diff
changeset
|
89 this.$nextTick(() => { |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
90 map.updateSize(); |
594
6987b5c926b8
fix: leveraging vue.nexttick instead of timeout
Thomas Junk <thomas.junk@intevation.de>
parents:
593
diff
changeset
|
91 }); |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
92 } |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
93 }, |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
94 mounted() { |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
95 this.createVectorSource(); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
96 this.createVectorLayer(); |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
97 this.openLayersMap = new Map({ |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
98 layers: this.layerData, |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
99 target: "map", |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
100 controls: [], |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
101 view: new View({ |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
102 center: [this.long, this.lat], |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
103 zoom: this.zoom, |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
104 projection: this.projection |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
105 }) |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
106 }); |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
107 |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
108 var featureRequest2 = new WFS().writeGetFeature({ |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
109 // srsName: "urn:ogc:def:crs:EPSG::4326", |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
110 srsName: "EPSG:3857", |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
111 featureNS: "gemma", |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
112 featurePrefix: "gemma", |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
113 featureTypes: ["fairway_dimensions"], |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
114 outputFormat: "application/json" |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
115 // example for a filter |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
116 //filter: greaterThanFilter("level_of_service", 0) |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
117 }); |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
118 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
119 HTTP.post( |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
120 "/internal/wfs", |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
121 new XMLSerializer().serializeToString(featureRequest2), |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
122 { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
123 headers: { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
124 "X-Gemma-Auth": localStorage.getItem("token"), |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
125 "Content-type": "text/xml; charset=UTF-8" |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
126 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
127 } |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
128 ).then(response => { |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
129 var features = new GeoJSON().readFeatures(JSON.stringify(response.data)); |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
130 var vectorSrc = this.layers[2].data.getSource(); |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
131 vectorSrc.addFeatures(features); |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
132 // would scale to the extend of all resulting features |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
133 // this.openLayersMap.getView().fit(vectorSrc.getExtent()); |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
134 }); |
620
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
135 |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
136 // FIXME hardwired for now |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
137 var featureRequest3 = new WFS().writeGetFeature({ |
620
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
138 featurePrefix: "ws-wamos", |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
139 featureTypes: ["ienc_wtware"], |
620
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
140 outputFormat: "application/json" |
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
141 }); |
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
142 |
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
143 HTTP.post( |
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
144 "/external/d4d", |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
145 new XMLSerializer().serializeToString(featureRequest3), |
620
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
146 { |
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
147 headers: { |
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
148 "X-Gemma-Auth": localStorage.getItem("token"), |
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
149 "Content-type": "text/xml; charset=UTF-8" |
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
150 } |
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
151 } |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
152 ).then(response => { |
620
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
153 var features = new GeoJSON().readFeatures(JSON.stringify(response.data)); |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
154 var vectorSrc = this.layers[3].data.getSource(); |
620
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
155 vectorSrc.addFeatures(features); |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
156 }); |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
157 |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
158 // FIXME hardwired for now |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
159 var featureRequest4 = new WFS().writeGetFeature({ |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
160 featurePrefix: "ws-wamos", |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
161 featureTypes: ["ienc_wtwaxs"], |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
162 outputFormat: "application/json" |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
163 }); |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
164 |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
165 HTTP.post( |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
166 "/external/d4d", |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
167 new XMLSerializer().serializeToString(featureRequest4), |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
168 { |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
169 headers: { |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
170 "X-Gemma-Auth": localStorage.getItem("token"), |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
171 "Content-type": "text/xml; charset=UTF-8" |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
172 } |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
173 } |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
174 ).then(response => { |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
175 var features = new GeoJSON().readFeatures(JSON.stringify(response.data)); |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
176 var vectorSrc = this.layers[4].data.getSource(); |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
177 vectorSrc.addFeatures(features); |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
178 }); |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
179 |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
180 // FIXME this is hardwired for now to try for an external point layer |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
181 var featureRequest5 = new WFS().writeGetFeature({ |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
182 featurePrefix: "ws-wamos", |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
183 featureTypes: ["ienc_dismar"], |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
184 outputFormat: "application/json" |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
185 }); |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
186 |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
187 HTTP.post( |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
188 "/external/d4d", |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
189 new XMLSerializer().serializeToString(featureRequest5), |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
190 { |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
191 headers: { |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
192 "X-Gemma-Auth": localStorage.getItem("token"), |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
193 "Content-type": "text/xml; charset=UTF-8" |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
194 } |
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
195 } |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
196 ).then(response => { |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
197 var features = new GeoJSON().readFeatures(JSON.stringify(response.data)); |
649
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
198 var vectorSrc = this.layers[5].data.getSource(); |
83081ba6c9c1
feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents:
630
diff
changeset
|
199 this.layers[5].data.setVisible(this.layers[5].isVisible); |
628
ef9c733cc6aa
client: show more wfs layers
Bernhard Reiter <bernhard@intevation.de>
parents:
626
diff
changeset
|
200 vectorSrc.addFeatures(features); |
620
ef00684e021f
client: add showing special buoys
Bernhard Reiter <bernhard@intevation.de>
parents:
594
diff
changeset
|
201 }); |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
202 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
203 }; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
204 </script> |