aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/ReverseGeocoderHandler.java
diff options
context:
space:
mode:
authorjon-stumpf <jon.stumpf@gmail.com>2014-11-14 15:07:44 -0500
committerjon-stumpf <jon.stumpf@gmail.com>2014-11-14 21:10:31 -0500
commita54bd7f41229a0244c2a44fc571fc70feebe13a0 (patch)
treecd558989f491287b5d51ff511daf2c7db87f6ab7 /src/org/traccar/ReverseGeocoderHandler.java
parent74f88cf2cc40680869233bcdb97cece139985f96 (diff)
downloadtrackermap-server-a54bd7f41229a0244c2a44fc571fc70feebe13a0.tar.gz
trackermap-server-a54bd7f41229a0244c2a44fc571fc70feebe13a0.tar.bz2
trackermap-server-a54bd7f41229a0244c2a44fc571fc70feebe13a0.zip
Added option to choose if one ReverseGeoCodes invalid positions
Diffstat (limited to 'src/org/traccar/ReverseGeocoderHandler.java')
-rw-r--r--src/org/traccar/ReverseGeocoderHandler.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/org/traccar/ReverseGeocoderHandler.java b/src/org/traccar/ReverseGeocoderHandler.java
index 8bdd7ebfc..6d77ed253 100644
--- a/src/org/traccar/ReverseGeocoderHandler.java
+++ b/src/org/traccar/ReverseGeocoderHandler.java
@@ -26,9 +26,11 @@ import org.traccar.model.Position;
public class ReverseGeocoderHandler extends OneToOneDecoder {
private final ReverseGeocoder geocoder;
+ private final boolean processInvalidPositions;
- public ReverseGeocoderHandler(ReverseGeocoder geocoder) {
+ public ReverseGeocoderHandler(ReverseGeocoder geocoder, boolean processInvalidPositions ) {
this.geocoder = geocoder;
+ this.processInvalidPositions = processInvalidPositions;
}
@Override
@@ -39,13 +41,18 @@ public class ReverseGeocoderHandler extends OneToOneDecoder {
if (geocoder != null) {
if (msg instanceof Position) {
Position position = (Position) msg;
- position.setAddress(geocoder.getAddress(
- position.getLatitude(), position.getLongitude()));
+
+ if (processInvalidPositions || position.getValid()) {
+ position.setAddress(geocoder.getAddress(
+ position.getLatitude(), position.getLongitude()));
+ }
} else if (msg instanceof List) {
List<Position> positions = (List<Position>) msg;
for (Position position : positions) {
- position.setAddress(geocoder.getAddress(
- position.getLatitude(), position.getLongitude()));
+ if (processInvalidPositions || position.getValid()) {
+ position.setAddress(geocoder.getAddress(
+ position.getLatitude(), position.getLongitude()));
+ }
}
}
}