aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
authorRenaud Allard <r@bilbo.eriador.org>2016-10-17 09:55:53 +0200
committerRenaud Allard <r@bilbo.eriador.org>2016-10-17 09:55:53 +0200
commit9dd22617c1b066195baca5b6e6ae141c54493107 (patch)
treee120d382290e39b1fc03c336c873808211499cf8 /src/org
parent83ca0476167d91f16f18ae3cc532d56cd97f743e (diff)
downloadtrackermap-server-9dd22617c1b066195baca5b6e6ae141c54493107.tar.gz
trackermap-server-9dd22617c1b066195baca5b6e6ae141c54493107.tar.bz2
trackermap-server-9dd22617c1b066195baca5b6e6ae141c54493107.zip
Add a static filter. This will filter positions with speed = 0.0
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/FilterHandler.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/org/traccar/FilterHandler.java b/src/org/traccar/FilterHandler.java
index 5315bad9e..b6917cbfb 100644
--- a/src/org/traccar/FilterHandler.java
+++ b/src/org/traccar/FilterHandler.java
@@ -28,12 +28,13 @@ public class FilterHandler extends BaseDataHandler {
private final boolean filterDuplicate;
private final boolean filterFuture;
private final boolean filterApproximate;
+ private final boolean filterStatic;
private final int filterDistance;
private final long filterLimit;
public FilterHandler(
boolean filterInvalid, boolean filterZero, boolean filterDuplicate, boolean filterFuture,
- boolean filterApproximate, int filterDistance, long filterLimit) {
+ boolean filterApproximate, boolean filterStatic, int filterDistance, long filterLimit) {
this.filterInvalid = filterInvalid;
this.filterZero = filterZero;
@@ -41,6 +42,7 @@ public class FilterHandler extends BaseDataHandler {
this.filterDistance = filterDistance;
this.filterFuture = filterFuture;
this.filterApproximate = filterApproximate;
+ this.filterStatic = filterStatic;
this.filterLimit = filterLimit;
}
@@ -52,6 +54,7 @@ public class FilterHandler extends BaseDataHandler {
filterDuplicate = config.getBoolean("filter.duplicate");
filterFuture = config.getBoolean("filter.future");
filterApproximate = config.getBoolean("filter.approximate");
+ filterStatic = config.getBoolean("filter.static");
filterDistance = config.getInteger("filter.distance");
filterLimit = config.getLong("filter.limit") * 1000;
}
@@ -93,6 +96,10 @@ public class FilterHandler extends BaseDataHandler {
return filterApproximate && approximate != null && approximate;
}
+ private boolean filterStatic(Position position) {
+ return filterStatic && position.getSpeed() == 0.0;
+ }
+
private boolean filterDistance(Position position) {
if (filterDistance != 0) {
Position last = getLastPosition(position.getDeviceId());
@@ -125,7 +132,8 @@ public class FilterHandler extends BaseDataHandler {
private boolean filter(Position p) {
boolean result = filterInvalid(p) || filterZero(p) || filterDuplicate(p)
- || filterFuture(p) || filterApproximate(p) || filterDistance(p);
+ || filterFuture(p) || filterApproximate(p) || filterStatic(p)
+ || filterDistance(p);
if (filterLimit(p)) {
result = false;