changeset 3494:97326e30407c zpg-ldc

Merged default into zpg-ldc branch.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 27 May 2019 17:33:13 +0200
parents 73285a90cab2 (current diff) da58cf951342 (diff)
children 220713fcb190
files
diffstat 3 files changed, 54 insertions(+), 87 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/fairway/AvailableFairwayDepth.vue	Mon May 27 17:17:47 2019 +0200
+++ b/client/src/components/fairway/AvailableFairwayDepth.vue	Mon May 27 17:33:13 2019 +0200
@@ -195,7 +195,7 @@
       const lowerBound = [d[0], w[0]].filter(x => x).join(", ");
       const upperBound = [d[1], w[1]].filter(x => x).join(", ");
       return [
-        `>  LDC`,
+        `> LDC`,
         `< ${lowerBound}`,
         `< ${upperBound}`,
         `>= ${upperBound}`
@@ -407,41 +407,36 @@
         y = offset.y;
       this.pdf.doc.setFontSize(10);
       let width =
-        (this.pdf.doc.getStringUnitWidth(">= LDC [h]") * 10) / (72 / 25.6) + 15;
+        (this.pdf.doc.getStringUnitWidth(">= LDC") * 10) / (72 / 25.6) + 15;
       // if position is on the right, x needs to be calculate with pdf width and
       // the size of the element
       if (["topright", "bottomright"].indexOf(position) !== -1) {
         x = this.pdf.width - offset.x - width;
       }
       if (["bottomright", "bottomleft"].indexOf(position) !== -1) {
-        y = this.pdf.height - offset.y - this.getTextHeight(7);
+        y = this.pdf.height - offset.y - this.getTextHeight(6);
       }
 
       this.pdf.doc.setTextColor(color);
-      this.pdf.doc.setDrawColor("rgb(255, 133, 94)");
-      this.pdf.doc.setFillColor("rgb(255, 133, 94)");
-      this.pdf.doc.rect(x, y, 8, 4, "FD");
-      this.pdf.doc.text(">= LDC [h]", x + 10, y + 3);
+      this.pdf.doc.setDrawColor(this.$options.COLORS.LDC);
+      this.pdf.doc.setFillColor(this.$options.COLORS.LDC);
+      this.pdf.doc.roundedRect(x, y, 10, 4, 1.5, 1.5, "FD");
+      this.pdf.doc.text(this.legend[0], x + 12, y + 3);
 
-      this.pdf.doc.setDrawColor("rgb(255, 66, 79)");
-      this.pdf.doc.setFillColor("rgb(255, 66, 79)");
-      this.pdf.doc.rect(x, y + 5, 8, 4, "FD");
-      this.pdf.doc.text("< 200.00 [h]", x + 10, y + 8);
+      this.pdf.doc.setDrawColor(this.$options.COLORS.REST[0]);
+      this.pdf.doc.setFillColor(this.$options.COLORS.REST[0]);
+      this.pdf.doc.roundedRect(x, y + 5, 10, 4, 1.5, 1.5, "FD");
+      this.pdf.doc.text(this.legend[1], x + 12, y + 8);
 
-      this.pdf.doc.setDrawColor("rgb(255, 115, 124)");
-      this.pdf.doc.setFillColor("rgb(255, 115, 124)");
-      this.pdf.doc.rect(x, y + 10, 8, 4, "FD");
-      this.pdf.doc.text(">= 200.00 [h]", x + 10, y + 13);
+      this.pdf.doc.setDrawColor(this.$options.COLORS.REST[1]);
+      this.pdf.doc.setFillColor(this.$options.COLORS.REST[1]);
+      this.pdf.doc.roundedRect(x, y + 10, 10, 4, 1.5, 1.5, "FD");
+      this.pdf.doc.text(this.legend[2], x + 12, y + 13);
 
-      this.pdf.doc.setDrawColor("rgb(255, 153, 160)");
-      this.pdf.doc.setFillColor("rgb(255, 153, 160)");
-      this.pdf.doc.rect(x, y + 15, 8, 4, "FD");
-      this.pdf.doc.text(">= 230.00 [h]", x + 10, y + 18);
-
-      this.pdf.doc.setDrawColor("rgb(45, 132, 179)");
-      this.pdf.doc.setFillColor("rgb(45, 132, 179)");
-      this.pdf.doc.rect(x, y + 20, 8, 4, "FD");
-      this.pdf.doc.text(">= 250.00 [h]", x + 10, y + 23);
+      this.pdf.doc.setDrawColor(this.$options.COLORS.HIGHEST);
+      this.pdf.doc.setFillColor(this.$options.COLORS.HIGHEST);
+      this.pdf.doc.roundedRect(x, y + 15, 10, 4, 1.5, 1.5, "FD");
+      this.pdf.doc.text(this.legend[3], x + 12, y + 18);
     },
     legendStyle(index) {
       const style = {
--- a/client/src/components/fairway/AvailableFairwayDepthLNWL.vue	Mon May 27 17:17:47 2019 +0200
+++ b/client/src/components/fairway/AvailableFairwayDepthLNWL.vue	Mon May 27 17:33:13 2019 +0200
@@ -186,7 +186,7 @@
       const lowerBound = [d[0], w[0]].filter(x => x).join(", ");
       const upperBound = [d[1], w[1]].filter(x => x).join(", ");
       return [
-        `>  LDC`,
+        `> LDC`,
         `< ${lowerBound}`,
         `< ${upperBound}`,
         `>= ${upperBound}`
@@ -417,7 +417,7 @@
         y = offset.y;
       this.pdf.doc.setFontSize(10);
       let width =
-        (this.pdf.doc.getStringUnitWidth(">= LDC [h]") * 10) / (72 / 25.6) + 15;
+        (this.pdf.doc.getStringUnitWidth(">= LDC") * 10) / (72 / 25.6) + 15;
 
       // if position is on the right, x needs to be calculate with pdf width and
       // the size of the element
@@ -425,33 +425,28 @@
         x = this.pdf.width - offset.x - width;
       }
       if (["bottomright", "bottomleft"].indexOf(position) !== -1) {
-        y = this.pdf.height - offset.y - this.getTextHeight(7);
+        y = this.pdf.height - offset.y - this.getTextHeight(6);
       }
       this.pdf.doc.setTextColor(color);
-      this.pdf.doc.setDrawColor("rgb(255, 133, 94)");
-      this.pdf.doc.setFillColor("rgb(255, 133, 94)");
-      this.pdf.doc.rect(x, y, 8, 4, "FD");
-      this.pdf.doc.text(">= LDC [h]", x + 10, y + 3);
+      this.pdf.doc.setDrawColor(this.$options.LWNLCOLORS.LDC);
+      this.pdf.doc.setFillColor(this.$options.LWNLCOLORS.LDC);
+      this.pdf.doc.roundedRect(x, y, 10, 4, 1.5, 1.5, "FD");
+      this.pdf.doc.text(this.legendLNWL[0], x + 12, y + 3);
 
-      this.pdf.doc.setDrawColor("rgb(255, 66, 79)");
-      this.pdf.doc.setFillColor("rgb(255, 66, 79)");
-      this.pdf.doc.rect(x, y + 5, 8, 4, "FD");
-      this.pdf.doc.text("< 200.00 [h]", x + 10, y + 8);
+      this.pdf.doc.setDrawColor(this.$options.AFDCOLORS[2]);
+      this.pdf.doc.setFillColor(this.$options.AFDCOLORS[2]);
+      this.pdf.doc.roundedRect(x, y + 5, 10, 4, 1.5, 1.5, "FD");
+      this.pdf.doc.text(this.legendLNWL[1], x + 12, y + 8);
 
-      this.pdf.doc.setDrawColor("rgb(255, 115, 124)");
-      this.pdf.doc.setFillColor("rgb(255, 115, 124)");
-      this.pdf.doc.rect(x, y + 10, 8, 4, "FD");
-      this.pdf.doc.text(">= 200.00 [h]", x + 10, y + 13);
+      this.pdf.doc.setDrawColor(this.$options.AFDCOLORS[1]);
+      this.pdf.doc.setFillColor(this.$options.AFDCOLORS[1]);
+      this.pdf.doc.roundedRect(x, y + 10, 10, 4, 1.5, 1.5, "FD");
+      this.pdf.doc.text(this.legendLNWL[2], x + 12, y + 13);
 
-      this.pdf.doc.setDrawColor("rgb(255, 153, 160)");
-      this.pdf.doc.setFillColor("rgb(255, 153, 160)");
-      this.pdf.doc.rect(x, y + 15, 8, 4, "FD");
-      this.pdf.doc.text(">= 230.00 [h]", x + 10, y + 18);
-
-      this.pdf.doc.setDrawColor("rgb(45, 132, 179)");
-      this.pdf.doc.setFillColor("rgb(45, 132, 179)");
-      this.pdf.doc.rect(x, y + 20, 8, 4, "FD");
-      this.pdf.doc.text(">= 250.00 [h]", x + 10, y + 23);
+      this.pdf.doc.setDrawColor(this.$options.AFDCOLORS[0]);
+      this.pdf.doc.setFillColor(this.$options.AFDCOLORS[0]);
+      this.pdf.doc.roundedRect(x, y + 15, 10, 4, 1.5, 1.5, "FD");
+      this.pdf.doc.text(this.legendLNWL[3], x + 12, y + 18);
     },
     close() {
       this.$store.commit("application/paneSetup", "DEFAULT");
--- a/client/src/store/fairwayavailability.js	Mon May 27 17:17:47 2019 +0200
+++ b/client/src/store/fairwayavailability.js	Mon May 27 17:33:13 2019 +0200
@@ -220,25 +220,14 @@
           : feature.get("objnam");
         [from, to] = getIntervallBorders(from, to, frequency);
         let additionalParams = "";
-        let endpoint = "";
-        switch (type) {
-          case TYPES.BOTTLENECK:
-            endpoint = "bottleneck";
-            if (limitingFactor === LIMITINGFACTORS.DEPTH)
-              additionalParams = `&breaks=${depthLimit1},${depthLimit2}`;
-            if (limitingFactor === LIMITINGFACTORS.WIDTH)
-              additionalParams = `&breaks=${widthLimit1},${widthLimit2}`;
-            break;
-          case TYPES.SECTION:
-            endpoint = "section";
-            additionalParams = `&depthbreaks=${depthLimit1},${depthLimit2}&widthbreaks=${widthLimit1},${widthLimit2}`;
-            break;
-          case TYPES.STRETCH:
-            endpoint = "stretch";
-            additionalParams = `&depthbreaks=${depthLimit1},${depthLimit2}&widthbreaks=${widthLimit1},${widthLimit2}`;
-            break;
-          default:
-            throw new Error("Wrong selection");
+        let endpoint = type;
+        if (type === TYPES.BOTTLENECK) {
+          if (limitingFactor === LIMITINGFACTORS.DEPTH)
+            additionalParams = `&breaks=${depthLimit1},${depthLimit2}`;
+          if (limitingFactor === LIMITINGFACTORS.WIDTH)
+            additionalParams = `&breaks=${widthLimit1},${widthLimit2}`;
+        } else if (type == TYPES.SECTION || type == TYPES.STRETCH) {
+          additionalParams = `&depthbreaks=${depthLimit1},${depthLimit2}&widthbreaks=${widthLimit1},${widthLimit2}`;
         }
         const start = encodeURIComponent("00:00:00+00:00");
         const end = encodeURIComponent("23:59:59+00:00");
@@ -283,26 +272,14 @@
         const start = encodeURIComponent("00:00:00+00:00");
         const end = encodeURIComponent("23:59:59+00:00");
         let additionalParams = "";
-        let endpoint = "";
-        switch (type) {
-          case TYPES.BOTTLENECK:
-            endpoint = "bottleneck";
-            if (limitingFactor === LIMITINGFACTORS.DEPTH)
-              additionalParams = `&breaks=${depthLimit1},${depthLimit2}`;
-            if (limitingFactor === LIMITINGFACTORS.WIDTH)
-              additionalParams = `&breaks=${widthLimit1},${widthLimit2}`;
-            break;
-          case TYPES.SECTION:
-            endpoint = "section";
-            additionalParams = `&depthbreaks=${depthLimit1},${depthLimit2}&widthbreaks=${widthLimit1},${widthLimit2}`;
-            break;
-          case TYPES.STRETCH:
-            endpoint = "stretch";
-            additionalParams = `&depthbreaks=${depthLimit1},${depthLimit2}&widthbreaks=${widthLimit1},${widthLimit2}`;
-            break;
-          default:
-            endpoint = "bottleneck";
-            break;
+        let endpoint = type || TYPES.BOTTLENECK;
+        if (type === TYPES.BOTTLENECK) {
+          if (limitingFactor === LIMITINGFACTORS.DEPTH)
+            additionalParams = `&breaks=${depthLimit1},${depthLimit2}`;
+          if (limitingFactor === LIMITINGFACTORS.WIDTH)
+            additionalParams = `&breaks=${widthLimit1},${widthLimit2}`;
+        } else if (type == TYPES.SECTION || type == TYPES.STRETCH) {
+          additionalParams = `&depthbreaks=${depthLimit1},${depthLimit2}&widthbreaks=${widthLimit1},${widthLimit2}`;
         }
         const URL = `data/${endpoint}/availability/${encodeURIComponent(
           name