changeset 1112:2c3d32322126 store-refactoring

moved identifystore properties to mapstore
author Markus Kottlaender <markus@intevation.de>
date Mon, 05 Nov 2018 13:32:10 +0100
parents f106aee673e7
children 595654ad3f66
files client/src/identify/Identify.vue client/src/linetool/Linetool.vue client/src/map/Maplayer.vue client/src/store.js client/src/store/identify.js client/src/store/map.js
diffstat 6 files changed, 17 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/identify/Identify.vue	Mon Nov 05 13:12:33 2018 +0100
+++ b/client/src/identify/Identify.vue	Mon Nov 05 13:32:10 2018 +0100
@@ -109,7 +109,7 @@
   },
   computed: {
     ...mapGetters("application", ["versionStr"]),
-    ...mapState("identifystore", ["identifiedFeatures", "currentMeasurement"]),
+    ...mapState("mapstore", ["identifiedFeatures", "currentMeasurement"]),
     identifyStyle() {
       return {
         "ui-element": true,
--- a/client/src/linetool/Linetool.vue	Mon Nov 05 13:12:33 2018 +0100
+++ b/client/src/linetool/Linetool.vue	Mon Nov 05 13:32:10 2018 +0100
@@ -54,7 +54,7 @@
   },
   computed: {
     ...mapState("application", ["drawMode"]),
-    ...mapState("identifystore", ["identifiedFeatures"]),
+    ...mapState("mapstore", ["identifiedFeatures"]),
     ...mapState("bottlenecks", ["selectedSurvey"]),
     icon() {
       return {
--- a/client/src/map/Maplayer.vue	Mon Nov 05 13:12:33 2018 +0100
+++ b/client/src/map/Maplayer.vue	Mon Nov 05 13:32:10 2018 +0100
@@ -124,7 +124,7 @@
       return styles;
     },
     removeCurrentInteraction() {
-      this.$store.commit("identifystore/setCurrentMeasurement", null);
+      this.$store.commit("mapstore/setCurrentMeasurement", null);
       this.vectorSource.clear();
       this.openLayersMap.removeInteraction(this.interaction);
       this.interaction = null;
@@ -138,7 +138,7 @@
       });
       draw.on("drawstart", () => {
         this.vectorSource.clear();
-        this.$store.commit("identifystore/setCurrentMeasurement", null);
+        this.$store.commit("mapstore/setCurrentMeasurement", null);
         // we are not setting an id here, to avoid the regular identify to
         // pick it up
         // event.feature.setId("drawn.1"); // unique id for new feature
@@ -152,14 +152,14 @@
         // also place the a rounded areaSize in a property,
         // so identify will show it
         if (areaSize > 100000) {
-          this.$store.commit("identifystore/setCurrentMeasurement", {
+          this.$store.commit("mapstore/setCurrentMeasurement", {
             quantity: "Area",
             unitSymbol: "km²",
             // convert into 1 km² == 1000*1000 m² and round to 1000 m²
             value: Math.round(areaSize / 1000) / 1000
           });
         } else {
-          this.$store.commit("identifystore/setCurrentMeasurement", {
+          this.$store.commit("mapstore/setCurrentMeasurement", {
             quantity: "Area",
             unitSymbol: "m²",
             value: Math.round(areaSize)
@@ -168,7 +168,7 @@
       }
       if (this.drawMode === "LineString") {
         const length = getLength(event.feature.getGeometry());
-        this.$store.commit("identifystore/setCurrentMeasurement", {
+        this.$store.commit("mapstore/setCurrentMeasurement", {
           quantity: "Length",
           unitSymbol: "m",
           value: Math.round(length * 10) / 10
@@ -242,11 +242,11 @@
       this.openLayersMap.addInteraction(interaction);
     },
     identify(coordinate, pixel) {
-      this.$store.commit("identifystore/setIdentifiedFeatures", []);
+      this.$store.commit("mapstore/setIdentifiedFeatures", []);
       // checking our WFS layers
       var features = this.openLayersMap.getFeaturesAtPixel(pixel);
       if (features) {
-        this.$store.commit("identifystore/setIdentifiedFeatures", features);
+        this.$store.commit("mapstore/setIdentifiedFeatures", features);
         
         // get selected bottleneck from identified features
         for (let feature of features) {
--- a/client/src/store.js	Mon Nov 05 13:12:33 2018 +0100
+++ b/client/src/store.js	Mon Nov 05 13:32:10 2018 +0100
@@ -21,7 +21,6 @@
 import usermanagement from "./store/usermanagement";
 import mapstore from "./store/map";
 import FairwayProfile from "./store/fairway";
-import IdentifyStore from "./store/identify";
 import Bottlenecks from "./store/bottlenecks";
 
 Vue.use(Vuex);
@@ -30,7 +29,6 @@
   modules: {
     application: Application,
     fairwayprofile: FairwayProfile,
-    identifystore: IdentifyStore,
     bottlenecks: Bottlenecks,
     mapstore: mapstore,
     user: user,
--- a/client/src/store/identify.js	Mon Nov 05 13:12:33 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
- * This is Free Software under GNU Affero General Public License v >= 3.0
- * without warranty, see README.md and license for details.
- * 
- * SPDX-License-Identifier: AGPL-3.0-or-later
- * License-Filename: LICENSES/AGPL-3.0.txt
- * 
- * Copyright (C) 2018 by via donau 
- *   – Österreichische Wasserstraßen-Gesellschaft mbH
- * Software engineering by Intevation GmbH
- * 
- * Author(s):
- * Thomas Junk <thomas.junk@intevation.de>
- */
-
-// note that some identified features may not have an id
-// especially related to drawing in our own vector layer
-
-const IndentifyStore = {
-  namespaced: true,
-  state: {
-    identifiedFeatures: [],
-    currentMeasurement: null
-  },
-  getters: {
-    identifiedFeatures: state => {
-      return state.identifiedFeatures;
-    },
-    currentMeasurement: state => {
-      return state.currentMeasurement;
-    }
-  },
-  mutations: {
-    setIdentifiedFeatures: (state, identifiedFeatures) => {
-      state.identifiedFeatures = identifiedFeatures;
-    },
-    setCurrentMeasurement: (state, measurement) => {
-      state.currentMeasurement = measurement;
-    }
-  }
-};
-
-export default IndentifyStore;
--- a/client/src/store/map.js	Mon Nov 05 13:12:33 2018 +0100
+++ b/client/src/store/map.js	Mon Nov 05 13:32:10 2018 +0100
@@ -27,6 +27,8 @@
   namespaced: true,
   state: {
     openLayersMap: null,
+    identifiedFeatures: [],
+    currentMeasurement: null,
     layers: [
       {
         name: "Open Streetmap",
@@ -228,6 +230,12 @@
     },
     setOpenLayersMap: (state, map) => {
       state.openLayersMap = map;
+    },
+    setIdentifiedFeatures: (state, identifiedFeatures) => {
+      state.identifiedFeatures = identifiedFeatures;
+    },
+    setCurrentMeasurement: (state, measurement) => {
+      state.currentMeasurement = measurement;
     }
   }
 };