while (featureIterator.hasNext())
{
SimpleFeature feature = featureIterator.next();
GeometryType geomType = feature.getFeatureType().getGeometryDescriptor().getType();
// handle appropriate shape/upload type
if(gisUpload.type == GisUploadType.ROUTES)
{
if(geomType.getBinding() != MultiLineString.class)
{
Logger.error("Unexpected geometry type: ", geomType);
continue;
}
MultiLineString multiLineString = (MultiLineString)JTS.transform((Geometry)feature.getDefaultGeometry(), transform);
GisRoute route = new GisRoute();
route.gisUpload = gisUpload;
route.agency = gisUpload.agency;
route.oid = feature.getID();
route.originalShape = multiLineString;
route.originalShape.setSRID(4326);
if(gisUpload.fieldName != null)
{
FeatureAttributeFormatter attribFormatter = new FeatureAttributeFormatter(gisUpload.fieldName);
route.routeName = attribFormatter.format(feature);
}
if(gisUpload.fieldId != null)
{
FeatureAttributeFormatter attribFormatter = new FeatureAttributeFormatter(gisUpload.fieldId);
route.routeId = attribFormatter.format(feature);
}
if(gisUpload.fieldDescription != null)
{
FeatureAttributeFormatter attribFormatter = new FeatureAttributeFormatter(gisUpload.fieldDescription);
route.description = attribFormatter.format(feature);
}
route.save();
route.processSegments();
}
else if(gisUpload.type == GisUploadType.STOPS)
{
if(geomType.getBinding() != Point.class)
{
Logger.error("Unexpected geometry type: ", geomType);
continue;
}