aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/handler/DistanceHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/handler/DistanceHandler.java')
-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;