aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/model/Geofence.java
diff options
context:
space:
mode:
authorcasswarry0 <casswarry0@gmail.com>2023-01-17 17:14:53 -0700
committercasswarry0 <casswarry0@gmail.com>2023-01-17 17:14:53 -0700
commit7338b8730949ed027b3f8b31d7dca20687ebbb8b (patch)
treec2d171e6121818ab511460a786f69aab97a2a628 /src/main/java/org/traccar/model/Geofence.java
parentcdecd3fa4427a382c0b09f8ad9d69ec14388960a (diff)
parent85501f9cf4918d5eee345f83aed7a31eecb26b8d (diff)
downloadtrackermap-server-7338b8730949ed027b3f8b31d7dca20687ebbb8b.tar.gz
trackermap-server-7338b8730949ed027b3f8b31d7dca20687ebbb8b.tar.bz2
trackermap-server-7338b8730949ed027b3f8b31d7dca20687ebbb8b.zip
Merge branch 'master' into develop
Diffstat (limited to 'src/main/java/org/traccar/model/Geofence.java')
-rw-r--r--src/main/java/org/traccar/model/Geofence.java22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/main/java/org/traccar/model/Geofence.java b/src/main/java/org/traccar/model/Geofence.java
index 85f392f99..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,24 +15,19 @@
*/
package org.traccar.model;
-import java.text.ParseException;
-
-import org.traccar.Context;
-import org.traccar.config.Keys;
-import org.traccar.database.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 org.traccar.storage.QueryIgnore;
+import org.traccar.storage.StorageName;
-import com.fasterxml.jackson.annotation.JsonIgnore;
+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() {
@@ -66,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);
}
@@ -90,4 +83,5 @@ public class Geofence extends ScheduledModel {
area = geometry.toWkt();
this.geometry = geometry;
}
+
}