use of net.opengis.gml.x32.SurfacePropertyType in project ddf by codice.
the class Wfs20JTStoGML321Converter method convertToMultiSurfaceType.
/**
* Converts a @link com.vividsolutions.jts.geom.MultiPolygon to a @link net.opengis.gml.v_3_2_1.MultiSurfaceType
* Note: MultiPolygon maps to gml MultiSurfaceType
*
* @param multiPolygon
* @return MultiSurfaceType
*/
public static MultiSurfaceType convertToMultiSurfaceType(MultiPolygon multiPolygon, String srsName) {
MultiSurfaceType multiSurfaceType = GML320_OBJECT_FACTORY.createMultiSurfaceType();
for (int i = 0; i < multiPolygon.getNumGeometries(); i++) {
Polygon poly = (Polygon) multiPolygon.getGeometryN(i);
PolygonType polygonType = convertToPolygonType(poly, srsName);
JAXBElement<PolygonType> polygonTypeJAXBElement = GML320_OBJECT_FACTORY.createPolygon(polygonType);
SurfacePropertyType surfacePropertyType = GML320_OBJECT_FACTORY.createSurfacePropertyType();
surfacePropertyType.setAbstractSurface(polygonTypeJAXBElement);
multiSurfaceType.getSurfaceMember().add(surfacePropertyType);
}
multiSurfaceType.setSrsName(srsName);
return multiSurfaceType;
}
use of net.opengis.gml.x32.SurfacePropertyType in project arctic-sea by 52North.
the class GmlDecoderv321 method parseCompositeSurfaceType.
private Geometry parseCompositeSurfaceType(CompositeSurfaceType xbCompositeSurface) throws DecodingException {
SurfacePropertyType[] xbCurfaceProperties = xbCompositeSurface.getSurfaceMemberArray();
int srid = -1;
ArrayList<Polygon> polygons = new ArrayList<>(xbCurfaceProperties.length);
if (xbCompositeSurface.getSrsName() != null) {
srid = CRSHelper.parseSrsName(xbCompositeSurface.getSrsName());
}
for (SurfacePropertyType xbSurfaceProperty : xbCurfaceProperties) {
AbstractSurfaceType xbAbstractSurface = xbSurfaceProperty.getAbstractSurface();
if (srid == -1 && xbAbstractSurface.getSrsName() != null) {
srid = CRSHelper.parseSrsName(xbAbstractSurface.getSrsName());
}
if (xbAbstractSurface instanceof PolygonType) {
polygons.add((Polygon) parsePolygonType((PolygonType) xbAbstractSurface));
} else {
throw new DecodingException("The FeatureType %s is not supportted! Only PolygonType", xbAbstractSurface);
}
}
if (polygons.isEmpty()) {
throw new DecodingException("The FeatureType: %s does not contain any member!", xbCompositeSurface);
}
srid = setDefaultForUnsetSrid(srid);
GeometryFactory factory = new GeometryFactory();
Geometry geom = factory.createMultiPolygon(polygons.toArray(new Polygon[polygons.size()]));
geom.setSRID(srid);
return geom;
}
Aggregations