changeset 3446:4a0fab451f87 fairway-avail-csv

Merged default into fairway-avail-csv branch
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 24 May 2019 12:14:57 +0200
parents e07b18f2482e (current diff) 1559566662f5 (diff)
children 3bb2d14abf8a
files
diffstat 7 files changed, 34 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/fairway/AvailableFairwayDepth.vue	Fri May 24 12:13:55 2019 +0200
+++ b/client/src/components/fairway/AvailableFairwayDepth.vue	Fri May 24 12:14:57 2019 +0200
@@ -427,10 +427,13 @@
       this.pdf.doc.text(">= 250.00 [h]", x + 10, y + 23);
     },
     legendStyle(index) {
-      if (index == 0) return `background-color: ${this.$options.COLORS.LDC};`;
-      if (index < 4)
-        return `background-color: ${this.$options.COLORS.REST[index - 1]};`;
-      return `background-color: ${this.$options.COLORS.HIGHEST};`;
+      const style = {
+        0: `background-color: ${this.$options.COLORS.LDC};`,
+        1: `background-color: ${this.$options.COLORS.REST[0]};`,
+        2: `background-color: ${this.$options.COLORS.REST[1]};`,
+        3: `background-color: ${this.$options.COLORS.HIGHEST};`
+      };
+      return style[index];
     },
     close() {
       this.$store.commit("application/paneSetup", "DEFAULT");
--- a/client/src/components/gauge/HydrologicalConditions.vue	Fri May 24 12:13:55 2019 +0200
+++ b/client/src/components/gauge/HydrologicalConditions.vue	Fri May 24 12:14:57 2019 +0200
@@ -7,7 +7,7 @@
       class="rounded-0"
     />
     <div class="d-flex flex-fill">
-      <DiagramLegend>
+      <DiagramLegend id="diagramlegendId">
         <div class="legend">
           <span
             style="background-color: red; width: 20px; height: 20px;"
@@ -368,6 +368,7 @@
           document.querySelector("#hydrologicalconditions-diagram-container")
             .clientWidth *
             2 +
+          document.querySelector("#diagramlegendId").clientWidth +
           "px";
         document.querySelector("#tmpContainer").style.height =
           document.querySelector("#hydrologicalconditions-diagram-container")
--- a/client/src/components/gauge/Waterlevel.vue	Fri May 24 12:13:55 2019 +0200
+++ b/client/src/components/gauge/Waterlevel.vue	Fri May 24 12:14:57 2019 +0200
@@ -7,7 +7,7 @@
       class="rounded-0"
     />
     <div class="d-flex flex-fill">
-      <DiagramLegend>
+      <DiagramLegend id="diagramlegendId">
         <div class="legend">
           <span
             style="background-color: steelblue; width: 20px; height: 20px;"
@@ -381,6 +381,7 @@
         document.querySelector("#pdfContainer").style.width =
           document.querySelector("#waterlevel-diagram-container").clientWidth *
             2 +
+          document.querySelector("#diagramlegendId").clientWidth +
           "px";
         document.querySelector("#pdfContainer").style.height =
           document.querySelector("#waterlevel-diagram-container").clientHeight +
--- a/client/src/components/layers/Layerselect.vue	Fri May 24 12:13:55 2019 +0200
+++ b/client/src/components/layers/Layerselect.vue	Fri May 24 12:14:57 2019 +0200
@@ -75,7 +75,8 @@
         if (
           this.layerId === "GAUGES" ||
           this.layerId === "STRETCHES" ||
-          this.layerId === "BOTTLENECKS"
+          this.layerId === "BOTTLENECKS" ||
+          this.layerId === "SECTIONS"
         ) {
           map.getLayer("DATAAVAILABILITY").changed();
         }
--- a/client/src/components/map/layers.js	Fri May 24 12:13:55 2019 +0200
+++ b/client/src/components/map/layers.js	Fri May 24 12:14:57 2019 +0200
@@ -526,7 +526,8 @@
               featureTypes: [
                 "bottlenecks_geoserver",
                 "gauges_geoserver",
-                "stretches_geoserver"
+                "stretches_geoserver",
+                "sections_geoserver"
               ]
             },
             source,
