Search in sources :

Example 1 with MultiPolygonType

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

the class TestWfs10JTStoGML200Converter method testMultiPolygonTypeToJAXB.

@Test
public void testMultiPolygonTypeToJAXB() throws JAXBException, SAXException, IOException, ParseException, NullPointerException {
    String multiPolygonGML = Wfs10JTStoGML200Converter.convertGeometryToGML(getGeometryFromWkt(MULTIPOLYGON));
    MultiPolygonType multiPolygonType = (MultiPolygonType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(multiPolygonGML, Wfs10Constants.MULTI_POLYGON);
    JAXBElement<MultiPolygonType> multiPolygonTypeJAXBElement = (JAXBElement<MultiPolygonType>) Wfs10JTStoGML200Converter.convertGeometryTypeToJAXB(multiPolygonType);
    JAXB.marshal(multiPolygonTypeJAXBElement, writer);
    String xml = writer.toString();
    Diff diff = XMLUnit.compareXML(xml, MULTIPOLYGON_GML);
    assertTrue(XMLUNIT_SIMILAR, diff.similar());
    assertThat(diff.similar(), is(Boolean.TRUE));
    assertThat(diff.identical(), is(Boolean.FALSE));
}
Also used : Diff(org.custommonkey.xmlunit.Diff) 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 MultiPolygonType

use of ogc.schema.opengis.gml.v_2_1_2.MultiPolygonType 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 3 with MultiPolygonType

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

the class WfsFilterDelegate method createMultiPolygon.

private JAXBElement<MultiPolygonType> createMultiPolygon(Geometry geometry) {
    JAXBElement<MultiPolygonType> jaxbElement = null;
    try {
        String gml = Wfs10JTStoGML200Converter.convertGeometryToGML(geometry);
        MultiLineStringType multiLineStringType = (MultiLineStringType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(gml, Wfs10Constants.MULTI_LINESTRING);
        jaxbElement = (JAXBElement<MultiPolygonType>) Wfs10JTStoGML200Converter.convertGeometryTypeToJAXB(multiLineStringType);
    } catch (JAXBException jbe) {
        LOGGER.debug("Unable to create MultiPolygonType with geometry: [{}]", geometry);
    }
    return jaxbElement;
}
Also used : JAXBException(javax.xml.bind.JAXBException) MultiLineStringType(ogc.schema.opengis.gml.v_2_1_2.MultiLineStringType) MultiPolygonType(ogc.schema.opengis.gml.v_2_1_2.MultiPolygonType) LineString(com.vividsolutions.jts.geom.LineString) MultiLineString(com.vividsolutions.jts.geom.MultiLineString)

Example 4 with MultiPolygonType

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

the class WfsFilterDelegate method createGeometryCollection.

private JAXBElement<GeometryCollectionType> createGeometryCollection(Geometry geometry) {
    JAXBElement<GeometryCollectionType> jaxbElement = null;
    try {
        String gml = Wfs10JTStoGML200Converter.convertGeometryToGML(geometry);
        GeometryCollectionType geometryCollectionType = (GeometryCollectionType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(gml, Wfs10Constants.GEOMETRY_COLLECTION);
        jaxbElement = (JAXBElement<GeometryCollectionType>) Wfs10JTStoGML200Converter.convertGeometryTypeToJAXB(geometryCollectionType);
    } catch (JAXBException jbe) {
        LOGGER.debug("Unable to create MultiPolygonType with geometry: [{}]", geometry);
    }
    return jaxbElement;
}
Also used : GeometryCollectionType(ogc.schema.opengis.gml.v_2_1_2.GeometryCollectionType) JAXBException(javax.xml.bind.JAXBException) LineString(com.vividsolutions.jts.geom.LineString) MultiLineString(com.vividsolutions.jts.geom.MultiLineString)

Aggregations

LineString (com.vividsolutions.jts.geom.LineString)4 MultiLineString (com.vividsolutions.jts.geom.MultiLineString)4 MultiPolygonType (ogc.schema.opengis.gml.v_2_1_2.MultiPolygonType)3 JAXBElement (javax.xml.bind.JAXBElement)2 JAXBException (javax.xml.bind.JAXBException)2 Test (org.junit.Test)2 GeometryAssociationType (ogc.schema.opengis.gml.v_2_1_2.GeometryAssociationType)1 GeometryCollectionType (ogc.schema.opengis.gml.v_2_1_2.GeometryCollectionType)1 MultiLineStringType (ogc.schema.opengis.gml.v_2_1_2.MultiLineStringType)1 PolygonMemberType (ogc.schema.opengis.gml.v_2_1_2.PolygonMemberType)1 Diff (org.custommonkey.xmlunit.Diff)1