changeset 4012:7a0f56f9d0dd

available_fairway_depth_LNWL: in case the limits are equal the middle label is omitted. and in print too
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 19 Jul 2019 12:59:11 +0200
parents 44060b9027da
children e9ab7c53aa19
files client/src/components/fairway/AvailableFairwayDepthLNWL.vue
diffstat 1 files changed, 54 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/fairway/AvailableFairwayDepthLNWL.vue	Fri Jul 19 12:39:50 2019 +0200
+++ b/client/src/components/fairway/AvailableFairwayDepthLNWL.vue	Fri Jul 19 12:59:11 2019 +0200
@@ -170,12 +170,12 @@
       if (this.depthlimit1 !== this.depthlimit2) {
         result = [
           `> LDC`,
-          `>= ${upperBound}`,
+          `< ${lowerBound}`,
           `< ${upperBound}`,
-          `< ${lowerBound}`
+          `>= ${upperBound}`
         ];
       } else {
-        result = [`> LDC`, `>= ${upperBound}`, `< ${upperBound}`];
+        result = [`> LDC`, `< ${upperBound}`, `>= ${upperBound}`];
       }
       return result;
     },
@@ -212,12 +212,22 @@
   },
   methods: {
     legendStyle(index) {
-      const style = {
-        0: `background-color: ${this.$options.LWNLCOLORS.LDC};`,
-        1: `background-color: ${this.$options.AFDCOLORS[2]};`,
-        2: `background-color: ${this.$options.AFDCOLORS[1]};`,
-        3: `background-color: ${this.$options.AFDCOLORS[0]};`
-      };
+      let style;
+      if (this.depthlimit1 !== this.depthlimit2) {
+        style = {
+          0: `background-color: ${this.$options.LWNLCOLORS.LDC};`,
+          1: `background-color: ${this.$options.AFDCOLORS[2]};`,
+          2: `background-color: ${this.$options.AFDCOLORS[1]};`,
+          3: `background-color: ${this.$options.AFDCOLORS[0]};`
+        };
+      } else {
+        style = {
+          0: `background-color: ${this.$options.LWNLCOLORS.LDC};`,
+          1: `background-color: ${this.$options.AFDCOLORS[2]};`,
+          2: `background-color: ${this.$options.AFDCOLORS[0]};`
+        };
+      }
+
       return style[index];
     },
     applyChange() {
@@ -268,26 +278,44 @@
       if (["bottomright", "bottomleft"].indexOf(position) !== -1) {
         y = this.pdf.height - offset.y - this.getTextHeight(6);
       }
-      this.pdf.doc.setTextColor(color);
-      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);
+      if (this.legendLNWL[3]) {
+        this.pdf.doc.setTextColor(color);
+        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(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(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(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(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);
+      } else {
+        this.pdf.doc.setTextColor(color);
+        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(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(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(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);
+        this.pdf.doc.setDrawColor(this.$options.AFDCOLORS[0]);
+        this.pdf.doc.setFillColor(this.$options.AFDCOLORS[0]);
+        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);
+      }
     },
     close() {
       this.$store.commit("application/paneSetup", "DEFAULT");