Skip to content

Commit

Permalink
Make color of measure features configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismayer committed Jul 2, 2018
1 parent e274dda commit 48fda06
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
20 changes: 11 additions & 9 deletions src/components/measuretool/MeasureWin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,24 +94,25 @@
* map.
*/
createMeasureLayer () {
var me = this;
const me = this;
const measureConf = me.$appConfig.modules.wgumeasure || {};
// create a vector layer to
var source = new VectorSource();
var vector = new VectorLayer({
name: 'Measure Layer',
source: source,
style: new Style({
fill: new Fill({
color: 'rgba(255, 255, 255, 0.2)'
color: measureConf.fillColor || 'rgba(255, 255, 255, 0.2)'
}),
stroke: new Stroke({
color: 'rgba(0, 0, 0, 0.7)',
color: measureConf.strokeColor || 'rgba(0, 0, 0, 0.5)',
width: 2
}),
image: new Circle({
radius: 7,
fill: new Fill({
color: 'rgba(0, 0, 0, 0.7)'
color: measureConf.vertexFillColor || 'rgba(0, 0, 0, 0.7)'
})
})
})
Expand All @@ -126,7 +127,8 @@
* Creates and adds the necessary draw interaction and adds it to the map.
*/
addInteraction () {
var me = this;
const me = this;
const measureConf = me.$appConfig.modules.wgumeasure || {};
// cleanup possible old draw interaction
if (me.draw) {
me.removeInteraction();
Expand All @@ -138,20 +140,20 @@
type: type,
style: new Style({
fill: new Fill({
color: 'rgba(255, 255, 255, 0.2)'
color: measureConf.sketchFillColor || 'rgba(255, 255, 255, 0.2)'
}),
stroke: new Stroke({
color: 'rgba(0, 0, 0, 0.5)',
color: measureConf.sketchStrokeColor || 'rgba(0, 0, 0, 0.5)',
lineDash: [10, 10],
width: 2
}),
image: new Circle({
radius: 5,
stroke: new Stroke({
color: 'rgba(0, 0, 0, 0.7)'
color: measureConf.sketchVertexStrokeColor || 'rgba(0, 0, 0, 0.7)'
}),
fill: new Fill({
color: 'rgba(255, 255, 255, 0.2)'
color: measureConf.sketchVertexFillColor || 'rgba(255, 255, 255, 0.2)'
})
})
})
Expand Down
15 changes: 14 additions & 1 deletion static/app-conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@
"displayInLayerList": true
}

]
],

"modules": {
"wgumeasure": {
"strokeColor": "#c62828",
"fillColor": "rgba(198,40,40,0.2)",
"vertexStrokeColor": "#c62828",
"vertexFillColor": "#c62828",
"sketchStrokeColor": "rgba(198,40,40,0.8)",
"sketchFillColor": "rgba(198,40,40,0.1)",
"sketchVertexStrokeColor": "#c62828",
"sketchVertexFillColor": "rgba(198,40,40,0.2)"
}
}

}

0 comments on commit 48fda06

Please sign in to comment.