Add correct logic for addMissingTurns

This commit is contained in:
sonora 2016-08-09 09:29:51 +02:00
parent 3e38dfedeb
commit e4a0745dce

View file

@ -202,6 +202,8 @@ public class RouteProvider {
boolean useIntermediatePointsRTE;
private List<LocationPoint> wpt;
boolean addMissingTurns = true;
public List<Location> 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 (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;
}