changeset 5383:d61aab631d65 extented-report

Merged default into extented-report branch.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 30 Jun 2021 11:37:07 +0200
parents 79782788749e (current diff) ef07b81d3305 (diff)
children 18969a4d31b6
files
diffstat 1 files changed, 63 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Pdftool.vue	Tue Jun 29 13:29:06 2021 +0200
+++ b/client/src/components/Pdftool.vue	Wed Jun 30 11:37:07 2021 +0200
@@ -754,6 +754,12 @@
           .getLayer("BOTTLENECKISOLINE")
           .getVisible()
       ) {
+        const ZPGEXCEPTION =
+          this.soundingInfo &&
+          this.soundingInfo.number > 0 &&
+          this.soundingInfo.feature.properties.zpg_exception;
+        let SPACER = ZPGEXCEPTION ? 10 : 4;
+
         // transforming into an HTMLImageElement only to find out
         // the width x height of the legend image
         // FUTURE: find a better way to get the width and height
@@ -766,7 +772,7 @@
 
         // x/y defaults to offset for topleft corner (normal x/y coordinates)
         let x = offset.x;
-        let y = offset.y;
+        let y = offset.y + SPACER;
 
         // if position is on the right, x needs to be calculate with pdf width and
         // the size of the element
@@ -774,7 +780,7 @@
           x = this.pdf.width - offset.x - width;
         }
         if (["bottomright", "bottomleft"].indexOf(position) !== -1) {
-          y = this.pdf.height - offset.y - height;
+          y = this.pdf.height - offset.y - SPACER - height;
         }
 
         this.addRoundedBox(x, y, width, height, "white", rounding, brcolor);
@@ -796,6 +802,11 @@
           .getLayer("BOTTLENECKISOLINE")
           .getVisible()
       ) {
+        const ZPGEXCEPTION =
+          this.soundingInfo &&
+          this.soundingInfo.number > 0 &&
+          this.soundingInfo.feature.properties.zpg_exception;
+
         let survey = this.selectedSurvey;
 
         // determine text dimensions
@@ -811,13 +822,14 @@
         let str3_1 = this.$gettext("Ref gauge") + ": ";
         let str3_2 = survey.gauge_objname;
         let str4_1 = this.$gettext("Depth relativ to") + ": ";
-        let str4_2 =
-          survey.depth_reference +
-          " = " +
-          (survey.hasOwnProperty("waterlevel_value")
-            ? survey.waterlevel_value + " cm"
-            : "?");
-
+        let str4_2 = survey.depth_reference;
+        if (!ZPGEXCEPTION) {
+          str4_2 +=
+            " = " +
+            (survey.hasOwnProperty("waterlevel_value")
+              ? survey.waterlevel_value + " cm"
+              : "?");
+        }
         this.pdf.doc.setFontStyle("italic");
         let w1_1 = this.pdf.doc.getTextWidth(str1_1);
         this.pdf.doc.setFontStyle("bold");
@@ -834,12 +846,27 @@
         let w4_1 = this.pdf.doc.getTextWidth(str4_1);
         this.pdf.doc.setFontStyle("normal");
         let w4_2 = this.pdf.doc.getTextWidth(str4_2);
+        let str5_1 = "";
+        let w5_1 = 0;
+        let SPACER = 6;
+        if (ZPGEXCEPTION) {
+          str5_1 = this.$gettext("Bottleneck with ZPG Exception");
+          this.pdf.doc.setFontStyle("normal");
+          w5_1 = this.pdf.doc.getTextWidth(str5_1);
+        }
 
-        let height = 21;
-        let padding = 3;
-        let width =
-          Math.max(w1_1 + w1_2, w2_1 + w2_2, w3_1 + w3_2, w4_1 + w4_2) +
-          2 * padding;
+        let height = ZPGEXCEPTION ? 24 + SPACER : 24;
+        let padding = 2;
+        let width = ZPGEXCEPTION
+          ? Math.max(
+              w1_1 + w1_2,
+              w2_1 + w2_2,
+              w3_1 + w3_2,
+              w4_1 + w4_2 + w5_1
+            ) +
+            2 * padding
+          : Math.max(w1_1 + w1_2, w2_1 + w2_2, w3_1 + w3_2, w4_1 + w4_2) +
+            2 * padding;
 
         // x/y defaults to offset for topleft corner (normal x/y coordinates)
         let x = offset.x;
@@ -859,47 +886,56 @@
 
         // bottleneck
         this.pdf.doc.setFontStyle("italic");
-        this.pdf.doc.text(x + padding, y + padding + 2, str1_1, textOptions);
+        this.pdf.doc.text(x + padding, y + padding, str1_1, textOptions);
         this.pdf.doc.setFontStyle("bold");
-        this.pdf.doc.text(
-          x + padding + w1_1,
-          y + padding + 2,
-          str1_2,
-          textOptions
-        );
+        this.pdf.doc.text(x + padding + w1_1, y + padding, str1_2, textOptions);
 
         // survey date
         this.pdf.doc.setFontStyle("italic");
-        this.pdf.doc.text(x + padding, y + padding + 6, str2_1, textOptions);
+        this.pdf.doc.text(x + padding, y + 1 + SPACER, str2_1, textOptions);
         this.pdf.doc.setFontStyle("normal");
         this.pdf.doc.text(
           x + padding + w2_1,
-          y + padding + 6,
+          y + 1 + SPACER,
           str2_2,
           textOptions
         );
 
         // ref gauge
         this.pdf.doc.setFontStyle("italic");
-        this.pdf.doc.text(x + padding, y + padding + 10, str3_1, textOptions);
+        this.pdf.doc.text(
+          x + padding,
+          y + 0.5 + 2 * SPACER,
+          str3_1,
+          textOptions
+        );
         this.pdf.doc.setFontStyle("normal");
         this.pdf.doc.text(
           x + padding + w3_1,
-          y + padding + 10,
+          y + 0.5 + 2 * SPACER,
           str3_2,
           textOptions
         );
 
         // depth relative to
         this.pdf.doc.setFontStyle("italic");
-        this.pdf.doc.text(x + padding, y + padding + 14, str4_1, textOptions);
+        this.pdf.doc.text(
+          x + padding,
+          y + 0.5 + 3 * SPACER,
+          str4_1,
+          textOptions
+        );
         this.pdf.doc.setFontStyle("normal");
         this.pdf.doc.text(
           x + padding + w4_1,
-          y + padding + 14,
+          y + 0.5 + 3 * SPACER,
           str4_2,
           textOptions
         );
+        if (ZPGEXCEPTION) {
+          this.pdf.doc.setFontStyle("bold");
+          this.pdf.doc.text(x + padding, y + 4 * SPACER, str5_1, textOptions);
+        }
       }
     },
     calculateScaleDenominator() {