aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/geofence/GeofenceCircle.java
diff options
context:
space:
mode:
authorIvan Martinez <ivanfmartinez@users.noreply.github.com>2018-03-25 20:19:46 -0300
committerIvan Martinez <ivanfmartinez@users.noreply.github.com>2018-03-25 20:19:46 -0300
commit0117dfeef0a7ffbc7a47d9681811177136336730 (patch)
treea73ec33270d12219ad433bbf9294162b73da649c /src/org/traccar/geofence/GeofenceCircle.java
parent799fb0de7dd7fae0d307985f6b2975c077c262d3 (diff)
downloadtrackermap-server-0117dfeef0a7ffbc7a47d9681811177136336730.tar.gz
trackermap-server-0117dfeef0a7ffbc7a47d9681811177136336730.tar.bz2
trackermap-server-0117dfeef0a7ffbc7a47d9681811177136336730.zip
method to calculate distance from center of circle
Diffstat (limited to 'src/org/traccar/geofence/GeofenceCircle.java')
-rw-r--r--src/org/traccar/geofence/GeofenceCircle.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/org/traccar/geofence/GeofenceCircle.java b/src/org/traccar/geofence/GeofenceCircle.java
index d78734714..f6fca63ca 100644
--- a/src/org/traccar/geofence/GeofenceCircle.java
+++ b/src/org/traccar/geofence/GeofenceCircle.java
@@ -39,9 +39,13 @@ public class GeofenceCircle extends GeofenceGeometry {
this.radius = radius;
}
+ public double distanceFromCenter(double latitude, double longitude) {
+ return DistanceCalculator.distance(centerLatitude, centerLongitude, latitude, longitude);
+ }
+
@Override
public boolean containsPoint(double latitude, double longitude) {
- return DistanceCalculator.distance(centerLatitude, centerLongitude, latitude, longitude) <= radius;
+ return distanceFromCenter(latitude, longitude) <= radius;
}
@Override