changeset 858:e5ac0fb0c1c5

map styling: Very ugly hack to read bottleneck style from server.
author Sascha Wilde <wilde@intevation.de>
date Fri, 28 Sep 2018 16:53:28 +0200
parents ce0d50b1d126
children f82c31428a27
files client/src/map/Maplayer.vue
diffstat 1 files changed, 27 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/map/Maplayer.vue	Fri Sep 28 14:13:51 2018 +0200
+++ b/client/src/map/Maplayer.vue	Fri Sep 28 16:53:28 2018 +0200
@@ -441,16 +441,34 @@
     );
     // TODOSTYLE add backend request (like search for 'HTTP')
     // and use result to construct a new style like
-    var newstyle = new Style({
-      stroke: new Stroke({
-        color: "rgba(230, 30, 10, .8)",
-        width: 4
-      }),
-      fill: new Fill({
-        color: "rgba(230, 30, 10, .3)"
+    HTTP.get("/system/style/Bottlenecks/stroke", {
+      headers: { "X-Gemma-Auth": localStorage.getItem("token") }
+    })
+      .then(response => {
+        this.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({
+              stroke: new Stroke({
+                color: this.btlnStrokeC,
+                width: 4
+              }),
+              fill: new Fill({
+                color: this.btlnFillC
+              })
+            });
+            layer.data.setStyle(newstyle);
+          })
+          .catch(error => {
+            console.log(error);
+          });
       })
-    });
-    layer.data.setStyle(newstyle);
+      .catch(error => {
+        console.log(error);
+      });
 
     // so none is shown
     // this.updateBottleneckFilter("1999-10-01");