From e4a0745dce7b8b827d2070e5950150abd5fb81db Mon Sep 17 00:00:00 2001 From: sonora Date: Tue, 9 Aug 2016 09:29:51 +0200 Subject: [PATCH] Add correct logic for addMissingTurns --- OsmAnd/src/net/osmand/plus/routing/RouteProvider.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java index 2a96acd1e7..3368715ba4 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java @@ -202,6 +202,8 @@ public class RouteProvider { boolean useIntermediatePointsRTE; private List wpt; + boolean addMissingTurns = true; + public List getPoints() { return points; } @@ -241,10 +243,15 @@ public class RouteProvider { } if (file.isCloudmadeRouteFile() || OSMAND_ROUTER.equals(file.author)) { directions = parseOsmAndGPXRoute(points, file, OSMAND_ROUTER.equals(file.author), builder.leftSide, 10); - if (reverse) { + if (OSMAND_ROUTER.equals(file.author)) { + // For files generated by OSMAND_ROUTER use directions contained unaltered + addMissingTurns = false; + } + if (reverse) { // clear directions all turns should be recalculated directions = null; Collections.reverse(points); + addMissingTurns = true; } } else { // first of all check tracks @@ -375,7 +382,7 @@ public class RouteProvider { info.afterLeftTime = 0; } RouteCalculationResult res = new RouteCalculationResult(gpxRoute, gpxDirections, routeParams, - gpxParams == null? null: gpxParams.wpt, false); + gpxParams == null? null: gpxParams.wpt, routeParams.gpxRoute.addMissingTurns); return res; }