From 2d47028acaa5630103c4bfb779da9fe9b71951d1 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sun, 15 Jul 2012 23:58:33 +0200 Subject: [PATCH] Fix smart recalculation problem --- .../src/net/osmand/router/BinaryRoutePlanner.java | 9 +++++++-- OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java b/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java index 5c80712989..9015f8f9c5 100644 --- a/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java +++ b/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java @@ -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); diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index 84b3ed2792..cedfe6c949 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -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) {