Omit exact duplicates before considering recent displacement.
This commit is contained in:
parent
fd206249f5
commit
53a1dab2fb
2 changed files with 7 additions and 13 deletions
|
@ -261,7 +261,12 @@ class TrackerService: Service()
|
||||||
{
|
{
|
||||||
// pass
|
// pass
|
||||||
}
|
}
|
||||||
else if (! isDifferentEnough(recent_displacement_locations.first(), location, omitRests))
|
else if (omitRests && recent_displacement_locations.last().latitude == location.latitude && recent_displacement_locations.last().longitude == location.longitude)
|
||||||
|
{
|
||||||
|
Log.i("VOUSSOIR", "Omitting due to identical to previous.")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
else if (omitRests && !isDifferentEnough(recent_displacement_locations.first(), location))
|
||||||
{
|
{
|
||||||
Log.i("VOUSSOIR", "Omitting due to too close to previous.")
|
Log.i("VOUSSOIR", "Omitting due to too close to previous.")
|
||||||
return
|
return
|
||||||
|
|
|
@ -146,19 +146,8 @@ fun isAccurateEnough(location: Location, locationAccuracyThreshold: Int): Boolea
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Checks if given location is different enough compared to previous location */
|
/* Checks if given location is different enough compared to previous location */
|
||||||
fun isDifferentEnough(previousLocation: Location?, location: Location, omitRests: Boolean): Boolean
|
fun isDifferentEnough(previousLocation: Location, location: Location): Boolean
|
||||||
{
|
{
|
||||||
// check if previous location is (not) available
|
|
||||||
if (previousLocation == null)
|
|
||||||
{
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! omitRests)
|
|
||||||
{
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// location.accuracy is given as 1 standard deviation, with a 68% chance
|
// location.accuracy is given as 1 standard deviation, with a 68% chance
|
||||||
// that the true position is within a circle of this radius.
|
// that the true position is within a circle of this radius.
|
||||||
// These formulas determine if the difference between the last point and
|
// These formulas determine if the difference between the last point and
|
||||||
|
|
Loading…
Reference in a new issue