diff options
-rw-r--r-- | src/org/traccar/FilterHandler.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/org/traccar/FilterHandler.java b/src/org/traccar/FilterHandler.java index 1cf4ccd86..93f71d4e1 100644 --- a/src/org/traccar/FilterHandler.java +++ b/src/org/traccar/FilterHandler.java @@ -26,6 +26,7 @@ public class FilterHandler extends BaseDataHandler { private boolean filterDuplicate; private long filterFuture; private boolean filterApproximate; + private int filterAccuracy; private boolean filterStatic; private int filterDistance; private int filterMaxSpeed; @@ -48,6 +49,10 @@ public class FilterHandler extends BaseDataHandler { this.filterFuture = filterFuture; } + public void setFilterAccuracy(int filterAccuracy) { + this.filterAccuracy = filterAccuracy; + } + public void setFilterApproximate(boolean filterApproximate) { this.filterApproximate = filterApproximate; } @@ -79,6 +84,7 @@ public class FilterHandler extends BaseDataHandler { filterZero = config.getBoolean("filter.zero"); filterDuplicate = config.getBoolean("filter.duplicate"); filterFuture = config.getLong("filter.future") * 1000; + filterAccuracy = config.getInteger("filter.accuracy"); filterApproximate = config.getBoolean("filter.approximate"); filterStatic = config.getBoolean("filter.static"); filterDistance = config.getInteger("filter.distance"); @@ -114,6 +120,10 @@ public class FilterHandler extends BaseDataHandler { return filterFuture != 0 && position.getFixTime().getTime() > System.currentTimeMillis() + filterFuture; } + private boolean filterAccuracy(Position position) { + return filterAccuracy != 0 && position.getAccuracy() > filterAccuracy; + } + private boolean filterApproximate(Position position) { return filterApproximate && position.getBoolean(Position.KEY_APPROXIMATE); } @@ -183,6 +193,9 @@ public class FilterHandler extends BaseDataHandler { if (filterFuture(position)) { filterType.append("Future "); } + if (filterAccuracy(position)) { + filterType.append("Accuracy "); + } if (filterApproximate(position)) { filterType.append("Approximate "); } |