gpx.setDesc(asDescription(route.getDescription()));
}
}
private Gpx createGpx(GpxRoute route, int startIndex, int endIndex, List<RouteCharacteristics> characteristics) {
Gpx gpx = recycleGpx(route);
if (gpx == null || !reuseReadObjectsForWriting)
gpx = new ObjectFactory().createGpx();
gpx.setCreator(GENERATED_BY);
gpx.setVersion(VERSION);
for (RouteCharacteristics characteristic : characteristics) {
switch (characteristic) {
case Route:
gpx.getRte().addAll(createRoute(route, startIndex, endIndex));
break;
case Track:
gpx.getTrk().addAll(createTrack(route, startIndex, endIndex));
break;
case Waypoints:
createMetaData(route, gpx);
gpx.getWpt().addAll(createWayPoints(route, startIndex, endIndex));
break;
default:
throw new IllegalArgumentException("Unknown RouteCharacteristics " + characteristic);
}
}