# HG changeset patch # User Bernhard Reiter # Date 1537946009 -7200 # Node ID c12ec7fde3f28efb7c35778fb9e15a405e5b4371 # Parent ba2007b746ef55647f83a2a6fedc717b54ce1793 client: add simple identify top area box * Add Identify.vue as a top area box that display the currently identified features in a short text-only way. This can be styled further, also the box is not yet resized dynamically. Put in to subdir layers because it is closest to Layers.vue, which was used as a template. * Introduce a new mapstore/identifiedFeatures state. diff -r ba2007b746ef -r c12ec7fde3f2 client/src/application/Topbar.vue --- a/client/src/application/Topbar.vue Tue Sep 25 21:51:53 2018 +0200 +++ b/client/src/application/Topbar.vue Wed Sep 26 09:13:29 2018 +0200 @@ -17,6 +17,9 @@
+
+ +
@@ -84,10 +87,12 @@ diff -r ba2007b746ef -r c12ec7fde3f2 client/src/map/Maplayer.vue --- a/client/src/map/Maplayer.vue Tue Sep 25 21:51:53 2018 +0200 +++ b/client/src/map/Maplayer.vue Wed Sep 26 09:13:29 2018 +0200 @@ -48,7 +48,11 @@ }; }, computed: { - ...mapGetters("mapstore", ["layers", "getLayerByName"]), + ...mapGetters("mapstore", [ + "layers", + "getLayerByName", + "identifiedFeatures" + ]), mapStyle() { return { mapfull: !this.split, @@ -196,8 +200,13 @@ }); }, identify(coordinate, pixel) { + this.$store.commit("mapstore/setIdentifiedFeatures", []); // checking our WFS layers var features = this.openLayersMap.getFeaturesAtPixel(pixel); + this.$store.commit("mapstore/setIdentifiedFeatures", features); + + // 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()) { @@ -206,6 +215,7 @@ } } } + */ // trying the GetFeatureInfo way for WMS var wmsSource = this.getLayerByName( diff -r ba2007b746ef -r c12ec7fde3f2 client/src/map/store.js --- a/client/src/map/store.js Tue Sep 25 21:51:53 2018 +0200 +++ b/client/src/map/store.js Wed Sep 26 09:13:29 2018 +0200 @@ -147,7 +147,8 @@ }), isVisible: true } - ] + ], + identifiedFeatures: [] }, getters: { layers: state => { @@ -155,12 +156,18 @@ }, getLayerByName: state => name => { return state.layers.find(layer => layer.name === name); + }, + identifiedFeatures: state => { + return state.identifiedFeatures; } }, mutations: { toggleVisibility: (state, layer) => { state.layers[layer].isVisible = !state.layers[layer].isVisible; state.layers[layer].data.setVisible(state.layers[layer].isVisible); + }, + setIdentifiedFeatures: (state, identifiedFeatures) => { + state.identifiedFeatures = identifiedFeatures; } } };