use of net.opengis.gml.v_3_2_1.MultiPointType 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;
}
use of net.opengis.gml.v_3_2_1.MultiPointType in project ddf by codice.
the class WfsFilterDelegate method createMultiPoint.
private JAXBElement<MultiPointType> createMultiPoint(Geometry geometry) {
JAXBElement<MultiPointType> jaxbElement = null;
try {
String gml = Wfs10JTStoGML200Converter.convertGeometryToGML(geometry);
MultiPointType multiPointType = (MultiPointType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(gml, Wfs10Constants.POINT);
jaxbElement = (JAXBElement<MultiPointType>) Wfs10JTStoGML200Converter.convertGeometryTypeToJAXB(multiPointType);
} catch (JAXBException jbe) {
LOGGER.debug("Unable to create MultiPointType with geometry: [{}]", geometry);
}
return jaxbElement;
}
use of net.opengis.gml.v_3_2_1.MultiPointType in project ddf by codice.
the class Wfs20JTStoGML321Converter method convertToMultiPointType.
public static MultiPointType convertToMultiPointType(MultiPoint multiPoint, String srsName) {
MultiPointType multiPointType = GML320_OBJECT_FACTORY.createMultiPointType();
for (int i = 0; i < multiPoint.getNumGeometries(); i++) {
Point point = (Point) multiPoint.getGeometryN(i);
PointPropertyType pointPropertyType = GML320_OBJECT_FACTORY.createPointPropertyType();
pointPropertyType.setPoint(convertToPointType(point, srsName));
multiPointType.getPointMember().add(pointPropertyType);
}
multiPointType.setSrsName(srsName);
return multiPointType;
}
use of net.opengis.gml.v_3_2_1.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));
}
use of net.opengis.gml.v_3_2_1.MultiPointType in project ddf by codice.
the class TestWfs10JTStoGML200Converter method testMultiPointTypeToJAXB.
@Test
public void testMultiPointTypeToJAXB() throws JAXBException, SAXException, IOException, ParseException, NullPointerException {
String multiPointGML = Wfs10JTStoGML200Converter.convertGeometryToGML(getGeometryFromWkt(MULTIPOINT));
MultiPointType multiPointType = (MultiPointType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(multiPointGML, Wfs10Constants.MULTI_POINT);
JAXBElement<MultiPointType> multiPointTypeJAXBElement = (JAXBElement<MultiPointType>) Wfs10JTStoGML200Converter.convertGeometryTypeToJAXB(multiPointType);
JAXB.marshal(multiPointTypeJAXBElement, writer);
String xml = writer.toString();
Diff diff = XMLUnit.compareXML(xml, MULTIPOINT_GML);
assertTrue(XMLUNIT_SIMILAR, diff.similar());
assertThat(diff.similar(), is(Boolean.TRUE));
assertThat(diff.identical(), is(Boolean.FALSE));
}
Aggregations