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; boolean useIntermediatePointsRTE;
private List<LocationPoint> wpt; private List<LocationPoint> wpt;
boolean addMissingTurns = true;
public List<Location> getPoints() { public List<Location> getPoints() {
return points; return points;
} }
@ -241,10 +243,15 @@ public class RouteProvider {
} }
if (file.isCloudmadeRouteFile() || OSMAND_ROUTER.equals(file.author)) { if (file.isCloudmadeRouteFile() || OSMAND_ROUTER.equals(file.author)) {
directions = parseOsmAndGPXRoute(points, file, OSMAND_ROUTER.equals(file.author), builder.leftSide, 10); 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) { if (reverse) {
// clear directions all turns should be recalculated // clear directions all turns should be recalculated
directions = null; directions = null;
Collections.reverse(points); Collections.reverse(points);
addMissingTurns = true;
} }
} else { } else {
// first of all check tracks // first of all check tracks
@ -375,7 +382,7 @@ public class RouteProvider {
info.afterLeftTime = 0; info.afterLeftTime = 0;
} }
RouteCalculationResult res = new RouteCalculationResult(gpxRoute, gpxDirections, routeParams, RouteCalculationResult res = new RouteCalculationResult(gpxRoute, gpxDirections, routeParams,
gpxParams == null? null: gpxParams.wpt, false); gpxParams == null? null: gpxParams.wpt, routeParams.gpxRoute.addMissingTurns);
return res; return res;
} }