use of org.geotoolkit.gml.xml.v321.MultiSurfaceType in project ddf by codice.
the class Wfs20JTStoGML321Converter method createGeometryPropertyType.
private static GeometryPropertyType createGeometryPropertyType(Geometry geometry, String srsName) {
final GeometryPropertyType geometryPropertyType = GML320_OBJECT_FACTORY.createGeometryPropertyType();
if (geometry instanceof Point) {
PointType pointType = convertToPointType((Point) geometry, srsName);
geometryPropertyType.setAbstractGeometry(convertPointTypeToJAXB(pointType));
} else if (geometry instanceof LineString) {
LineStringType lineStringType = convertToLineStringType((LineString) geometry, srsName);
geometryPropertyType.setAbstractGeometry(convertLineStringTypeToJAXB(lineStringType));
} else if (geometry instanceof Polygon) {
PolygonType polygonType = convertToPolygonType((Polygon) geometry, srsName);
geometryPropertyType.setAbstractGeometry(convertPolygonTypeToJAXB(polygonType));
} else if (geometry instanceof MultiPoint) {
MultiPointType multiPointType = convertToMultiPointType((MultiPoint) geometry, srsName);
geometryPropertyType.setAbstractGeometry(convertMultiPointTypeToJAXB(multiPointType));
} else if (geometry instanceof MultiLineString) {
MultiCurveType multiCurveType = convertToMultiLineStringType((MultiLineString) geometry, srsName);
geometryPropertyType.setAbstractGeometry(convertMultiCurveTypeToJAXB(multiCurveType));
} else if (geometry instanceof MultiPolygon) {
MultiSurfaceType multiSurfaceType = convertToMultiSurfaceType((MultiPolygon) geometry, srsName);
geometryPropertyType.setAbstractGeometry(convertMultiSurfaceTypeToJAXB(multiSurfaceType));
} else if (geometry instanceof GeometryCollection) {
MultiGeometryType multiGeometryType = convertToMultiGeometryType((GeometryCollection) geometry, srsName);
geometryPropertyType.setAbstractGeometry(convertMultiGeometryTypeToJAXB(multiGeometryType));
} else {
throw new IllegalArgumentException();
}
return geometryPropertyType;
}
use of org.geotoolkit.gml.xml.v321.MultiSurfaceType in project geo-platform by geosdi.
the class GMLMultiSurfaceParserTest method d_multiSurfaceJTSParserTest.
@Test
public void d_multiSurfaceJTSParserTest() throws Exception {
MultiSurfaceType multiSurfaceType = GPJAXBContextBuilder.newInstance().unmarshal(new File(of(new File(".").getCanonicalPath(), "src", "test", "resources", "MultiSurface3.xml").collect(joining(separator))), MultiSurfaceType.class);
logger.info("##########################MULTI_POLYGON_JTS_2 : {}\n", multiSurfaceParser.parseGeometry(multiSurfaceType));
}
use of org.geotoolkit.gml.xml.v321.MultiSurfaceType in project geo-platform by geosdi.
the class GMLMultiSurfaceParserTest method a_multiSurfaceJTSParserTest.
@Test
public void a_multiSurfaceJTSParserTest() throws Exception {
MultiSurfaceType multiSurfaceType = GPJAXBContextBuilder.newInstance().unmarshal(new File(of(new File(".").getCanonicalPath(), "src", "test", "resources", "MultiSurface.xml").collect(joining(separator))), MultiSurfaceType.class);
logger.info("##########################MULTI_POLYGON_JTS : {}\n", multiSurfaceParser.parseGeometry(multiSurfaceType));
}
use of org.geotoolkit.gml.xml.v321.MultiSurfaceType in project ddf by codice.
the class Wfs20JTStoGML321Converter method convertToMultiSurfaceType.
/**
* Converts a @link org.locationtech.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 org.geotoolkit.gml.xml.v321.MultiSurfaceType in project geo-platform by geosdi.
the class GMLMultiSurfaceParserTest method c_multiSurfaceJTSParserTest.
@Test
public void c_multiSurfaceJTSParserTest() throws Exception {
MultiSurfaceType multiSurfaceType = GPJAXBContextBuilder.newInstance().unmarshal(new File(of(new File(".").getCanonicalPath(), "src", "test", "resources", "MultiSurface2.xml").collect(joining(separator))), MultiSurfaceType.class);
logger.info("##########################MULTI_POLYGON_JTS_2 : {}\n", multiSurfaceParser.parseGeometry(multiSurfaceType));
}
Aggregations