aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-03-26 12:25:14 +1300
committerGitHub <noreply@github.com>2018-03-26 12:25:14 +1300
commit4938acc7d9d901eed6b33f047a312b9a89bdd957 (patch)
treea73ec33270d12219ad433bbf9294162b73da649c /src/org
parent799fb0de7dd7fae0d307985f6b2975c077c262d3 (diff)
parent0117dfeef0a7ffbc7a47d9681811177136336730 (diff)
downloadtrackermap-server-4938acc7d9d901eed6b33f047a312b9a89bdd957.tar.gz
trackermap-server-4938acc7d9d901eed6b33f047a312b9a89bdd957.tar.bz2
trackermap-server-4938acc7d9d901eed6b33f047a312b9a89bdd957.zip
Merge pull request #3822 from ivanfmartinez/circle_distance
Method to calculate distance from center of circle
Diffstat (limited to 'src/org')
-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