changeset 5055:8741fae4babd time-sliding

merged default into time-sliding branch
author Fadi Abbud <fadi.abbud@intevation.de>
date Fri, 06 Mar 2020 12:41:13 +0100
parents 5e6ec587014e (current diff) 6a48e5c6fe2f (diff)
children 2e6f73726879
files
diffstat 4 files changed, 72 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/identify/Identify.vue	Thu Mar 05 12:15:37 2020 +0100
+++ b/client/src/components/identify/Identify.vue	Fri Mar 06 12:41:13 2020 +0100
@@ -540,10 +540,43 @@
       return id.replace(/[.][^.]*$/, "");
     },
     featureLabel(feature) {
+      const featureID = this.featureId(feature);
       if (formatter.hasOwnProperty(this.featureId(feature))) {
-        return formatter[this.featureId(feature)].label;
+        return formatter[featureID].label;
+      }
+      if (/fairway_marks/.test(featureID)) {
+        return this.captionFairwayMarks(
+          featureID.replace("fairway_marks_", "")
+        );
       }
-      return this.featureId(feature);
+      return featureID;
+    },
+    captionFairwayMarks(id) {
+      const captions = {
+        bcnisd: this.$gettext(
+          "Beacon, isolated danger (MARITIME/Hydro feature)"
+        ),
+        bcnlat_hydro: this.$gettext("Beacon, lateral (MARITIME/Hydro feature)"),
+        bcnlat_ienc: this.$gettext("Beacon, lateral (IENC feature)"),
+        boycar: this.$gettext("Buoy, cardinal (MARITIME/Hydro feature)"),
+        boyisd: this.$gettext("Buoy, isolated danger (MARITIME/Hydro feature)"),
+        boylat_hydro: this.$gettext("Buoy, lateral (MARITIME/Hydro feature)"),
+        boylat_ienc: this.$gettext("Buoy, lateral (IENC feature)"),
+        boysaw: this.$gettext("Buoy, safe water (MARITIME/Hydro feature)"),
+        boyspp: this.$gettext(
+          "Buoy, special purpose/general (MARITIME/Hydro feature)"
+        ),
+        daymar_hydro: this.$gettext("Daymark (MARITIME/Hydro feature)"),
+        daymar_ienc: this.$gettext("Daymark (IENC feature)"),
+        lights: this.$gettext("Light (MARITIME/Hydro feature)"),
+        rtpbcn: this.$gettext(
+          "Radar transponder beacon (MARITIME/Hydro feature)"
+        ),
+        topmar: this.$gettext("Topmark (MARITIME/Hydro feature)"),
+        notmrk: this.$gettext("Notice mark (IENC feature)")
+      };
+      if (captions[id]) return captions[id];
+      return id;
     },
     featureProps(feature) {
       let featureId = this.featureId(feature);
--- a/client/src/components/importconfiguration/types/Fairwaymarks.vue	Thu Mar 05 12:15:37 2020 +0100
+++ b/client/src/components/importconfiguration/types/Fairwaymarks.vue	Fri Mar 06 12:41:13 2020 +0100
@@ -98,6 +98,8 @@
  * Author(s):
  * Thomas Junk <thomas.junk@intevation.de>
  */
+import app from "@/main";
+
 export default {
   name: "fairwaymarks",
   props: ["url", "featureType", "sortBy", "mark", "isUpdate"],
@@ -124,21 +126,23 @@
     }
   },
   FAIRWAYMARKS: {
-    BCNISD: "Beacon, isolated danger (MARITIME/Hydro feature)",
-    BCNLAT_hydro: "Beacon, lateral (MARITIME/Hydro feature)",
-    bcnlat_ienc: "Beacon, lateral (IENC feature)",
-    BOYCAR: "Buoy, cardinal (MARITIME/Hydro feature)",
-    BOYISD: "Buoy, isolated danger (MARITIME/Hydro feature)",
-    BOYLAT_hydro: "Buoy, lateral (MARITIME/Hydro feature)",
-    BOYLAT_ienc: "Buoy, lateral (IENC feature)",
-    BOYSAW: "Buoy, safe water (MARITIME/Hydro feature)",
-    BOYSPP: "Buoy, special purpose/general (MARITIME/Hydro feature)",
-    DAYMAR_hydro: "Daymark (MARITIME/Hydro feature)",
-    DAYMAR_ienc: "Daymark (IENC feature)",
-    LIGHTS: "Light (MARITIME/Hydro feature)",
-    RTPBCN: "Radar transponder beacon (MARITIME/Hydro feature)",
-    TOPMAR: "Topmark (MARITIME/Hydro feature)",
-    notmrk: "Notice mark (IENC feature)"
+    bcnisd: app.$gettext("Beacon, isolated danger (MARITIME/Hydro feature)"),
+    bcnlat_hydro: app.$gettext("Beacon, lateral (MARITIME/Hydro feature)"),
+    bcnlat_ienc: app.$gettext("Beacon, lateral (IENC feature)"),
+    boycar: app.$gettext("Buoy, cardinal (MARITIME/Hydro feature)"),
+    boyisd: app.$gettext("Buoy, isolated danger (MARITIME/Hydro feature)"),
+    boylat_hydro: app.$gettext("Buoy, lateral (MARITIME/Hydro feature)"),
+    boylat_ienc: app.$gettext("Buoy, lateral (IENC feature)"),
+    boysaw: app.$gettext("Buoy, safe water (MARITIME/Hydro feature)"),
+    boyspp: app.$gettext(
+      "Buoy, special purpose/general (MARITIME/Hydro feature)"
+    ),
+    daymar_hydro: app.$gettext("Daymark (MARITIME/Hydro feature)"),
+    daymar_ienc: app.$gettext("Daymark (IENC feature)"),
+    lights: app.$gettext("Light (MARITIME/Hydro feature)"),
+    rtpbcn: app.$gettext("Radar transponder beacon (MARITIME/Hydro feature)"),
+    topmar: app.$gettext("Topmark (MARITIME/Hydro feature)"),
+    notmrk: app.$gettext("Notice mark (IENC feature)")
   }
 };
 </script>
