Search in sources :

Example 6 with MultiPointType

use of net.opengis.gml.x32.MultiPointType in project ddf by codice.

the class TestWfs10JTStoGML200Converter method testGMLToMultiPointType.

@Test
public void testGMLToMultiPointType() throws JAXBException, SAXException, IOException, ParseException, NullPointerException {
    String multiPointGML = Wfs10JTStoGML200Converter.convertGeometryToGML(getGeometryFromWkt(MULTIPOINT));
    MultiPointType multiPointType = (MultiPointType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(multiPointGML, Wfs10Constants.MULTI_POINT);
    List<JAXBElement<? extends GeometryAssociationType>> geoMembers = multiPointType.getGeometryMember();
    assertThat(geoMembers.isEmpty(), is(Boolean.FALSE));
    assertThat(Wfs10Constants.MULTI_POINT.getLocalPart().equals(multiPointType.getJAXBElementName().getLocalPart()), is(Boolean.TRUE));
    assertThat(geoMembers.size() == 4, is(Boolean.TRUE));
    String coords1 = extractPointMemberTypeCoordinates(geoMembers.get(0));
    assertThat(MULTIPOINT_COORDS1.equals(coords1), is(Boolean.TRUE));
    String coords2 = extractPointMemberTypeCoordinates(geoMembers.get(1));
    assertThat(MULTIPOINT_COORDS2.equals(coords2), is(Boolean.TRUE));
    String coords3 = extractPointMemberTypeCoordinates(geoMembers.get(2));
    assertThat(MULTIPOINT_COORDS3.equals(coords3), is(Boolean.TRUE));
    String coords4 = extractPointMemberTypeCoordinates(geoMembers.get(3));
    assertThat(MULTIPOINT_COORDS4.equals(coords4), is(Boolean.TRUE));
}
Also used : GeometryAssociationType(ogc.schema.opengis.gml.v_2_1_2.GeometryAssociationType) LineString(com.vividsolutions.jts.geom.LineString) MultiLineString(com.vividsolutions.jts.geom.MultiLineString) JAXBElement(javax.xml.bind.JAXBElement) MultiPointType(ogc.schema.opengis.gml.v_2_1_2.MultiPointType) Test(org.junit.Test)

Example 7 with MultiPointType

use of net.opengis.gml.x32.MultiPointType in project arctic-sea by 52North.

the class GmlEncoderv321 method createMultiPointFromJtsGeometry.

private void createMultiPointFromJtsGeometry(MultiPoint geom, MultiPointType xbMultiPoint, String id) throws EncodingException {
    for (int i = 0; i < geom.getNumGeometries(); i++) {
        Geometry geometry = geom.getGeometryN(i);
        if (geometry instanceof Point) {
            PointType pt = xbMultiPoint.addNewPointMember().addNewPoint();
            pt.setId(id + "_" + i);
            createPointFromJtsGeometry((Point) geometry, pt);
        }
    }
}
Also used : EnvelopeOrGeometry(org.n52.shetland.util.EnvelopeOrGeometry) Geometry(org.locationtech.jts.geom.Geometry) AbstractGeometry(org.n52.shetland.ogc.gml.AbstractGeometry) MultiPointType(net.opengis.gml.x32.MultiPointType) PointType(net.opengis.gml.x32.PointType) MultiPoint(org.locationtech.jts.geom.MultiPoint) Point(org.locationtech.jts.geom.Point) MultiPoint(org.locationtech.jts.geom.MultiPoint) Point(org.locationtech.jts.geom.Point)

Aggregations

LineString (com.vividsolutions.jts.geom.LineString)4 MultiLineString (com.vividsolutions.jts.geom.MultiLineString)4 MultiPointType (ogc.schema.opengis.gml.v_2_1_2.MultiPointType)3 MultiPoint (com.vividsolutions.jts.geom.MultiPoint)2 Point (com.vividsolutions.jts.geom.Point)2 JAXBElement (javax.xml.bind.JAXBElement)2 MultiPointType (net.opengis.gml.v_3_2_1.MultiPointType)2 MultiPointType (net.opengis.gml.x32.MultiPointType)2 PointType (net.opengis.gml.x32.PointType)2 Test (org.junit.Test)2 Geometry (org.locationtech.jts.geom.Geometry)2 MultiPoint (org.locationtech.jts.geom.MultiPoint)2 Point (org.locationtech.jts.geom.Point)2 AbstractGeometry (org.n52.shetland.ogc.gml.AbstractGeometry)2 EnvelopeOrGeometry (org.n52.shetland.util.EnvelopeOrGeometry)2 GeometryCollection (com.vividsolutions.jts.geom.GeometryCollection)1 MultiPolygon (com.vividsolutions.jts.geom.MultiPolygon)1 Polygon (com.vividsolutions.jts.geom.Polygon)1 JAXBException (javax.xml.bind.JAXBException)1 GeometryPropertyType (net.opengis.gml.v_3_2_1.GeometryPropertyType)1