aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-02-06 09:21:39 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-02-06 09:21:39 +1300
commitdd0fe191acd245b6a66240bd5daa736e873d043e (patch)
tree5334ea5ce027d96a433460cc189c631d66e8be6d /src/org
parent654116f06161a6f73d23a6bb610f5420cebfdfc9 (diff)
downloadtrackermap-server-dd0fe191acd245b6a66240bd5daa736e873d043e.tar.gz
trackermap-server-dd0fe191acd245b6a66240bd5daa736e873d043e.tar.bz2
trackermap-server-dd0fe191acd245b6a66240bd5daa736e873d043e.zip
Implement accuracy filtering
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/FilterHandler.java13
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 ");
}