Search in sources :

Example 1 with MultiSurfaceType

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;
}
Also used : MultiPoint(org.locationtech.jts.geom.MultiPoint) MultiLineString(org.locationtech.jts.geom.MultiLineString) MultiCurveType(net.opengis.gml.v_3_2_1.MultiCurveType) MultiGeometryType(net.opengis.gml.v_3_2_1.MultiGeometryType) PolygonType(net.opengis.gml.v_3_2_1.PolygonType) Point(org.locationtech.jts.geom.Point) MultiPoint(org.locationtech.jts.geom.MultiPoint) LineStringType(net.opengis.gml.v_3_2_1.LineStringType) MultiPointType(net.opengis.gml.v_3_2_1.MultiPointType) GeometryCollection(org.locationtech.jts.geom.GeometryCollection) MultiSurfaceType(net.opengis.gml.v_3_2_1.MultiSurfaceType) MultiLineString(org.locationtech.jts.geom.MultiLineString) LineString(org.locationtech.jts.geom.LineString) MultiPolygon(org.locationtech.jts.geom.MultiPolygon) PointType(net.opengis.gml.v_3_2_1.PointType) MultiPointType(net.opengis.gml.v_3_2_1.MultiPointType) Polygon(org.locationtech.jts.geom.Polygon) MultiPolygon(org.locationtech.jts.geom.MultiPolygon) GeometryPropertyType(net.opengis.gml.v_3_2_1.GeometryPropertyType)

Example 2 with MultiSurfaceType

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));
}
Also used : MultiSurfaceType(org.geosdi.geoplatform.xml.gml.v311.MultiSurfaceType) File(java.io.File) Test(org.junit.Test)

Example 3 with 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));
}
Also used : MultiSurfaceType(org.geosdi.geoplatform.xml.gml.v311.MultiSurfaceType) File(java.io.File) Test(org.junit.Test)

Example 4 with 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;
}
Also used : MultiSurfaceType(net.opengis.gml.v_3_2_1.MultiSurfaceType) SurfacePropertyType(net.opengis.gml.v_3_2_1.SurfacePropertyType) PolygonType(net.opengis.gml.v_3_2_1.PolygonType) Polygon(org.locationtech.jts.geom.Polygon) MultiPolygon(org.locationtech.jts.geom.MultiPolygon) Point(org.locationtech.jts.geom.Point) MultiPoint(org.locationtech.jts.geom.MultiPoint)

Example 5 with 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));
}
Also used : MultiSurfaceType(org.geosdi.geoplatform.xml.gml.v311.MultiSurfaceType) File(java.io.File) Test(org.junit.Test)

Aggregations

File (java.io.File)5 MultiSurfaceType (org.geosdi.geoplatform.xml.gml.v311.MultiSurfaceType)5 Test (org.junit.Test)5 MultiSurfaceType (net.opengis.gml.v_3_2_1.MultiSurfaceType)2 PolygonType (net.opengis.gml.v_3_2_1.PolygonType)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Quantity (javax.measure.Quantity)1 JAXBElement (javax.xml.bind.JAXBElement)1 GeometryPropertyType (net.opengis.gml.v_3_2_1.GeometryPropertyType)1 LineStringType (net.opengis.gml.v_3_2_1.LineStringType)1 MultiCurveType (net.opengis.gml.v_3_2_1.MultiCurveType)1 MultiGeometryType (net.opengis.gml.v_3_2_1.MultiGeometryType)1 MultiPointType (net.opengis.gml.v_3_2_1.MultiPointType)1 PointType (net.opengis.gml.v_3_2_1.PointType)1 SurfacePropertyType (net.opengis.gml.v_3_2_1.SurfacePropertyType)1 JTStoGeometry (org.geotoolkit.gml.JTStoGeometry)1 AbstractGeometry (org.geotoolkit.gml.xml.AbstractGeometry)1 CurveType (org.geotoolkit.gml.xml.v321.CurveType)1 DirectPositionType (org.geotoolkit.gml.xml.v321.DirectPositionType)1