aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/model')
-rw-r--r--src/main/java/org/traccar/model/Geofence.java22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/main/java/org/traccar/model/Geofence.java b/src/main/java/org/traccar/model/Geofence.java
index 5b857580d..9259028fb 100644
--- a/src/main/java/org/traccar/model/Geofence.java
+++ b/src/main/java/org/traccar/model/Geofence.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2022 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,26 +15,19 @@
*/
package org.traccar.model;
-import java.text.ParseException;
-
-import org.traccar.Context;
-import org.traccar.config.Keys;
-import org.traccar.storage.QueryIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnore;
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;
+import org.traccar.storage.QueryIgnore;
import org.traccar.storage.StorageName;
+import java.text.ParseException;
+
@StorageName("tc_geofences")
public class Geofence extends ScheduledModel {
- 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;
public String getName() {
@@ -68,9 +61,7 @@ public class Geofence extends ScheduledModel {
} else if (area.startsWith("POLYGON")) {
geometry = new GeofencePolygon(area);
} else if (area.startsWith("LINESTRING")) {
- final double distance = getDouble("polylineDistance");
- geometry = new GeofencePolyline(area, distance > 0 ? distance
- : Context.getConfig().getDouble(Keys.GEOFENCE_POLYLINE_DISTANCE));
+ geometry = new GeofencePolyline(area);
} else {
throw new ParseException("Unknown geometry type", 0);
}
@@ -92,4 +83,5 @@ public class Geofence extends ScheduledModel {
area = geometry.toWkt();
this.geometry = geometry;
}
+
}