this.format = format;
this.string = createStringFor(positions);
}
private String createStringFor(List<NavigationPosition> sourcePositions) {
GlopusFormat targetFormat = new GlopusFormat();
List<BaseNavigationPosition> targetPositions = new ArrayList<BaseNavigationPosition>();
try {
targetPositions = asFormatForPositions(sourcePositions, targetFormat);
} catch (IOException e) {
log.severe("Cannot convert " + sourcePositions + " for selection: " + e);
}
SimpleRoute targetRoute = targetFormat.createRoute(Waypoints, null, targetPositions);
StringWriter writer = new StringWriter();
targetFormat.write(targetRoute, new PrintWriter(writer), 0, targetPositions.size());
return writer.toString();
}