changeset 918:054561be4d68

Switch bottleneck isolines layer off, when selection is empty. And back on, if it isn't ...
author Sascha Wilde <wilde@intevation.de>
date Thu, 04 Oct 2018 18:28:48 +0200
parents 5b90217aa1bb
children 1334756abb72
files client/src/map/Maplayer.vue
diffstat 1 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/map/Maplayer.vue	Thu Oct 04 12:45:25 2018 +0200
+++ b/client/src/map/Maplayer.vue	Thu Oct 04 18:28:48 2018 +0200
@@ -295,16 +295,24 @@
     // TODOISO call if new survey is selected
     updateBottleneckFilter(bottleneck_id, datestr) {
       console.log("updating filter with", bottleneck_id, datestr);
-      var wmsSrc = this.getLayerByName("Bottleneck isolines").data.getSource();
-      // TODOISO check if this works
-      wmsSrc.updateParams({
-        cql_filter:
-          "date_info='" +
-          datestr +
-          "' AND bottleneck_id='" +
-          bottleneck_id +
-          "'"
-      });
+      var layer = this.getLayerByName("Bottleneck isolines");
+      var wmsSrc = layer.data.getSource();
+
+      if (bottleneck_id != "does_not_exist") {
+        wmsSrc.updateParams({
+          cql_filter:
+            "date_info='" +
+            datestr +
+            "' AND bottleneck_id='" +
+            bottleneck_id +
+            "'"
+        });
+        layer.isVisible = true;
+        layer.data.setVisible(true);
+      } else {
+        layer.isVisible = false;
+        layer.data.setVisible(false);
+      }
     },
     onBeforePrint(/* evt */) {
       // console.log("onBeforePrint(", evt ,")");