use of net.opengis.gml.v_3_2_1.PointType in project ddf by codice.
the class WfsFilterDelegate method createPoint.
private JAXBElement<PointType> createPoint(Geometry geometry) {
Coordinate[] coordinates = geometry.getCoordinates();
if (coordinates != null && coordinates.length > 0) {
StringBuilder coordString = new StringBuilder();
coordString.append(coordinates[0].x).append(",").append(coordinates[0].y);
CoordinatesType coordinatesType = new CoordinatesType();
coordinatesType.setValue(coordString.toString());
PointType point = new PointType();
point.setSrsName(srsName);
point.setCoordinates(coordinatesType);
return gml320ObjectFactory.createPoint(point);
} else {
throw new IllegalArgumentException("Unable to parse Point coordinates from WKT String");
}
}
use of net.opengis.gml.v_3_2_1.PointType 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 net.opengis.gml.v_3_2_1.PointType 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);
}
}
}
Aggregations