Mercurial > gemma
comparison client/src/components/importoverview/FairwayDimensionDetail.vue @ 4336:45307cf4931a
Review of fairway dimensions
In order to review fairway dimensions, the ids from the summary are used to retrieve
the according features from the geoserver. Then instances of the type Feature are
generated with the information given from the geoserver. These are then added
to the VectorSource layer and should be displayed.
Currently the display doesn't work.
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Thu, 05 Sep 2019 15:52:43 +0200 |
parents | edc2633c3cc6 |
children | e9d2573329da |
comparison
equal
deleted
inserted
replaced
4335:2f212f520a04 | 4336:45307cf4931a |
---|---|
14 * Software engineering by Intevation GmbH | 14 * Software engineering by Intevation GmbH |
15 * | 15 * |
16 * Author(s): | 16 * Author(s): |
17 * Thomas Junk <thomas.junk@intevation.de> | 17 * Thomas Junk <thomas.junk@intevation.de> |
18 */ | 18 */ |
19 export default {}; | 19 import { HTTP } from "@/lib/http"; |
20 import { WFS } from "ol/format"; | |
21 import { or as orFilter, equalTo as equalToFilter } from "ol/format/filter"; | |
22 //import { displayError } from "@/lib/errors"; | |
23 import { mapGetters } from "vuex"; | |
24 import Feature from "ol/Feature"; | |
25 import Polygon from "ol/geom/Polygon"; | |
26 | |
27 const getFromWFS = (type, filter) => { | |
28 return new Promise((resolve, reject) => { | |
29 var featureCollectionRequest = new WFS().writeGetFeature({ | |
30 srsName: "EPSG:4326", | |
31 featureNS: "gemma", | |
32 featurePrefix: "gemma", | |
33 featureTypes: [type], | |
34 outputFormat: "application/json", | |
35 filter: filter | |
36 }); | |
37 HTTP.post( | |
38 "/internal/wfs", | |
39 new XMLSerializer().serializeToString(featureCollectionRequest), | |
40 { | |
41 headers: { | |
42 "X-Gemma-Auth": localStorage.getItem("token"), | |
43 "Content-type": "text/xml; charset=UTF-8" | |
44 } | |
45 } | |
46 ) | |
47 .then(response => { | |
48 resolve(response); | |
49 }) | |
50 .catch(error => { | |
51 reject(error); | |
52 }); | |
53 }); | |
54 }; | |
55 | |
56 export default { | |
57 props: ["summary"], | |
58 mounted() { | |
59 const ids = this.fairWayDimensionIDs.map(id => { | |
60 return equalToFilter("id", id); | |
61 }); | |
62 getFromWFS("fairway_dimensions", orFilter(...ids)).then(response => { | |
63 let { features } = response.data; | |
64 const fairwaydimensionLayer = this.openLayersMap().getLayer( | |
65 "FDREVIEWLAYER" | |
66 ); | |
67 features = features.map(f => { | |
68 let result = new Feature({ | |
69 geometry: new Polygon(f.geometry.coordinates) | |
70 }); | |
71 result.setId(f.id); | |
72 return result; | |
73 }); | |
74 fairwaydimensionLayer.setVisible(true); | |
75 fairwaydimensionLayer.getSource().addFeatures(features); | |
76 }); | |
77 }, | |
78 computed: { | |
79 ...mapGetters("map", ["openLayersMap"]), | |
80 fairWayDimensionIDs() { | |
81 return this.summary["fd-area"].map(e => e.id); | |
82 } | |
83 } | |
84 }; | |
20 </script> | 85 </script> |