aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/GeofenceMap.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view/GeofenceMap.js')
-rw-r--r--web/app/view/GeofenceMap.js14
1 files changed, 12 insertions, 2 deletions
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