changeset 1103:dfe3966bb308

removed unnecessary methods and renamed variable Those three methods were only used onced and can be inlined. The 2 in featureRequest2 was confusing because there is no featureRequest(1) in the same scope.
author Markus Kottlaender <markus@intevation.de>
date Fri, 02 Nov 2018 11:04:46 +0100
parents 67e9355e7a58
children 9c15e3bf8066
files client/src/map/Maplayer.vue
diffstat 1 files changed, 8 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/map/Maplayer.vue	Fri Nov 02 08:32:58 2018 +0100
+++ b/client/src/map/Maplayer.vue	Fri Nov 02 11:04:46 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();
@@ -419,10 +404,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 +425,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 +437,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"),