changeset 2508:ae257e0238f1

merged critical-bottlenecks into default branch Contains one change that was unintentionally committed to the critical-bottlenecks branch. e13daf439068 and 51dbcbf11c5f
author Markus Kottlaender <markus@intevation.de>
date Tue, 05 Mar 2019 08:46:55 +0100
parents bc0f1771497a (current diff) ac0e2cf199e7 (diff)
children 3dc7c0f60a62
files
diffstat 4 files changed, 75 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Maplayer.vue	Mon Mar 04 16:30:46 2019 +0100
+++ b/client/src/components/Maplayer.vue	Tue Mar 05 08:46:55 2019 +0100
@@ -367,6 +367,20 @@
     );
     layer.data.setVisible(layer.isVisible);
 
+    layer = this.getLayerByName(LAYERS.BOTTLENECKSTATUS);
+    layer.data.getSource().setLoader(
+      this.buildVectorLoader(
+        {
+          featureNS: "gemma",
+          featurePrefix: "gemma",
+          featureTypes: ["bottlenecks_geoserver"],
+          geometryName: "area"
+        },
+        "/internal/wfs",
+        layer.data.getSource()
+      )
+    );
+
     layer = this.getLayerByName(LAYERS.BOTTLENECKS);
     layer.data.getSource().setLoader(
       this.buildVectorLoader(
@@ -385,22 +399,22 @@
       headers: { "X-Gemma-Auth": localStorage.getItem("token") }
     })
       .then(response => {
-        this.btlnStrokeC = response.data.code;
+        let btlnStrokeC = response.data.code;
         HTTP.get("/system/style/Bottlenecks/fill", {
           headers: { "X-Gemma-Auth": localStorage.getItem("token") }
         })
           .then(response => {
-            this.btlnFillC = response.data.code;
-            var newstyle = new Style({
+            let btlnFillC = response.data.code;
+            var newStyle = new Style({
               stroke: new Stroke({
-                color: this.btlnStrokeC,
+                color: btlnStrokeC,
                 width: 4
               }),
               fill: new Fill({
-                color: this.btlnFillC
+                color: btlnFillC
               })
             });
-            layer.data.setStyle(newstyle);
+            layer.data.setStyle(newStyle);
           })
           .catch(error => {
             console.log(error);
--- a/client/src/components/layers/LegendElement.vue	Mon Mar 04 16:30:46 2019 +0100
+++ b/client/src/components/layers/LegendElement.vue	Tue Mar 05 08:46:55 2019 +0100
@@ -95,7 +95,8 @@
         }
         mapStyle = this.mapLayer.data.getStyleFunction()(
           feature,
-          this.mapLayer.forLegendStyle.resolution
+          this.mapLayer.forLegendStyle.resolution,
+          true
         );
       }
 
--- a/client/src/components/usermanagement/Usermanagement.vue	Mon Mar 04 16:30:46 2019 +0100
+++ b/client/src/components/usermanagement/Usermanagement.vue	Tue Mar 05 08:46:55 2019 +0100
@@ -172,6 +172,7 @@
     sortedUsers() {
       const start = (this.currentPage - 1) * this.pageSize;
       return this.users
+        .filter(u => u) // to clone the array and leave the original store value intact
         .sort((a, b) => {
           if (
             a[this.sortColumn].toLowerCase() < b[this.sortColumn].toLowerCase()
--- a/client/src/store/map.js	Mon Mar 04 16:30:46 2019 +0100
+++ b/client/src/store/map.js	Tue Mar 05 08:46:55 2019 +0100
@@ -52,6 +52,7 @@
   WATERWAYAXIS: "Waterway Axis",
   WATERWAYPROFILES: "Waterway Profiles",
   BOTTLENECKS: "Bottlenecks",
+  BOTTLENECKSTATUS: "Critical Bottlenecks",
   BOTTLENECKISOLINE: "Bottleneck isolines",
   DISTANCEMARKS: "Distance marks",
   DISTANCEMARKSAXIS: "Distance marks, Axis",
@@ -288,15 +289,17 @@
           source: new VectorSource({
             strategy: bboxStrategy
           }),
-          style: new Style({
-            stroke: new Stroke({
-              color: "rgba(230, 230, 10, .8)",
-              width: 4
-            }),
-            fill: new Fill({
-              color: "rgba(230, 230, 10, .3)"
-            })
-          })
+          style: function() {
+            return new Style({
+              stroke: new Stroke({
+                color: "rgba(230, 230, 10, .8)",
+                width: 4
+              }),
+              fill: new Fill({
+                color: "rgba(230, 230, 10, .3)"
+              })
+            });
+          }
         }),
         isVisible: true,
         showInLegend: true
@@ -330,6 +333,46 @@
         showInLegend: true
       },
       {
+        name: LAYERS.BOTTLENECKSTATUS,
+        forLegendStyle: { point: true, resolution: 16 },
+        data: new VectorLayer({
+          source: new VectorSource({
+            strategy: bboxStrategy
+          }),
+          style: function(feature, resolution, isLegend) {
+            if ((feature.get("fa_critical") && resolution > 15) || isLegend) {
+              let bnCenter = getCenter(feature.getGeometry().getExtent());
+              return new Style({
+                geometry: new Point(bnCenter),
+                image: new RegularShape({
+                  points: 3,
+                  radius: isLegend ? 9 : 13,
+                  fill: new Fill({ color: "white" }),
+                  stroke: new Stroke({
+                    color: "rgba(255, 0, 0, 0.8)",
+                    width: isLegend ? 2 : 3
+                  })
+                }),
+                text: new Text({
+                  font:
+                    "bold " +
+                    (isLegend ? 8 : 12) +
+                    'px "Open Sans", "sans-serif"',
+                  placement: "point",
+                  fill: new Fill({ color: "black" }),
+                  text: "!",
+                  offsetY: isLegend ? 0 : 1,
+                  offsetX: isLegend ? 1 : 0
+                })
+              });
+            }
+            return [];
+          }
+        }),
+        isVisible: true,
+        showInLegend: true
+      },
+      {
         name: LAYERS.DISTANCEMARKS,
         forLegendStyle: { point: true, resolution: 8 },
         data: new VectorLayer({