changeset 1105:9f1e1f3f3fb3

merge
author Markus Kottlaender <markus@intevation.de>
date Fri, 02 Nov 2018 14:24:49 +0100
parents 9c15e3bf8066 (diff) 87eba533fa2f (current diff)
children ca4e0cd607ce
files
diffstat 1 files changed, 11 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/map/Maplayer.vue	Fri Nov 02 10:59:49 2018 +0100
+++ b/client/src/map/Maplayer.vue	Fri Nov 02 14:24:49 2018 +0100
@@ -80,18 +80,9 @@
         mapfull: !this.split,
         mapsplit: this.split
       };
-    },
-    layerData() {
-      const l = this.layers.map(x => {
-        return x.data;
-      });
-      return [...l, this.vectorLayer];
     }
   },
   methods: {
-    createVectorSource() {
-      this.vectorSource = new VectorSource({ wrapX: false });
-    },
     drawStyleFunction(feature) {
       // adapted from OpenLayer's LineString Arrow Example
       var geometry = feature.getGeometry();
@@ -132,12 +123,6 @@
       }
       return styles;
     },
-    createVectorLayer() {
-      this.vectorLayer = new VectorLayer({
-        source: this.vectorSource,
-        style: this.drawStyleFunction
-      });
-    },
     removeCurrentInteraction() {
       this.$store.commit("identifystore/setCurrentMeasurement", null);
       this.vectorSource.clear();
@@ -256,14 +241,6 @@
       this.interaction = interaction;
       this.openLayersMap.addInteraction(interaction);
     },
-    activateIdentifyMode() {
-      this.openLayersMap.on("singleclick", event => {
-        this.identify(event.coordinate, event.pixel);
-      });
-      this.openLayersMap.on("dblclick", event => {
-        this.identify(event.coordinate, event.pixel);
-      });
-    },
     identify(coordinate, pixel) {
       this.$store.commit("identifystore/setIdentifiedFeatures", []);
       // checking our WFS layers
@@ -419,10 +396,13 @@
     }
   },
   mounted() {
-    this.createVectorSource();
-    this.createVectorLayer();
+    this.vectorSource = new VectorSource({ wrapX: false });
+    this.vectorLayer = new VectorLayer({
+      source: this.vectorSource,
+      style: this.drawStyleFunction
+    });
     let map = new Map({
-      layers: this.layerData,
+      layers: [...this.layers.map(x => x.data), this.vectorLayer],
       target: "map",
       controls: [],
       view: new View({
@@ -437,7 +417,7 @@
 
     // loading the full WFS layer, by not setting the loader function
     // and without bboxStrategy
-    var featureRequest2 = new WFS().writeGetFeature({
+    var featureRequest = new WFS().writeGetFeature({
       srsName: "EPSG:3857",
       featureNS: "gemma",
       featurePrefix: "gemma",
@@ -449,7 +429,7 @@
     //       that all are available for the intersection with the profile
     HTTP.post(
       "/internal/wfs",
-      new XMLSerializer().serializeToString(featureRequest2),
+      new XMLSerializer().serializeToString(featureRequest),
       {
         headers: {
           "X-Gemma-Auth": localStorage.getItem("token"),
@@ -587,7 +567,9 @@
 
     // so none is shown
     this.updateBottleneckFilter("does_not_exist", "1999-10-01");
-    this.activateIdentifyMode();
+    this.openLayersMap.on(["singleclick", "dblclick"], event => {
+      this.identify(event.coordinate, event.pixel);
+    });
   }
 };
 </script>