correct time tag handling

This commit is contained in:
sonora 2016-08-09 13:07:47 +02:00
parent fb183a6480
commit 15d9ea2e75

View file

@ -1080,16 +1080,19 @@ public class RouteProvider {
} }
Route route = new Route(); Route route = new Route();
gpx.routes.add(route); gpx.routes.add(route);
int collectTime = 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 && dirInfo.getTurnType() != null && !dirInfo.getTurnType().isSkipToSpeak()) { if (dirInfo.routePointOffset >= cRoute) {
if (dirInfo.getTurnType() != null && !dirInfo.getTurnType().isSkipToSpeak()) {
Location loc = routeNodes.get(dirInfo.routePointOffset); Location loc = routeNodes.get(dirInfo.routePointOffset);
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); pt.desc = dirInfo.getDescriptionRoute(ctx);
Map<String, String> extensions = pt.getExtensionsToWrite(); Map<String, String> extensions = pt.getExtensionsToWrite();
extensions.put("time", dirInfo.getExpectedTime() + ""); extensions.put("time", (collectTime + dirInfo.getExpectedTime()) + "");
collectTime = 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());
@ -1109,6 +1112,9 @@ public class RouteProvider {
} }
route.points.add(pt); route.points.add(pt);
} else {
collectTime += dirInfo.getExpectedTime();
}
} }
} }
List<TargetPoint> ps = helper.getIntermediatePointsWithTarget(); List<TargetPoint> ps = helper.getIntermediatePointsWithTarget();