aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/GeocoderHandler.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-06-20 13:44:35 +0500
committerAbyss777 <abyss@fox5.ru>2017-06-20 13:46:21 +0500
commit9129b6f4eb6ab58a83107e47c888bb4a3bbf0f90 (patch)
tree825c03638ad5f3fb73016035c35c97523edc8784 /src/org/traccar/GeocoderHandler.java
parent6f569b6d62b110c2679772c4a56122db6a614ed9 (diff)
downloadtrackermap-server-9129b6f4eb6ab58a83107e47c888bb4a3bbf0f90.tar.gz
trackermap-server-9129b6f4eb6ab58a83107e47c888bb4a3bbf0f90.tar.bz2
trackermap-server-9129b6f4eb6ab58a83107e47c888bb4a3bbf0f90.zip
- Combine 'DistanceHandler' and 'CoordinatesHandler'
- Move 'DistanceHandler' closer to beginning of pipeline - Use KEY_DISTANCE instead of distance recalculation
Diffstat (limited to 'src/org/traccar/GeocoderHandler.java')
-rw-r--r--src/org/traccar/GeocoderHandler.java6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/org/traccar/GeocoderHandler.java b/src/org/traccar/GeocoderHandler.java
index c5f4d2f9a..2742ff1a7 100644
--- a/src/org/traccar/GeocoderHandler.java
+++ b/src/org/traccar/GeocoderHandler.java
@@ -22,7 +22,6 @@ import org.jboss.netty.channel.Channels;
import org.jboss.netty.channel.MessageEvent;
import org.traccar.geocoder.AddressFormat;
import org.traccar.geocoder.Geocoder;
-import org.traccar.helper.DistanceCalculator;
import org.traccar.helper.Log;
import org.traccar.model.Position;
@@ -62,10 +61,7 @@ public class GeocoderHandler implements ChannelUpstreamHandler {
if (geocoderReuseDistance != 0) {
Position lastPosition = Context.getIdentityManager().getLastPosition(position.getDeviceId());
if (lastPosition != null && lastPosition.getAddress() != null) {
- double distance = DistanceCalculator.distance(
- position.getLatitude(), position.getLongitude(),
- lastPosition.getLatitude(), lastPosition.getLongitude());
- if (distance <= geocoderReuseDistance) {
+ if (position.getDouble(Position.KEY_DISTANCE) <= geocoderReuseDistance) {
position.setAddress(lastPosition.getAddress());
Channels.fireMessageReceived(ctx, position, event.getRemoteAddress());
return;