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,8 +746,10 @@ public class BinaryRoutePlanner {
RouteSegmentResult res = new RouteSegmentResult(segment.road, parentSegmentStart, segment.segmentStart); RouteSegmentResult res = new RouteSegmentResult(segment.road, parentSegmentStart, segment.segmentStart);
parentSegmentStart = segment.parentSegmentEnd; parentSegmentStart = segment.parentSegmentEnd;
segment = segment.parentRoute; segment = segment.parentRoute;
if(res.getStartPointIndex() != res.getEndPointIndex()) {
result.add(res); result.add(res);
} }
}
Collections.reverse(result); Collections.reverse(result);
segment = ctx.finalDirectRoute; segment = ctx.finalDirectRoute;
@ -756,8 +758,11 @@ public class BinaryRoutePlanner {
RouteSegmentResult res = new RouteSegmentResult(segment.road, segment.segmentStart, parentSegmentEnd); RouteSegmentResult res = new RouteSegmentResult(segment.road, segment.segmentStart, parentSegmentEnd);
parentSegmentEnd = segment.parentSegmentEnd; parentSegmentEnd = segment.parentSegmentEnd;
segment = segment.parentRoute; segment = segment.parentRoute;
// happens in smart recalculation
if(res.getStartPointIndex() != res.getEndPointIndex()) {
result.add(res); result.add(res);
} }
}
Collections.reverse(result); Collections.reverse(result);
// calculate time // calculate time

View file

@ -279,7 +279,7 @@ public class RoutingHelper {
// if we are still too far try to proceed many points // if we are still too far try to proceed many points
// if not then look ahead only 3 in order to catch sharp turns // if not then look ahead only 3 in order to catch sharp turns
boolean longDistance = dist >= 250; 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), double newDist = getOrthogonalDistance(currentLocation, routeNodes.get(newCurrentRoute),
routeNodes.get(newCurrentRoute + 1)); routeNodes.get(newCurrentRoute + 1));
if(longDistance) { if(longDistance) {