diff options
Diffstat (limited to 'web/app/GeofenceConverter.js')
-rw-r--r-- | web/app/GeofenceConverter.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/web/app/GeofenceConverter.js b/web/app/GeofenceConverter.js index ce529b1f..d3d562e7 100644 --- a/web/app/GeofenceConverter.js +++ b/web/app/GeofenceConverter.js @@ -19,10 +19,15 @@ Ext.define('Traccar.GeofenceConverter', { singleton: true, wktToGeometry: function (mapView, wkt) { +<<<<<<< HEAD var geometry, projection, resolutionAtEquator, pointResolution, resolutionFactor, points = [], center, radius, content, i, lat, lon, coordinates; +======= + var geometry, projection, resolutionAtEquator, pointResolution, resolutionFactor, + points = [], center, radius, content, i, lat, lon, coordinates; +>>>>>>> e0bb9b92d07176677b3043530660af3bc30774d7 if (wkt.lastIndexOf('POLYGON', 0) === 0) { - content = wkt.match(/\([^\(\)]+\)/); + content = wkt.match(/\([^()]+\)/); if (content !== null) { coordinates = content[0].match(/-?\d+\.?\d*/g); if (coordinates !== null) { @@ -36,7 +41,7 @@ Ext.define('Traccar.GeofenceConverter', { } } } else if (wkt.lastIndexOf('CIRCLE', 0) === 0) { - content = wkt.match(/\([^\(\)]+\)/); + content = wkt.match(/\([^()]+\)/); if (content !== null) { coordinates = content[0].match(/-?\d+\.?\d*/g); if (coordinates !== null) { @@ -45,12 +50,12 @@ Ext.define('Traccar.GeofenceConverter', { resolutionAtEquator = mapView.getResolution(); pointResolution = ol.proj.getPointResolution(projection, resolutionAtEquator, center); resolutionFactor = resolutionAtEquator / pointResolution; - radius = (Number(coordinates[2]) / ol.proj.METERS_PER_UNIT.m) * resolutionFactor; + radius = Number(coordinates[2]) / ol.proj.METERS_PER_UNIT.m * resolutionFactor; geometry = new ol.geom.Circle(center, radius); } } } else if (wkt.lastIndexOf('LINESTRING', 0) === 0) { - content = wkt.match(/\([^\(\)]+\)/); + content = wkt.match(/\([^()]+\)/); if (content !== null) { coordinates = content[0].match(/-?\d+\.?\d*/g); if (coordinates !== null) { @@ -79,7 +84,7 @@ Ext.define('Traccar.GeofenceConverter', { ol.proj.transform(edgeCoordinate, projection, 'EPSG:4326')); result = 'CIRCLE ('; result += center[1] + ' ' + center[0] + ', '; - result += Number((groundRadius).toFixed(1)) + ')'; + result += groundRadius.toFixed(1) + ')'; } else if (geometry instanceof ol.geom.Polygon) { geometry.transform(projection, 'EPSG:4326'); points = geometry.getCoordinates(); |