changeset 2737:4a5c0e7cb75b

client:pdf-gen: add template element * add new template element to show the map scale and paper size
author Fadi Abbud <fadi.abbud@intevation.de>
date Tue, 19 Mar 2019 18:07:50 +0100
parents 017b1c0decfd
children add2d47c2567
files client/src/components/Pdftool.vue
diffstat 1 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Pdftool.vue	Tue Mar 19 16:39:10 2019 +0100
+++ b/client/src/components/Pdftool.vue	Tue Mar 19 18:07:50 2019 +0100
@@ -391,6 +391,17 @@
                 );
                 break;
               }
+              case "scale": {
+                this.addScale(
+                  scaleNominator,
+                  e.position,
+                  e.width,
+                  e.offset || defaultOffset,
+                  e.fontSize || defaultFontSize,
+                  e.color || defaultTextColor
+                );
+                break;
+              }
               case "northarrow": {
                 this.addNorthArrow(
                   e.position,
@@ -431,6 +442,20 @@
       this.openLayersMap.getView().fit(this.mapExtent, { size: this.mapSize });
       this.readyToGenerate = true;
     },
+    // add the used map scale and papersize
+    addScale(scalenominator, position, width, offset, fontSize, color) {
+      //TODO: check the correctence of the scalnominator value here.
+      let str =
+        this.$gettext("Scale") +
+        " 1 : " +
+        scalenominator +
+        " " +
+        "(DIN" +
+        " " +
+        this.form.paperSize.toUpperCase() +
+        ")";
+      this.addText(position, offset, width, fontSize, color, str);
+    },
     addRoundedBox(x, y, w, h, color, rounding, brcolor) {
       // draws a rounded background box at (x,y) width x height
       // using jsPDF units