diff client/src/components/fairway/AvailableFairwayDepthDialogue.vue @ 3309:80037790032d

client: fully implemented sections - added map layer with new style - implemented in identify tool, map popup and fairway availability dialog - added sidebar menu item
author Markus Kottlaender <markus@intevation.de>
date Fri, 17 May 2019 12:45:13 +0200
parents fa7dc3f31ef3
children 70676557a66f
line wrap: on
line diff
--- a/client/src/components/fairway/AvailableFairwayDepthDialogue.vue	Fri May 17 11:31:30 2019 +0200
+++ b/client/src/components/fairway/AvailableFairwayDepthDialogue.vue	Fri May 17 12:45:13 2019 +0200
@@ -253,6 +253,11 @@
           .getLayer("STRETCHES")
           .setVisible(true);
       }
+      if (this.type === this.$options.SECTIONS) {
+        this.openLayersMap()
+          .getLayer("SECTIONS")
+          .setVisible(true);
+      }
       if (this.selectedFairwayAvailabilityFeature) {
         this.$store.dispatch("map/moveToFeauture", {
           feature: this.selectedFairwayAvailabilityFeature,
@@ -276,6 +281,13 @@
         "fairwayavailability/setSelectedFairwayAvailability",
         stretch
       );
+    },
+    setSelectedSection() {
+      const section = this.sections.find(x => x.id === this.selectedSectionId);
+      this.$store.commit(
+        "fairwayavailability/setSelectedFairwayAvailability",
+        section
+      );
     }
   },
   computed: {
@@ -291,7 +303,12 @@
       "frequency",
       "LOS"
     ]),
-    ...mapState("imports", ["stretches", "selectedStretchId"]),
+    ...mapState("imports", [
+      "stretches",
+      "sections",
+      "selectedStretchId",
+      "selectedSectionId"
+    ]),
     ...mapState("bottlenecks", ["bottlenecksList", "selectedBottleneck"]),
     ...mapGetters("map", ["openLayersMap"]),
     ...mapGetters("bottlenecks", ["orderedBottlenecks"]),
@@ -358,6 +375,7 @@
     entries() {
       if (this.type === this.$options.BOTTLENECKS) return this.bottlenecksList;
       if (this.type === this.$options.STRETCHES) return this.stretches;
+      if (this.type === this.$options.SECTIONS) return this.sections;
       return [];
     },
     label() {
@@ -383,26 +401,37 @@
         this.type === this.$options.STRETCHES &&
         this.selectedStretchId
       ) {
+        this.openLayersMap()
+          .getLayer("STRETCHES")
+          .setVisible(true);
         this.setSelectedStretch();
+      } else if (
+        this.type === this.$options.SECTIONS &&
+        this.selectedSectionId
+      ) {
+        this.openLayersMap()
+          .getLayer("SECTIONS")
+          .setVisible(true);
+        this.setSelectedSection();
       } else {
         this.$store.commit(
           "fairwayavailability/setSelectedFairwayAvailability",
           null
         );
       }
-      this.openLayersMap()
-        .getLayer("STRETCHES")
-        .setVisible(true);
     },
     showFairwayDepth() {
       if (this.showFairwayDepth) {
         this.loading = true;
-        this.$store.dispatch("bottlenecks/loadBottlenecksList").then(() => {
-          this.$store.dispatch("imports/loadStretches").then(() => {
-            this.loading = false;
+        Promise.all([
+          this.$store.dispatch("bottlenecks/loadBottlenecksList"),
+          this.$store.dispatch("imports/loadStretches"),
+          this.$store.dispatch("imports/loadSections")
+        ])
+          .then(() => {
             if (this.selectedBottleneck) this.setSelectedBottleneck();
-          });
-        });
+          })
+          .finally(() => (this.loading = false));
       }
     }
   },