--- a/client/src/components/map/styles.js	Fri May 24 12:13:55 2019 +0200
+++ b/client/src/components/map/styles.js	Fri May 24 12:14:57 2019 +0200
@@ -247,24 +247,24 @@
       );
     } else {
       // TODO: Get information from feature and check the ranges according to #423, #424, #425
-      let colorWaterlevel;
+      let colorWaterlevel = "white";
       let colorComparison = "lime";
-      let colorAccuracy = "yellow";
-      let fa = feature.get("forecast_accuracy");
+      let colorAccuracy = "white";
+      let fa3d = feature.get("forecast_accuracy_3d");
       let fa1d = feature.get("forecast_accuracy_1d");
-      if (fa === null || fa === undefined) {
-        colorWaterlevel = "white";
-      } else if (fa < 15 && fa1d < 15) {
-        colorWaterlevel = "lime";
-      } else if (fa > 15 && fa1d < 15) {
-        colorWaterlevel = "yellow";
-      } else if (fa1d > 15) {
-        colorWaterlevel = "red";
+      if (typeof fa3d == "number" && typeof fa1d == "number") {
+        if (fa1d > 15) {
+          colorAccuracy = "red";
+        } else if (fa3d > 15) {
+          colorAccuracy = "yellow";
+        } else {
+          colorAccuracy = "lime";
+        }
       }
       let frame = `<polyline points='16,0 32,32 0,32 16,0' stroke='grey' stroke-width='1' fill='white'/>`;
       let waterlevel = `<polyline points="16,0 24,16 16,32 8,16 16,0" stroke='grey' stroke-width='1' fill='${colorWaterlevel}'/>`;
-      let comparison = `<polyline points="24,16 32,32 16,32 24,16" stroke='grey' stroke-width='1' fill='${colorComparison}'/>`;
-      let accuracy = `<polyline points="8,16 16,32 0,32 8,16" stroke='grey' stroke-width='1' fill='${colorAccuracy}'/>`;
+      let accuracy = `<polyline points="24,16 32,32 16,32 24,16" stroke='grey' stroke-width='1' fill='${colorAccuracy}'/>`;
+      let comparison = `<polyline points="8,16 16,32 0,32 8,16" stroke='grey' stroke-width='1' fill='${colorComparison}'/>`;
       let svg = `data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><g>${frame}${waterlevel}${comparison}${accuracy}</g></svg>`;
       let maps = store.state.map.openLayersMaps;
       let geom = feature.getGeometry();
@@ -278,7 +278,9 @@
           (m.getLayer("STRETCHES").getVisible() &&
             feature.getId().indexOf("stretches") > -1) ||
           (m.getLayer("BOTTLENECKS").getVisible() &&
-            feature.getId().indexOf("bottlenecks") > -1)
+            feature.getId().indexOf("bottlenecks") > -1) ||
+          (m.getLayer("SECTIONS").getVisible() &&
+            feature.getId().indexOf("sections") > -1)
         ) {
           s.push(
             new Style({
--- a/schema/geoserver_views.sql	Fri May 24 12:13:55 2019 +0200
+++ b/schema/geoserver_views.sql	Fri May 24 12:14:57 2019 +0200
@@ -18,7 +18,7 @@
         g.source_organization,
         r.rwls AS reference_water_levels,
         wl.water_level AS gm_waterlevel,
-        fca.forecast_accuracy,
+        fca.forecast_accuracy_3d,
         fca.forecast_accuracy_1d
     FROM waterway.gauges g
         LEFT JOIN (SELECT location, validity,
@@ -33,13 +33,13 @@
                     max(acc) FILTER (WHERE
                         measure_date <= current_timestamp + '1 day'::interval)
                         AS forecast_accuracy_1d,
-                    max(acc) AS forecast_accuracy
+                    max(acc) AS forecast_accuracy_3d
                 FROM waterway.gauge_predictions,
                     GREATEST(water_level - lower(conf_interval),
                         upper(conf_interval) - water_level) AS acc (acc)
                 WHERE measure_date
                     BETWEEN current_timestamp
-                        AND current_timestamp + '4 days'::interval
+                        AND current_timestamp + '3 days'::interval
                 GROUP BY location) AS fca
             USING (location)
     WHERE NOT g.erased;