Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-08-09 14:44:50 +02:00
commit 715bdeb0a0
2 changed files with 27 additions and 5 deletions

View file

@ -43,6 +43,13 @@ public class RouteDirectionInfo {
return descriptionRoute.trim();
}
public String getDescriptionRoute(OsmandApplication ctx, int collectedDistance) {
if (!descriptionRoute.endsWith(OsmAndFormatter.getFormattedDistance(collectedDistance, ctx))) {
descriptionRoute += " " + OsmAndFormatter.getFormattedDistance(collectedDistance, ctx);
}
return descriptionRoute.trim();
}
public String getDescriptionRoutePart() {
return descriptionRoute;
}
@ -91,4 +98,8 @@ public class RouteDirectionInfo {
public int afterLeftTime;
// distance after action (for i.e. after turn to next turn)
public int distance;
public int getDistance() {
return distance;
}
}

View file

@ -1080,7 +1080,7 @@ public class RouteProvider {
}
Route route = new Route();
gpx.routes.add(route);
int collectTime = 0;
int collectedTime = 0;
for (int i = cDirInfo; i < directionInfo.size(); i++) {
RouteDirectionInfo dirInfo = directionInfo.get(i);
if (dirInfo.routePointOffset >= cRoute) {
@ -1089,10 +1089,21 @@ public class RouteProvider {
WptPt pt = new WptPt();
pt.lat = loc.getLatitude();
pt.lon = loc.getLongitude();
pt.desc = dirInfo.getDescriptionRoute(ctx);
// Collect distances for subsequent suppressed turns
int collectedDistance = 0;
for (int j = i + 1; j < directionInfo.size(); j++) {
if (directionInfo.get(j).getTurnType() != null && dirInfo.getTurnType().isSkipToSpeak()) {
collectedDistance += directionInfo.get(j).getDistance();
} else {
break;
}
}
pt.desc = dirInfo.getDescriptionRoute(ctx, collectedDistance + dirInfo.getDistance());
Map<String, String> extensions = pt.getExtensionsToWrite();
extensions.put("time", (collectTime + dirInfo.getExpectedTime()) + "");
collectTime = 0;
extensions.put("time", (collectedTime + dirInfo.getExpectedTime()) + "");
collectedTime = 0;
int turnType = dirInfo.getTurnType().getValue();
if (TurnType.C != turnType) {
extensions.put("turn", dirInfo.getTurnType().toXmlString());
@ -1113,7 +1124,7 @@ public class RouteProvider {
route.points.add(pt);
} else {
collectTime += dirInfo.getExpectedTime();
collectedTime += dirInfo.getExpectedTime();
}
}
}