From 63dc8265e5e1bc55a2c32a46b37470395c65bcb4 Mon Sep 17 00:00:00 2001 From: Ivan Martinez Date: Sun, 8 Apr 2018 10:21:13 -0300 Subject: use geofence attribute to permit per polyline distance configuration --- src/org/traccar/model/Geofence.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/org/traccar/model') diff --git a/src/org/traccar/model/Geofence.java b/src/org/traccar/model/Geofence.java index 7042325dc..acc81c203 100644 --- a/src/org/traccar/model/Geofence.java +++ b/src/org/traccar/model/Geofence.java @@ -65,7 +65,9 @@ public class Geofence extends ScheduledModel { } else if (area.startsWith("POLYGON")) { geometry = new GeofencePolygon(area); } else if (area.startsWith("LINESTRING")) { - geometry = new GeofencePolyline(area, Context.getConfig().getDouble("geofence.polylineDistance", 25)); + final double distance = getDouble("polylineDistance"); + geometry = new GeofencePolyline(area, distance >= 1 ? distance + : Context.getConfig().getDouble("geofence.polylineDistance", 25)); } else { throw new ParseException("Unknown geometry type", 0); } -- cgit v1.2.3 From 9ff9232e779f7e137fa8b0cba2e0b424ff4879f9 Mon Sep 17 00:00:00 2001 From: Ivan Martinez Date: Sun, 8 Apr 2018 18:53:02 -0300 Subject: just consider zero to check if defined --- src/org/traccar/model/Geofence.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/org/traccar/model') diff --git a/src/org/traccar/model/Geofence.java b/src/org/traccar/model/Geofence.java index acc81c203..8560d22e9 100644 --- a/src/org/traccar/model/Geofence.java +++ b/src/org/traccar/model/Geofence.java @@ -66,7 +66,7 @@ public class Geofence extends ScheduledModel { geometry = new GeofencePolygon(area); } else if (area.startsWith("LINESTRING")) { final double distance = getDouble("polylineDistance"); - geometry = new GeofencePolyline(area, distance >= 1 ? distance + geometry = new GeofencePolyline(area, distance > 0 ? distance : Context.getConfig().getDouble("geofence.polylineDistance", 25)); } else { throw new ParseException("Unknown geometry type", 0); -- cgit v1.2.3