diff --git a/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java b/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java index 9015f8f9c5..cc5408fb17 100644 --- a/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java +++ b/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java @@ -213,18 +213,30 @@ public class BinaryRoutePlanner { boolean runRecalculation = ctx.previouslyCalculatedRoute != null && ctx.previouslyCalculatedRoute.size() > 0; if (runRecalculation) { RouteSegment previous = null; - for (RouteSegmentResult rr : ctx.previouslyCalculatedRoute) { - RouteSegment segment = new RouteSegment(rr.getObject(), rr.getEndPointIndex()); - if (previous != null) { - previous.parentRoute = segment; - previous.parentSegmentEnd = rr.getStartPointIndex(); - long t = (rr.getObject().getId() << ROUTE_POINTS) + segment.segmentStart; - visitedOppositeSegments.put(t, segment); + List rlist = new ArrayList(); + // always recalculate first 2.5 km + int distanceThreshold = 2500; + float threshold = 0; + for(RouteSegmentResult rr : ctx.previouslyCalculatedRoute) { + threshold += rr.getDistance(); + if(threshold > distanceThreshold) { + rlist.add(rr); } - previous = segment; - } - end = previous; + if (rlist.size() > 0) { + for (RouteSegmentResult rr : rlist) { + RouteSegment segment = new RouteSegment(rr.getObject(), rr.getEndPointIndex()); + if (previous != null) { + previous.parentRoute = segment; + previous.parentSegmentEnd = rr.getStartPointIndex(); + long t = (rr.getObject().getId() << ROUTE_POINTS) + segment.segmentStart; + visitedOppositeSegments.put(t, segment); + } + previous = segment; + + } + end = previous; + } } // for start : f(start) = g(start) + h(start) = 0 + h(start) = h(start) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index f50d50964e..e0a06d664c 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -74,8 +74,6 @@ import android.view.Window; import android.view.animation.AccelerateInterpolator; import android.view.animation.Animation; import android.view.animation.Transformation; -import android.widget.FrameLayout.LayoutParams; -import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast;