diff client/src/components/map/Maplayer.vue @ 1435:7fa030127b05

fixed panning problem Drawend was triggered before click event, causing the cutTool to be always already disabled when the identify tool was triggered.
author Markus Kottlaender <markus@intevation.de>
date Fri, 30 Nov 2018 08:26:13 +0100
parents 4afbc615cfc2
children bb47531bdd22
line wrap: on
line diff
--- a/client/src/components/map/Maplayer.vue	Fri Nov 30 07:10:13 2018 +0100
+++ b/client/src/components/map/Maplayer.vue	Fri Nov 30 08:26:13 2018 +0100
@@ -43,7 +43,6 @@
 import { Map, View } from "ol";
 import { WFS, GeoJSON } from "ol/format.js";
 import { Stroke, Style, Fill } from "ol/style.js";
-import { getCenter } from "ol/extent";
 
 /* for the sake of debugging */
 /* eslint-disable no-console */
@@ -82,66 +81,6 @@
     }
   },
   methods: {
-    identify(coordinate, pixel) {
-      if (!this.hasActiveInteractions) {
-        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
-              });
-            }
-          }
-        }
-
-        // 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.getVSourceByName("Inland ECDIS chart Danube");
-        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);
-        }
-      }
-    },
     buildVectorLoader(featureRequestOptions, endpoint, vectorSource) {
       // build a function to be used for VectorSource.setLoader()
       // make use of WFS().writeGetFeature to build the request
@@ -424,9 +363,7 @@
 
     // so none is shown
     this.updateBottleneckFilter("does_not_exist", "1999-10-01");
-    this.openLayersMap.on(["singleclick", "dblclick"], event => {
-      this.identify(event.coordinate, event.pixel);
-    });
+    this.$store.dispatch("map/enableIdentifyTool");
     this.$store.dispatch("bottlenecks/loadBottlenecks");
   }
 };