changeset 4633:c6349030ae60

client: pdf-gen: remove isBottleneckInView() function * remove function: not work correctly when move in same bottleneck
author Fadi Abbud <fadi.abbud@intevation.de>
date Fri, 11 Oct 2019 13:13:14 +0200
parents 2e47b32a389d
children 84c8a3f9a42a
files client/src/components/Pdftool.vue
diffstat 1 files changed, 5 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Pdftool.vue	Fri Oct 11 12:54:15 2019 +0200
+++ b/client/src/components/Pdftool.vue	Fri Oct 11 13:13:14 2019 +0200
@@ -119,7 +119,6 @@
 import { displayError } from "@/lib/errors";
 import { pdfgen, templateLoader } from "@/lib/mixins";
 import sanitize from "sanitize-filename";
-import { containsCoordinate } from "ol/extent";
 
 const paperSizes = {
   // in millimeter, landscape [width, height]
@@ -210,36 +209,17 @@
     filename() {
       let filename = "map";
       if (this.bottleneckForPrint) {
-        if (this.isBottleneckInView()) {
-          filename = `BN-${sanitize(this.bottleneckForPrint)}`;
-          if (this.selectedSurvey) {
-            filename += "-sr" + this.selectedSurvey.date_info.replace(/-/g, "");
-          }
+        // TODO: Check if the view contains the selected bottleneck
+        // to avoid including bottleneck info in pdf in case view has changed to another location
+        filename = `BN-${sanitize(this.bottleneckForPrint)}`;
+        if (this.selectedSurvey) {
+          filename += "-sr" + this.selectedSurvey.date_info.replace(/-/g, "");
         }
       }
       return `${filename}-${this.dateForPDF()}.pdf`;
     }
   },
   methods: {
-    // Check if the view contains the selected bottleneck
-    // to avoid including bottleneck info in pdf in case view has changed to another location
-    isBottleneckInView() {
-      let map = this.openLayersMap();
-      // Get extent of the viewport
-      let viewExtent = map.getView().calculateExtent(map.getSize());
-      let btnExtent = map // Extent of the selected bottleneck
-        .getLayer("BOTTLENECKS")
-        .getSource()
-        .getFeatures()
-        .find(f => f.get("objnam") === this.bottleneckForPrint)
-        .getGeometry().extent_;
-      // Get center of bottleneck from extent
-      let centerCoordinat = [
-        (btnExtent[0] + btnExtent[2]) / 2,
-        (btnExtent[1] + btnExtent[3]) / 2
-      ];
-      return containsCoordinate(viewExtent, centerCoordinat);
-    },
     close() {
       this.$store.commit("application/showPdfTool", false);
     },
@@ -676,7 +656,6 @@
       if (
         this.bottleneckForPrint &&
         this.selectedSurvey &&
-        this.isBottleneckInView() &&
         this.openLayersMap()
           .getLayer("BOTTLENECKISOLINE")
           .getVisible()
@@ -718,7 +697,6 @@
       if (
         this.bottleneckForPrint &&
         this.selectedSurvey &&
-        this.isBottleneckInView() &&
         this.openLayersMap()
           .getLayer("BOTTLENECKISOLINE")
           .getVisible()