FolderType folderType = objectFactory.createFolderType();
folderType.setName(WAYPOINTS);
List<KmlPosition> positions = route.getPositions();
for (int i = startIndex; i < endIndex; i++) {
KmlPosition position = positions.get(i);
PlacemarkType placemarkType = objectFactory.createPlacemarkType();
folderType.getAbstractFeatureGroup().add(objectFactory.createPlacemark(placemarkType));
placemarkType.setName(trimLineFeedsAndCommas(asName(isWriteName() ? position.getDescription() : null)));
placemarkType.setDescription(trimLineFeedsAndCommas(asDesc(isWriteDesc() ? position.getDescription() : null)));
PointType pointType = objectFactory.createPointType();
placemarkType.setAbstractGeometryGroup(objectFactory.createPoint(pointType));
pointType.getCoordinates().add(createCoordinates(position, false));
}
return folderType;
}