aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-08-07 17:27:57 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-08-07 17:27:57 -0700
commit3ae0b76c4c8129833ef3b7a51275b2ad2586ac04 (patch)
treefecc2d6f57e35b26d62ef7616a9bfeac7905116a
parent3b62f3c29e181f6c3aefbfeff24281ed3332562e (diff)
downloadtrackermap-server-3ae0b76c4c8129833ef3b7a51275b2ad2586ac04.tar.gz
trackermap-server-3ae0b76c4c8129833ef3b7a51275b2ad2586ac04.tar.bz2
trackermap-server-3ae0b76c4c8129833ef3b7a51275b2ad2586ac04.zip
Simplify coordinates filtering
-rw-r--r--src/main/java/org/traccar/handler/DistanceHandler.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/handler/DistanceHandler.java b/src/main/java/org/traccar/handler/DistanceHandler.java
index a336a884e..1e7e444f6 100644
--- a/src/main/java/org/traccar/handler/DistanceHandler.java
+++ b/src/main/java/org/traccar/handler/DistanceHandler.java
@@ -1,6 +1,6 @@
/*
* Copyright 2015 Amila Silva
- * Copyright 2016 - 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2021 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,11 +61,11 @@ public class DistanceHandler extends BaseDataHandler {
last.getLatitude(), last.getLongitude());
distance = BigDecimal.valueOf(distance).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
}
- if (filter && last.getValid() && last.getLatitude() != 0 && last.getLongitude() != 0) {
+ if (filter && last.getLatitude() != 0 && last.getLongitude() != 0) {
boolean satisfiesMin = coordinatesMinError == 0 || distance > coordinatesMinError;
- boolean satisfiesMax = coordinatesMaxError == 0
- || distance < coordinatesMaxError || position.getValid();
+ boolean satisfiesMax = coordinatesMaxError == 0 || distance < coordinatesMaxError;
if (!satisfiesMin || !satisfiesMax) {
+ position.setValid(last.getValid());
position.setLatitude(last.getLatitude());
position.setLongitude(last.getLongitude());
distance = 0;