changeset 1160:c8c26912754c

disable identifying when draw/cut mode are active
author Markus Kottlaender <markus@intevation.de>
date Tue, 13 Nov 2018 14:50:12 +0100
parents f498494fceb5
children fae17a9dee9e
files client/src/map/Maplayer.vue
diffstat 1 files changed, 52 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/map/Maplayer.vue	Tue Nov 13 14:44:20 2018 +0100
+++ b/client/src/map/Maplayer.vue	Tue Nov 13 14:50:12 2018 +0100
@@ -59,7 +59,7 @@
   },
   computed: {
     ...mapGetters("map", ["getLayerByName"]),
-    ...mapState("map", ["layers", "openLayersMap"]),
+    ...mapState("map", ["layers", "openLayersMap", "drawMode", "cutMode"]),
     ...mapState("bottlenecks", ["selectedSurvey"]),
     mapStyle() {
       return {
@@ -70,63 +70,65 @@
   },
   methods: {
     identify(coordinate, pixel) {
-      this.$store.commit("map/setIdentifiedFeatures", []);
-      // checking our WFS layers
-      var features = this.openLayersMap.getFeaturesAtPixel(pixel);
-      if (features) {
-        this.$store.commit("map/setIdentifiedFeatures", features);
+      if (!this.drawMode && !this.cutMode) {
+        this.$store.commit("map/setIdentifiedFeatures", []);
+        // checking our WFS layers
+        var features = this.openLayersMap.getFeaturesAtPixel(pixel);
+        if (features) {
+          this.$store.commit("map/setIdentifiedFeatures", features);
 
-        // get selected bottleneck from identified features
-        for (let feature of features) {
-          let id = feature.getId();
-          // RegExp.prototype.test() works with number, str and undefined
-          if (/^bottlenecks\./.test(id)) {
-            this.$store.dispatch(
-              "bottlenecks/setSelectedBottleneck",
-              feature.get("objnam")
-            );
-            this.$store.commit("map/moveMap", {
-              coordinates: getCenter(
-                feature
-                  .getGeometry()
-                  .clone()
-                  .transform("EPSG:3857", "EPSG:4326")
-                  .getExtent()
-              ),
-              zoom: 17,
-              preventZoomOut: true
-            });
+          // get selected bottleneck from identified features
+          for (let feature of features) {
+            let id = feature.getId();
+            // RegExp.prototype.test() works with number, str and undefined
+            if (/^bottlenecks\./.test(id)) {
+              this.$store.dispatch(
+                "bottlenecks/setSelectedBottleneck",
+                feature.get("objnam")
+              );
+              this.$store.commit("map/moveMap", {
+                coordinates: getCenter(
+                  feature
+                    .getGeometry()
+                    .clone()
+                    .transform("EPSG:3857", "EPSG:4326")
+                    .getExtent()
+                ),
+                zoom: 17,
+                preventZoomOut: true
+              });
+            }
           }
         }
-      }
 
-      // DEBUG output and example how to remove the GeometryName
-      /*
-      for (let feature of features) {
-        console.log("Identified:", feature.getId());
-        for (let key of feature.getKeys()) {
-          if (key != feature.getGeometryName()) {
-            console.log(key, feature.get(key));
+        // DEBUG output and example how to remove the GeometryName
+        /*
+        for (let feature of features) {
+          console.log("Identified:", feature.getId());
+          for (let key of feature.getKeys()) {
+            if (key != feature.getGeometryName()) {
+              console.log(key, feature.get(key));
+            }
           }
         }
-      }
-      */
+        */
 
-      // trying the GetFeatureInfo way for WMS
-      var wmsSource = this.getLayerByName(
-        "Inland ECDIS chart Danube"
-      ).data.getSource();
-      var url = wmsSource.getGetFeatureInfoUrl(
-        coordinate,
-        100 /* resolution */,
-        "EPSG:3857",
-        // { INFO_FORMAT: "application/vnd.ogc.gml" } // not allowed by d4d
-        { INFO_FORMAT: "text/plain" }
-      );
+        // trying the GetFeatureInfo way for WMS
+        var wmsSource = this.getLayerByName(
+          "Inland ECDIS chart Danube"
+        ).data.getSource();
+        var url = wmsSource.getGetFeatureInfoUrl(
+          coordinate,
+          100 /* resolution */,
+          "EPSG:3857",
+          // { INFO_FORMAT: "application/vnd.ogc.gml" } // not allowed by d4d
+          { INFO_FORMAT: "text/plain" }
+        );
 
-      if (url) {
-        // cannot directly query here because of SOP
-        console.log("GetFeatureInfo url:", url);
+        if (url) {
+          // cannot directly query here because of SOP
+          console.log("GetFeatureInfo url:", url);
+        }
       }
     },
     buildVectorLoader(featureRequestOptions, endpoint, vectorSource) {