Search in sources :

Example 1 with PolygonMemberType

use of ogc.schema.opengis.gml.v_2_1_2.PolygonMemberType in project ddf by codice.

the class TestWfs10JTStoGML200Converter method testGMLToMultiPolygonType.

@Test
public void testGMLToMultiPolygonType() throws JAXBException, SAXException, IOException, ParseException, NullPointerException {
    String multiPolygonGML = Wfs10JTStoGML200Converter.convertGeometryToGML(getGeometryFromWkt(MULTIPOLYGON));
    MultiPolygonType multiPolygonType = (MultiPolygonType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(multiPolygonGML, Wfs10Constants.MULTI_POLYGON);
    multiPolygonType.getJAXBElementName();
    List<JAXBElement<? extends GeometryAssociationType>> geometryMembers = multiPolygonType.getGeometryMember();
    assertThat(geometryMembers.size() == 2, is(Boolean.TRUE));
    PolygonMemberType polygonMemberType1 = (PolygonMemberType) geometryMembers.get(0).getValue();
    String coords1 = extractPolygonMemberCoordinates(polygonMemberType1);
    assertThat(MULTIPOLYGON_COORDS1.equals(coords1), is(Boolean.TRUE));
    PolygonMemberType polygonMemberType2 = (PolygonMemberType) geometryMembers.get(0).getValue();
    String coords2 = extractPolygonMemberCoordinates(polygonMemberType2);
    assertThat(MULTIPOLYGON_COORDS2.equals(coords2), is(Boolean.TRUE));
}
Also used : PolygonMemberType(ogc.schema.opengis.gml.v_2_1_2.PolygonMemberType) GeometryAssociationType(ogc.schema.opengis.gml.v_2_1_2.GeometryAssociationType) MultiPolygonType(ogc.schema.opengis.gml.v_2_1_2.MultiPolygonType) LineString(com.vividsolutions.jts.geom.LineString) MultiLineString(com.vividsolutions.jts.geom.MultiLineString) JAXBElement(javax.xml.bind.JAXBElement) Test(org.junit.Test)

Example 2 with PolygonMemberType

use of ogc.schema.opengis.gml.v_2_1_2.PolygonMemberType in project ddf by codice.

the class TestWfs10JTStoGML200Converter method extractPolygonMemberCoordinates.

private String extractPolygonMemberCoordinates(PolygonMemberType polygonMemberType1) throws JAXBException, SAXException, IOException, ParseException, NullPointerException {
    JAXBElement<? extends AbstractGeometryType> polygonGeometry1 = polygonMemberType1.getGeometry();
    assertThat(Wfs10Constants.POLYGON.getLocalPart().equals(polygonGeometry1.getName().getLocalPart()), is(Boolean.TRUE));
    PolygonType polygonType1 = (PolygonType) polygonGeometry1.getValue();
    LinearRingMemberType linearRingMemberType1 = polygonType1.getOuterBoundaryIs();
    JAXBElement<? extends AbstractGeometryType> linearRingGeometry1 = linearRingMemberType1.getGeometry();
    LinearRingType linearRingType1 = (LinearRingType) linearRingGeometry1.getValue();
    return linearRingType1.getCoordinates().getValue().replaceAll("\n", "").trim();
}
Also used : LinearRingType(ogc.schema.opengis.gml.v_2_1_2.LinearRingType) LinearRingMemberType(ogc.schema.opengis.gml.v_2_1_2.LinearRingMemberType) PolygonType(ogc.schema.opengis.gml.v_2_1_2.PolygonType) MultiPolygonType(ogc.schema.opengis.gml.v_2_1_2.MultiPolygonType)

Aggregations

MultiPolygonType (ogc.schema.opengis.gml.v_2_1_2.MultiPolygonType)2 LineString (com.vividsolutions.jts.geom.LineString)1 MultiLineString (com.vividsolutions.jts.geom.MultiLineString)1 JAXBElement (javax.xml.bind.JAXBElement)1 GeometryAssociationType (ogc.schema.opengis.gml.v_2_1_2.GeometryAssociationType)1 LinearRingMemberType (ogc.schema.opengis.gml.v_2_1_2.LinearRingMemberType)1 LinearRingType (ogc.schema.opengis.gml.v_2_1_2.LinearRingType)1 PolygonMemberType (ogc.schema.opengis.gml.v_2_1_2.PolygonMemberType)1 PolygonType (ogc.schema.opengis.gml.v_2_1_2.PolygonType)1 Test (org.junit.Test)1