aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/model/Geofence.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-11-26 19:33:54 +0700
committerAbyss777 <abyss@fox5.ru>2016-11-26 19:33:54 +0700
commitb09d0e98541edc7122d992e85547741ffd57f72a (patch)
tree9b5011d5aefbcc32c378336ce103106e0a7e40d5 /src/org/traccar/model/Geofence.java
parent6d022a7cbdacc747dd8517a8c82c3238d63637ac (diff)
downloadtrackermap-server-b09d0e98541edc7122d992e85547741ffd57f72a.tar.gz
trackermap-server-b09d0e98541edc7122d992e85547741ffd57f72a.tar.bz2
trackermap-server-b09d0e98541edc7122d992e85547741ffd57f72a.zip
Implement polyline geofence
Diffstat (limited to 'src/org/traccar/model/Geofence.java')
-rw-r--r--src/org/traccar/model/Geofence.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/org/traccar/model/Geofence.java b/src/org/traccar/model/Geofence.java
index ecfd3101c..326c45b5f 100644
--- a/src/org/traccar/model/Geofence.java
+++ b/src/org/traccar/model/Geofence.java
@@ -17,9 +17,11 @@ package org.traccar.model;
import java.text.ParseException;
+import org.traccar.Context;
import org.traccar.geofence.GeofenceCircle;
import org.traccar.geofence.GeofenceGeometry;
import org.traccar.geofence.GeofencePolygon;
+import org.traccar.geofence.GeofencePolyline;
import com.fasterxml.jackson.annotation.JsonIgnore;
@@ -27,6 +29,7 @@ public class Geofence extends Extensible {
public static final String TYPE_GEOFENCE_CILCLE = "geofenceCircle";
public static final String TYPE_GEOFENCE_POLYGON = "geofencePolygon";
+ public static final String TYPE_GEOFENCE_POLYLINE = "geofencePolyline";
private String name;
@@ -60,6 +63,8 @@ public class Geofence extends Extensible {
geometry = new GeofenceCircle(area);
} else if (area.startsWith("POLYGON")) {
geometry = new GeofencePolygon(area);
+ } else if (area.startsWith("LINESTRING")) {
+ geometry = new GeofencePolyline(area, Context.getConfig().getDouble("geofence.polylineDistance", 25));
} else {
throw new ParseException("Unknown geometry type", 0);
}