Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
715bdeb0a0
2 changed files with 27 additions and 5 deletions
|
@ -43,6 +43,13 @@ public class RouteDirectionInfo {
|
||||||
return descriptionRoute.trim();
|
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() {
|
public String getDescriptionRoutePart() {
|
||||||
return descriptionRoute;
|
return descriptionRoute;
|
||||||
}
|
}
|
||||||
|
@ -91,4 +98,8 @@ public class RouteDirectionInfo {
|
||||||
public int afterLeftTime;
|
public int afterLeftTime;
|
||||||
// distance after action (for i.e. after turn to next turn)
|
// distance after action (for i.e. after turn to next turn)
|
||||||
public int distance;
|
public int distance;
|
||||||
|
|
||||||
|
public int getDistance() {
|
||||||
|
return distance;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1080,7 +1080,7 @@ public class RouteProvider {
|
||||||
}
|
}
|
||||||
Route route = new Route();
|
Route route = new Route();
|
||||||
gpx.routes.add(route);
|
gpx.routes.add(route);
|
||||||
int collectTime = 0;
|
int collectedTime = 0;
|
||||||
for (int i = cDirInfo; i < directionInfo.size(); i++) {
|
for (int i = cDirInfo; i < directionInfo.size(); i++) {
|
||||||
RouteDirectionInfo dirInfo = directionInfo.get(i);
|
RouteDirectionInfo dirInfo = directionInfo.get(i);
|
||||||
if (dirInfo.routePointOffset >= cRoute) {
|
if (dirInfo.routePointOffset >= cRoute) {
|
||||||
|
@ -1089,10 +1089,21 @@ public class RouteProvider {
|
||||||
WptPt pt = new WptPt();
|
WptPt pt = new WptPt();
|
||||||
pt.lat = loc.getLatitude();
|
pt.lat = loc.getLatitude();
|
||||||
pt.lon = loc.getLongitude();
|
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();
|
Map<String, String> extensions = pt.getExtensionsToWrite();
|
||||||
extensions.put("time", (collectTime + dirInfo.getExpectedTime()) + "");
|
extensions.put("time", (collectedTime + dirInfo.getExpectedTime()) + "");
|
||||||
collectTime = 0;
|
collectedTime = 0;
|
||||||
int turnType = dirInfo.getTurnType().getValue();
|
int turnType = dirInfo.getTurnType().getValue();
|
||||||
if (TurnType.C != turnType) {
|
if (TurnType.C != turnType) {
|
||||||
extensions.put("turn", dirInfo.getTurnType().toXmlString());
|
extensions.put("turn", dirInfo.getTurnType().toXmlString());
|
||||||
|
@ -1113,7 +1124,7 @@ public class RouteProvider {
|
||||||
|
|
||||||
route.points.add(pt);
|
route.points.add(pt);
|
||||||
} else {
|
} else {
|
||||||
collectTime += dirInfo.getExpectedTime();
|
collectedTime += dirInfo.getExpectedTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue