aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/MapController.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-12-29 22:37:47 +1300
committerGitHub <noreply@github.com>2016-12-29 22:37:47 +1300
commit3362bc6315a7711b40649ee3a07fbfc8b0ff4ef8 (patch)
tree3156cbf7fd36a77badcdd7cd9a6cebbdf22f366d /web/app/view/MapController.js
parent4b83eba6511c6333a3cefaef59055db7e7764e3d (diff)
parent9099fd92f984b26090072f6553dff55b713589d7 (diff)
downloadtrackermap-web-3362bc6315a7711b40649ee3a07fbfc8b0ff4ef8.tar.gz
trackermap-web-3362bc6315a7711b40649ee3a07fbfc8b0ff4ef8.tar.bz2
trackermap-web-3362bc6315a7711b40649ee3a07fbfc8b0ff4ef8.zip
Merge pull request #376 from Abyss777/color_geofences
Add support for geofence colors
Diffstat (limited to 'web/app/view/MapController.js')
-rw-r--r--web/app/view/MapController.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js
index b8e2657d..66d6809a 100644
--- a/web/app/view/MapController.js
+++ b/web/app/view/MapController.js
@@ -86,13 +86,22 @@ Ext.define('Traccar.view.MapController', {
this.fireEvent('togglestate', state);
},
- getGeofenceStyle: function (label) {
+ getGeofenceStyle: function (label, color) {
+ var fillColor, strokeColor;
+ if (color) {
+ fillColor = ol.color.asArray(color);
+ strokeColor = color;
+ } else {
+ fillColor = ol.color.asArray(Traccar.Style.mapGeofenceColor);
+ strokeColor = Traccar.Style.mapGeofenceColor;
+ }
+ fillColor[3] = Traccar.Style.mapGeofenceOverlayOpacity;
return new ol.style.Style({
fill: new ol.style.Fill({
- color: Traccar.Style.mapGeofenceOverlay
+ color: fillColor
}),
stroke: new ol.style.Stroke({
- color: Traccar.Style.mapGeofenceColor,
+ color: strokeColor,
width: Traccar.Style.mapGeofenceWidth
}),
text: new ol.style.Text({
@@ -114,7 +123,8 @@ Ext.define('Traccar.view.MapController', {
Ext.getStore('Geofences').each(function (geofence) {
var feature = new ol.Feature(Traccar.GeofenceConverter
.wktToGeometry(this.getView().getMapView(), geofence.get('area')));
- feature.setStyle(this.getGeofenceStyle(geofence.get('name')));
+ feature.setStyle(this.getGeofenceStyle(geofence.get('name'),
+ geofence.get('attributes') ? geofence.get('attributes').color : null));
this.getView().getGeofencesSource().addFeature(feature);
return true;
}, this);