aboutsummaryrefslogtreecommitdiff
path: root/web/app/view
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-07-05 00:48:06 +1200
committerGitHub <noreply@github.com>2016-07-05 00:48:06 +1200
commitbcc20a915c61d7a86fd19b03ec1ab55ac5cf8527 (patch)
tree6e6a7fdbc462eae8858f6da0f5ebc68c0225d078 /web/app/view
parentc8735de4c31037f16b5f68420bff2d2f6419bae5 (diff)
parentdc8db55c8a74d26644d9dc449b4f35c76a2e031f (diff)
downloadtrackermap-server-bcc20a915c61d7a86fd19b03ec1ab55ac5cf8527.tar.gz
trackermap-server-bcc20a915c61d7a86fd19b03ec1ab55ac5cf8527.tar.bz2
trackermap-server-bcc20a915c61d7a86fd19b03ec1ab55ac5cf8527.zip
Merge pull request #2077 from Abyss777/master
Load area for editing geofence
Diffstat (limited to 'web/app/view')
-rw-r--r--web/app/view/GeofenceDialogController.js6
-rw-r--r--web/app/view/GeofenceMap.js14
2 files changed, 17 insertions, 3 deletions
diff --git a/web/app/view/GeofenceDialogController.js b/web/app/view/GeofenceDialogController.js
index c8d518514..b04935b9c 100644
--- a/web/app/view/GeofenceDialogController.js
+++ b/web/app/view/GeofenceDialogController.js
@@ -37,10 +37,14 @@ Ext.define('Traccar.view.GeofenceDialogController', {
},
onAreaClick: function (button) {
+ var dialog, record;
+ dialog = button.up('window').down('form');
+ record = dialog.getRecord();
Ext.create('Traccar.view.BaseWindow', {
title: Strings.sharedArea,
items: {
- xtype: 'geofenceMapView'
+ xtype: 'geofenceMapView',
+ area: record.get('area')
}
}).show();
}
diff --git a/web/app/view/GeofenceMap.js b/web/app/view/GeofenceMap.js
index e8a4dc5de..165daf40d 100644
--- a/web/app/view/GeofenceMap.js
+++ b/web/app/view/GeofenceMap.js
@@ -19,7 +19,8 @@ Ext.define('Traccar.view.GeofenceMap', {
xtype: 'geofenceMapView',
requires: [
- 'Traccar.view.GeofenceMapController'
+ 'Traccar.view.GeofenceMapController',
+ 'Traccar.GeofenceConverter'
],
controller: 'geofenceMap',
@@ -50,12 +51,21 @@ Ext.define('Traccar.view.GeofenceMap', {
},
initMap: function () {
- var map, featureOverlay;
+ var map, featureOverlay, geometry;
this.callParent();
map = this.map;
this.features = new ol.Collection();
+ if (this.area !== "") {
+ geometry = Traccar.GeofenceConverter.wktToGeometry(this.mapView, this.area);
+ this.features.push(new ol.Feature(geometry));
+ if (geometry instanceof ol.geom.Circle) {
+ this.mapView.setCenter(geometry.getCenter());
+ } else if (geometry instanceof ol.geom.Polygon) {
+ this.mapView.setCenter(geometry.getCoordinates()[0][0]);
+ }
+ }
featureOverlay = new ol.layer.Vector({
source: new ol.source.Vector({
features: this.features