diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-03-26 12:25:14 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-26 12:25:14 +1300 |
commit | 4938acc7d9d901eed6b33f047a312b9a89bdd957 (patch) | |
tree | a73ec33270d12219ad433bbf9294162b73da649c /src | |
parent | 799fb0de7dd7fae0d307985f6b2975c077c262d3 (diff) | |
parent | 0117dfeef0a7ffbc7a47d9681811177136336730 (diff) | |
download | trackermap-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')
-rw-r--r-- | src/org/traccar/geofence/GeofenceCircle.java | 6 |
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 |