changeset 4525:9887061df57b

Use CQL filter to load the current survey difference.
author Raimund Renkert <raimund@renkert.org>
date Mon, 07 Oct 2019 14:22:35 +0200
parents 7cca4aa9a04a
children b3261790a9b2
files client/src/components/fairway/BottleneckDialogue.vue client/src/components/map/layers.js client/src/store/fairwayprofile.js
diffstat 3 files changed, 28 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/fairway/BottleneckDialogue.vue	Mon Oct 07 13:30:55 2019 +0200
+++ b/client/src/components/fairway/BottleneckDialogue.vue	Mon Oct 07 14:22:35 2019 +0200
@@ -380,6 +380,7 @@
       "endPoint",
       "profileLoading",
       "differencesLoading",
+      "currentDifference",
       "waterLevels",
       "currentProfile"
     ]),
@@ -572,7 +573,27 @@
           }
         }
       )
-        .then()
+        .then(response => {
+          this.$store.commit(
+            "fairwayprofile/setCurrentDifference",
+            response.data.id
+          );
+          if (this.openLayersMap(COMPARESURVEYS.compare.id)) {
+            this.openLayersMap(COMPARESURVEYS.compare.id)
+              .getLayer("DIFFERENCES")
+              .getSource()
+              .updateParams({
+                LAYERS: "sounding_differences",
+                VERSION: "1.1.1",
+                TILED: true,
+                CQL_FILTER: "id=" + response.data.id
+              });
+            this.openLayersMap(COMPARESURVEYS.compare.id)
+              .getLayer("DIFFERENCES")
+              .getSource()
+              .refresh();
+          }
+        })
         .catch(error => {
           let status, data, message;
           if (error.response) {
--- a/client/src/components/map/layers.js	Mon Oct 07 13:30:55 2019 +0200
+++ b/client/src/components/map/layers.js	Mon Oct 07 14:22:35 2019 +0200
@@ -492,7 +492,8 @@
             params: {
               LAYERS: "sounding_differences",
               VERSION: "1.1.1",
-              TILED: true
+              TILED: true,
+              CQL_FILTER: "id=" + store.state.fairwayprofile.currentDifference
             },
             tileLoadFunction: function(tile, src) {
               HTTP.get(src, {
--- a/client/src/store/fairwayprofile.js	Mon Oct 07 13:30:55 2019 +0200
+++ b/client/src/store/fairwayprofile.js	Mon Oct 07 14:22:35 2019 +0200
@@ -36,6 +36,7 @@
     profileLoading: false,
     selectedCut: null,
     differencesLoading: false,
+    currentDifference: null,
     depth: 2.5,
     useCustomDepth: true
   };
@@ -72,6 +73,9 @@
     setDifferencesLoading: (state, value) => {
       state.differencesLoading = value;
     },
+    setCurrentDifference: (state, value) => {
+      state.currentDifference = value;
+    },
     profileLoaded: (state, answer) => {
       const { response, surveyDate } = answer;
       const { data } = response;