changeset 843:d2aa972df342

client: add example for setting style * Add example how to set the bottleneck style, search for TODOSTYLE.
author Bernhard Reiter <bernhard@intevation.de>
date Fri, 28 Sep 2018 11:34:51 +0200
parents ee6f127f573c
children c2cba785ca4d
files client/src/map/Maplayer.vue
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/map/Maplayer.vue	Fri Sep 28 11:27:07 2018 +0200
+++ b/client/src/map/Maplayer.vue	Fri Sep 28 11:34:51 2018 +0200
@@ -26,6 +26,8 @@
 import { Vector as VectorLayer } from "ol/layer.js";
 import { Vector as VectorSource } from "ol/source.js";
 import { getLength } from "ol/sphere.js";
+import { Stroke, Style, Fill } from "ol/style.js";
+
 
 import distance from "@turf/distance";
 import {
@@ -437,6 +439,18 @@
         layer.data.getSource()
       )
     );
+    // 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)"
+            })
+          })
+    layer.data.setStyle(newstyle)
 
     // so none is shown
     // this.updateBottleneckFilter("1999-10-01");