From 0117dfeef0a7ffbc7a47d9681811177136336730 Mon Sep 17 00:00:00 2001 From: Ivan Martinez Date: Sun, 25 Mar 2018 20:19:46 -0300 Subject: method to calculate distance from center of circle --- src/org/traccar/geofence/GeofenceCircle.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/org/traccar/geofence/GeofenceCircle.java') 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 -- cgit v1.2.3