changeset 4008:224ee5a3acb1

Layerselect: when no bottleneck/no survey is selected, both ISOLINE and DIFFERENCES layer are activated with cql filter for bottleneck_id=NO_BOTTLENECK_SELECTED
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 19 Jul 2019 11:04:24 +0200
parents 74ae9be9dc69
children aee74a3a17f3
files client/src/components/layers/Layerselect.vue
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/layers/Layerselect.vue	Fri Jul 19 09:54:40 2019 +0200
+++ b/client/src/components/layers/Layerselect.vue	Fri Jul 19 11:04:24 2019 +0200
@@ -59,6 +59,7 @@
       "differencesLegendImgDataURL"
     ]),
     ...mapGetters("map", ["openLayersMap"]),
+    ...mapState("bottlenecks", ["selectedSurvey"]),
     layer() {
       return this.openLayersMap().getLayer(this.layerId);
     },
@@ -69,6 +70,18 @@
   methods: {
     toggle(map) {
       if (map) {
+        if (
+          (this.layerId === "BOTTLENECKISOLINE" ||
+            this.layerId === "DIFFERENCES") &&
+          !this.selectedSurvey
+        ) {
+          map
+            .getLayer(this.layerId)
+            .getSource()
+            .updateParams({
+              cql_filter: `bottleneck_id='NO_BOTTLENECK_SELECTED'`
+            });
+        }
         map
           .getLayer(this.layerId)
           .setVisible(!map.getLayer(this.layerId).getVisible());