use of ogc.schema.opengis.gml.v_2_1_2.GeometryCollectionType in project ddf by codice.
the class TestWfs10JTStoGML200Converter method testGeometryCollectionTypeToJAXB.
@Test
public void testGeometryCollectionTypeToJAXB() throws JAXBException, SAXException, IOException, ParseException, NullPointerException {
String geometryCollectionGML = Wfs10JTStoGML200Converter.convertGeometryToGML(getGeometryFromWkt(GEOMETRYCOLLECTION)).replaceAll("\n", "");
GeometryCollectionType geometryCollectionType = (GeometryCollectionType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(geometryCollectionGML, Wfs10Constants.GEOMETRY_COLLECTION);
JAXBElement<GeometryCollectionType> geometryCollectionTypeJAXBElement = (JAXBElement<GeometryCollectionType>) Wfs10JTStoGML200Converter.convertGeometryTypeToJAXB(geometryCollectionType);
JAXB.marshal(geometryCollectionTypeJAXBElement, writer);
String xml = writer.toString().replaceAll("\n", "");
Diff diff = XMLUnit.compareXML(xml, GEOMETRYCOLLECTION_NS1);
assertTrue(XMLUNIT_SIMILAR, diff.similar());
assertThat(diff.similar(), is(Boolean.TRUE));
assertThat(diff.identical(), is(Boolean.TRUE));
}
use of ogc.schema.opengis.gml.v_2_1_2.GeometryCollectionType in project ddf by codice.
the class TestWfs10JTStoGML200Converter method testTwo.
@Test
public void testTwo() throws Exception {
Geometry geometryFromWkt = getGeometryFromWkt(GEOMETRYCOLLECTION);
String gml = Wfs10JTStoGML200Converter.convertGeometryCollectionToGML(geometryFromWkt);
GeometryCollectionType geometryCollectionType = (GeometryCollectionType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(gml, Wfs10Constants.GEOMETRY_COLLECTION);
JAXBElement<GeometryCollectionType> jaxbElement = (JAXBElement<GeometryCollectionType>) Wfs10JTStoGML200Converter.convertGeometryTypeToJAXB(geometryCollectionType);
assertFalse(jaxbElement == null);
}
use of ogc.schema.opengis.gml.v_2_1_2.GeometryCollectionType in project ddf by codice.
the class TestWfs10JTStoGML200Converter method testGMLToGeometryCollectionType.
@Test
public void testGMLToGeometryCollectionType() throws JAXBException, SAXException, IOException, ParseException, NullPointerException {
String geometryCollectionGML = Wfs10JTStoGML200Converter.convertGeometryToGML(getGeometryFromWkt(GEOMETRYCOLLECTION));
GeometryCollectionType geometryCollectionType = (GeometryCollectionType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(geometryCollectionGML, Wfs10Constants.GEOMETRY_COLLECTION);
assertFalse(geometryCollectionType == null);
List<JAXBElement<? extends GeometryAssociationType>> geometryMembers = geometryCollectionType.getGeometryMember();
assertThat(CollectionUtils.isEmpty(geometryMembers), is(Boolean.FALSE));
assertThat(geometryMembers.size() == 2, is(Boolean.TRUE));
GeometryAssociationType geometryAssociationType = geometryMembers.get(0).getValue();
JAXBElement<? extends AbstractGeometryType> jaxbElement = geometryAssociationType.getGeometry();
assertThat(Wfs10Constants.POINT.getLocalPart().equals(jaxbElement.getName().getLocalPart()), is(Boolean.TRUE));
PointType pointType = (PointType) jaxbElement.getValue();
assertThat(pointType == null, is(Boolean.FALSE));
assertThat(GEOMETRYCOLLECTION_POINT_COORD.equals(pointType.getCoordinates().getValue().trim()), is(Boolean.TRUE));
GeometryAssociationType geometryAssociationType2 = geometryMembers.get(1).getValue();
JAXBElement<? extends AbstractGeometryType> jaxbElement2 = geometryAssociationType2.getGeometry();
assertThat(Wfs10Constants.LINESTRING.getLocalPart().equals(jaxbElement2.getName().getLocalPart()), is(Boolean.TRUE));
LineStringType lineStringType = (LineStringType) jaxbElement2.getValue();
assertThat(lineStringType == null, is(Boolean.FALSE));
assertThat(GEOMETRYCOLLECTION_LINESTRING_COORD.equals(lineStringType.getCoordinates().getValue().trim()), is(Boolean.TRUE));
}
use of ogc.schema.opengis.gml.v_2_1_2.GeometryCollectionType 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;
}
Aggregations