aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/GeofenceMap.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-03 20:03:23 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-07-03 20:03:23 +1200
commitebb43a1d910595462b384e3d1bd6375672da5b84 (patch)
treec0cb06b37f1c9d3fb2260e7bd259a9141a4118f9 /web/app/view/GeofenceMap.js
parentdbb2e88db2c5af22172ea3642b27899b8164b40a (diff)
downloadtrackermap-server-ebb43a1d910595462b384e3d1bd6375672da5b84.tar.gz
trackermap-server-ebb43a1d910595462b384e3d1bd6375672da5b84.tar.bz2
trackermap-server-ebb43a1d910595462b384e3d1bd6375672da5b84.zip
Implement geofence saving
Diffstat (limited to 'web/app/view/GeofenceMap.js')
-rw-r--r--web/app/view/GeofenceMap.js25
1 files changed, 19 insertions, 6 deletions
diff --git a/web/app/view/GeofenceMap.js b/web/app/view/GeofenceMap.js
index 2538a8b16..e8a4dc5de 100644
--- a/web/app/view/GeofenceMap.js
+++ b/web/app/view/GeofenceMap.js
@@ -28,9 +28,12 @@ Ext.define('Traccar.view.GeofenceMap', {
tbar: {
items: [{
xtype: 'combobox',
- store: 'GeozoneTypes',
- valueField: 'id',
- displayField: 'name'
+ store: 'GeofenceTypes',
+ valueField: 'key',
+ displayField: 'name',
+ listeners: {
+ select: 'onTypeSelect'
+ }
}, {
xtype: 'tbfill'
}, {
@@ -42,6 +45,10 @@ Ext.define('Traccar.view.GeofenceMap', {
}]
},
+ getFeatures: function () {
+ return this.features;
+ },
+
initMap: function () {
var map, featureOverlay;
this.callParent();
@@ -79,15 +86,21 @@ Ext.define('Traccar.view.GeofenceMap', {
}));
},
- addInteraction: function () {
+ addInteraction: function (type) {
this.draw = new ol.interaction.Draw({
features: this.features,
- type: 'Polygon' // (typeSelect.value)
+ type: type
});
+ this.draw.on('drawstart', function () {
+ this.features.clear();
+ }, this);
this.map.addInteraction(this.draw);
},
removeInteraction: function () {
- this.map.removeInteraction(this.draw);
+ if (this.draw) {
+ this.map.removeInteraction(this.draw);
+ this.draw = null;
+ }
}
});