# HG changeset patch # User Markus Kottlaender # Date 1542117012 -3600 # Node ID c8c26912754ca04181b601c17bba1f747f321177 # Parent f498494fceb55eee14a4bdcc2f3992756f1ea8cd disable identifying when draw/cut mode are active diff -r f498494fceb5 -r c8c26912754c client/src/map/Maplayer.vue --- 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) {