--- a/pkg/wfs/download.go	Thu Mar 05 12:15:37 2020 +0100
+++ b/pkg/wfs/download.go	Fri Mar 06 12:41:13 2020 +0100
@@ -165,6 +165,8 @@
 			if err != nil {
 				log.Printf("error: %v\n", err)
 				supportsPaging = false
+			} else if numFeatures == 0 {
+				return nil, nil
 			} else {
 				log.Printf("info: Number of features: %d\n", numFeatures)
 			}
@@ -220,20 +222,22 @@
 			q.RawQuery = v.Encode()
 			return q.String()
 		}
-		if numFeatures <= featuresPerPage {
-			log.Println("info: All features can be fetched in one page.")
-			downloadURLs = []string{pagedURL(0, numFeatures)}
-		} else {
-			log.Println("info: Features need to be downloaded in pages.")
-			for pos := 0; pos < numFeatures; {
-				var count int
-				if rest := numFeatures - pos; rest >= numFeatures {
-					count = numFeatures
-				} else {
-					count = rest
+		if numFeatures > 0 {
+			if numFeatures <= featuresPerPage {
+				log.Println("info: All features can be fetched in one page.")
+				downloadURLs = []string{pagedURL(0, numFeatures)}
+			} else {
+				log.Println("info: Features need to be downloaded in pages.")
+				for pos := 0; pos < numFeatures; {
+					var count int
+					if rest := numFeatures - pos; rest >= numFeatures {
+						count = numFeatures
+					} else {
+						count = rest
+					}
+					downloadURLs = append(downloadURLs, pagedURL(pos, count))
+					pos += count
 				}
-				downloadURLs = append(downloadURLs, pagedURL(pos, count))
-				pos += count
 			}
 		}
 	} else { // No paging support.
--- a/pkg/wfs/global.go	Thu Mar 05 12:15:37 2020 +0100
+++ b/pkg/wfs/global.go	Fri Mar 06 12:41:13 2020 +0100
@@ -15,7 +15,6 @@
 
 import (
 	"bufio"
-	"errors"
 	"fmt"
 	"io"
 	"io/ioutil"
@@ -114,7 +113,7 @@
 func (gmd GMLDownloader) Download(user, password string, handler func(string, io.Reader) error) error {
 
 	if len(gmd) == 0 {
-		return errors.New("nothing to download")
+		return nil
 	}
 
 	tmpDir := config.TmpDir()