Avoid route recalculation
This commit is contained in:
parent
c94256a1f2
commit
ea95f78199
1 changed files with 2 additions and 2 deletions
|
@ -183,7 +183,7 @@ public class RoutingHelper {
|
||||||
} else {
|
} else {
|
||||||
float posTolerance = POSITION_TOLERANCE;
|
float posTolerance = POSITION_TOLERANCE;
|
||||||
if(currentLocation.hasAccuracy()) {
|
if(currentLocation.hasAccuracy()) {
|
||||||
posTolerance = POSITION_TOLERANCE / 3 + currentLocation.getAccuracy();
|
posTolerance = POSITION_TOLERANCE / 2 + currentLocation.getAccuracy();
|
||||||
}
|
}
|
||||||
// 1. Update current route position status according to latest received location
|
// 1. Update current route position status according to latest received location
|
||||||
boolean finished = updateCurrentRouteStatus(currentLocation, posTolerance);
|
boolean finished = updateCurrentRouteStatus(currentLocation, posTolerance);
|
||||||
|
@ -205,7 +205,7 @@ public class RoutingHelper {
|
||||||
// 3. Identify wrong movement direction (very similar to 2?)
|
// 3. Identify wrong movement direction (very similar to 2?)
|
||||||
Location next = route.getNextRouteLocation();
|
Location next = route.getNextRouteLocation();
|
||||||
boolean wrongMovementDirection = checkWrongMovementDirection(currentLocation, next);
|
boolean wrongMovementDirection = checkWrongMovementDirection(currentLocation, next);
|
||||||
if (wrongMovementDirection && currentLocation.distanceTo(routeNodes.get(currentRoute)) > posTolerance) {
|
if (wrongMovementDirection && currentLocation.distanceTo(routeNodes.get(currentRoute)) > 2 * posTolerance) {
|
||||||
log.info("Recalculate route, because wrong movement direction: " + currentLocation.distanceTo(routeNodes.get(currentRoute))); //$NON-NLS-1$
|
log.info("Recalculate route, because wrong movement direction: " + currentLocation.distanceTo(routeNodes.get(currentRoute))); //$NON-NLS-1$
|
||||||
calculateRoute = true;
|
calculateRoute = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue