use of net.opengis.gml._3.LinearRingType 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();
}
use of net.opengis.gml._3.LinearRingType in project ddf by codice.
the class WfsFilterDelegate method createPolygon.
private JAXBElement<PolygonType> createPolygon(String wkt) {
PolygonType polygon = new PolygonType();
LinearRingType linearRing = new LinearRingType();
Coordinate[] coordinates = getCoordinatesFromWkt(wkt);
if (coordinates != null && coordinates.length > 0) {
StringBuffer coordString = new StringBuffer();
for (Coordinate coordinate : coordinates) {
coordString.append(coordinate.x).append(",").append(coordinate.y).append(" ");
}
CoordinatesType coordinatesType = new CoordinatesType();
coordinatesType.setValue(coordString.toString());
coordinatesType.setDecimal(".");
coordinatesType.setCs(",");
coordinatesType.setTs(" ");
linearRing.setCoordinates(coordinatesType);
LinearRingMemberType member = new LinearRingMemberType();
member.setGeometry(gmlObjectFactory.createLinearRing(linearRing));
polygon.setOuterBoundaryIs(member);
polygon.setSrsName(srsName);
return gmlObjectFactory.createPolygon(polygon);
} else {
throw new IllegalArgumentException("Unable to parse Polygon coordinates from WKT String");
}
}
use of net.opengis.gml._3.LinearRingType in project ddf by codice.
the class CswQueryFactoryTest method createPolygon.
private JAXBElement<AbstractGeometryType> createPolygon() {
PolygonType localPolygon = new PolygonType();
LinearRingType ring = new LinearRingType();
for (Coordinate coordinate : polygon.getCoordinates()) {
CoordType coord = new CoordType();
coord.setX(BigDecimal.valueOf(coordinate.x));
coord.setY(BigDecimal.valueOf(coordinate.y));
if (!Double.isNaN(coordinate.z)) {
coord.setZ(BigDecimal.valueOf(coordinate.z));
}
ring.getCoord().add(coord);
}
AbstractRingPropertyType abstractRing = new AbstractRingPropertyType();
abstractRing.setRing(gmlObjectFactory.createLinearRing(ring));
localPolygon.setExterior(gmlObjectFactory.createExterior(abstractRing));
JAXBElement<AbstractGeometryType> agt = new JAXBElement<>(new QName("http://www.opengis.net/gml", "Polygon"), AbstractGeometryType.class, null, localPolygon);
return agt;
}
use of net.opengis.gml._3.LinearRingType in project ddf by codice.
the class WfsFilterDelegateTest method testMultiPolygonSupportsOnlyPolygonIsEnvelopePolygon.
@Test
public void testMultiPolygonSupportsOnlyPolygonIsEnvelopePolygon() {
final WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.INTERSECTS.getValue(), new LonLatCoordinateStrategy());
delegate.setSupportedGeometryOperands(singletonList(Wfs11Constants.POLYGON));
final FilterType filter = delegate.intersects(Metacard.ANY_GEO, MULTIPOLYGON);
assertThat(filter.getSpatialOps().getValue(), is(instanceOf(BinarySpatialOpType.class)));
final BinarySpatialOpType binarySpatialOpType = (BinarySpatialOpType) filter.getSpatialOps().getValue();
assertThat(binarySpatialOpType.getGeometry().getValue(), is(instanceOf(PolygonType.class)));
final PolygonType polygonType = (PolygonType) binarySpatialOpType.getGeometry().getValue();
assertThat(polygonType.getExterior().getValue().getRing().getValue(), is(instanceOf(LinearRingType.class)));
final LinearRingType linearRingType = (LinearRingType) polygonType.getExterior().getValue().getRing().getValue();
assertThat(linearRingType.getCoordinates().getValue(), is("5.0,5.0 5.0,40.0 45.0,40.0 45.0,5.0 5.0,5.0"));
}
use of net.opengis.gml._3.LinearRingType in project ddf by codice.
the class WfsFilterDelegateTest method testMultiPolygonLatLonOrder.
@Test
public void testMultiPolygonLatLonOrder() {
final WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.INTERSECTS.getValue(), new LatLonCoordinateStrategy());
final FilterType filter = delegate.intersects(Metacard.ANY_GEO, MULTIPOLYGON);
assertThat(filter.getSpatialOps().getValue(), is(instanceOf(BinarySpatialOpType.class)));
final BinarySpatialOpType binarySpatialOpType = (BinarySpatialOpType) filter.getSpatialOps().getValue();
assertThat(binarySpatialOpType.getGeometry().getValue(), is(instanceOf(MultiPolygonType.class)));
final MultiPolygonType multiPolygonType = (MultiPolygonType) binarySpatialOpType.getGeometry().getValue();
assertThat(multiPolygonType.getPolygonMember().size(), is(2));
final LinearRingType firstLinearRing = (LinearRingType) multiPolygonType.getPolygonMember().get(0).getPolygon().getExterior().getValue().getRing().getValue();
assertThat(firstLinearRing.getCoordinates().getValue(), is("20.0,30.0 40.0,10.0 40.0,45.0 20.0,30.0"));
}
Aggregations