Fix smart recalculation problem

This commit is contained in:
Victor Shcherb 2012-07-15 23:58:33 +02:00
parent 33f19e7a95
commit 2d47028aca
2 changed files with 8 additions and 3 deletions

View file

@ -746,7 +746,9 @@ public class BinaryRoutePlanner {
RouteSegmentResult res = new RouteSegmentResult(segment.road, parentSegmentStart, segment.segmentStart);
parentSegmentStart = segment.parentSegmentEnd;
segment = segment.parentRoute;
result.add(res);
if(res.getStartPointIndex() != res.getEndPointIndex()) {
result.add(res);
}
}
Collections.reverse(result);
@ -756,7 +758,10 @@ public class BinaryRoutePlanner {
RouteSegmentResult res = new RouteSegmentResult(segment.road, segment.segmentStart, parentSegmentEnd);
parentSegmentEnd = segment.parentSegmentEnd;
segment = segment.parentRoute;
result.add(res);
// happens in smart recalculation
if(res.getStartPointIndex() != res.getEndPointIndex()) {
result.add(res);
}
}
Collections.reverse(result);

View file

@ -279,7 +279,7 @@ public class RoutingHelper {
// if we are still too far try to proceed many points
// if not then look ahead only 3 in order to catch sharp turns
boolean longDistance = dist >= 250;
int newCurrentRoute = lookAheadFindMinOrthogonalDistance(currentLocation, routeNodes, currentRoute, longDistance ? 10 : 3);
int newCurrentRoute = lookAheadFindMinOrthogonalDistance(currentLocation, routeNodes, currentRoute, longDistance ? 15 : 8);
double newDist = getOrthogonalDistance(currentLocation, routeNodes.get(newCurrentRoute),
routeNodes.get(newCurrentRoute + 1));
if(longDistance) {