Search in sources :

Example 6 with DirectPositionType

use of org.geotoolkit.gml.xml.v311.DirectPositionType in project ddf by codice.

the class WfsFilterDelegateTest method testDisjointAsNotBBox.

@Test
public void testDisjointAsNotBBox() {
    WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.BBOX.getValue(), new LonLatCoordinateStrategy());
    FilterType filter = delegate.disjoint(Metacard.ANY_GEO, POLYGON);
    assertThat(filter.getLogicOps().getValue(), is(instanceOf(UnaryLogicOpType.class)));
    UnaryLogicOpType type = (UnaryLogicOpType) filter.getLogicOps().getValue();
    assertThat(type.getSpatialOps().getValue(), is(instanceOf(BBOXType.class)));
    BBOXType bboxType = (BBOXType) type.getSpatialOps().getValue();
    EnvelopeType envelope = bboxType.getEnvelope().getValue();
    DirectPositionType lowerCorner = envelope.getLowerCorner();
    assertThat("The bounding box's lower corner was null.", lowerCorner, is(notNullValue()));
    assertThat(lowerCorner.getValue(), is(asList(10.0, -10.0)));
    DirectPositionType upperCorner = envelope.getUpperCorner();
    assertThat("The bounding box's upper corner was null.", upperCorner, is(notNullValue()));
    assertThat(upperCorner.getValue(), is(asList(40.0, 30.0)));
}
Also used : UnaryLogicOpType(net.opengis.filter.v_1_1_0.UnaryLogicOpType) FilterType(net.opengis.filter.v_1_1_0.FilterType) EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) BBOXType(net.opengis.filter.v_1_1_0.BBOXType) DirectPositionType(net.opengis.gml.v_3_1_1.DirectPositionType) Test(org.junit.Test)

Example 7 with DirectPositionType

use of org.geotoolkit.gml.xml.v311.DirectPositionType in project ddf by codice.

the class WfsFilterDelegateTest method testBoundingBoxLonLatOrder.

@Test
public void testBoundingBoxLonLatOrder() {
    final WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.BBOX.getValue(), new LonLatCoordinateStrategy());
    final FilterType filter = delegate.intersects(Metacard.ANY_GEO, POLYGON);
    assertThat(filter.getSpatialOps().getValue(), is(instanceOf(BBOXType.class)));
    final BBOXType bboxType = (BBOXType) filter.getSpatialOps().getValue();
    final EnvelopeType envelope = bboxType.getEnvelope().getValue();
    final DirectPositionType lowerCorner = envelope.getLowerCorner();
    assertThat("The bounding box's lower corner was null.", lowerCorner, is(notNullValue()));
    assertThat(lowerCorner.getValue(), is(asList(10.0, -10.0)));
    final DirectPositionType upperCorner = envelope.getUpperCorner();
    assertThat("The bounding box's upper corner was null.", upperCorner, is(notNullValue()));
    assertThat(upperCorner.getValue(), is(asList(40.0, 30.0)));
}
Also used : FilterType(net.opengis.filter.v_1_1_0.FilterType) EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) BBOXType(net.opengis.filter.v_1_1_0.BBOXType) DirectPositionType(net.opengis.gml.v_3_1_1.DirectPositionType) Test(org.junit.Test)

Example 8 with DirectPositionType

use of org.geotoolkit.gml.xml.v311.DirectPositionType in project ddf by codice.

the class WfsFilterDelegateTest method testBoundingBoxLatLonOrder.

@Test
public void testBoundingBoxLatLonOrder() {
    final WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.BBOX.getValue(), new LatLonCoordinateStrategy());
    final FilterType filter = delegate.intersects(Metacard.ANY_GEO, POLYGON);
    assertThat(filter.getSpatialOps().getValue(), is(instanceOf(BBOXType.class)));
    final BBOXType bboxType = (BBOXType) filter.getSpatialOps().getValue();
    final EnvelopeType envelope = bboxType.getEnvelope().getValue();
    final DirectPositionType lowerCorner = envelope.getLowerCorner();
    assertThat("The bounding box's lower corner was null.", lowerCorner, is(notNullValue()));
    assertThat(lowerCorner.getValue(), is(asList(-10.0, 10.0)));
    final DirectPositionType upperCorner = envelope.getUpperCorner();
    assertThat("The bounding box's upper corner was null.", upperCorner, is(notNullValue()));
    assertThat(upperCorner.getValue(), is(asList(30.0, 40.0)));
}
Also used : FilterType(net.opengis.filter.v_1_1_0.FilterType) EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) BBOXType(net.opengis.filter.v_1_1_0.BBOXType) DirectPositionType(net.opengis.gml.v_3_1_1.DirectPositionType) Test(org.junit.Test)

Example 9 with DirectPositionType

use of org.geotoolkit.gml.xml.v311.DirectPositionType in project ddf by codice.

the class WfsFilterDelegate method buildBBoxType.

private JAXBElement<BBOXType> buildBBoxType(String propertyName, String wkt) {
    BBOXType bboxType = new BBOXType();
    bboxType.setPropertyName(createPropertyNameType(propertyName).getValue());
    EnvelopeType envelopeType = gmlObjectFactory.createEnvelopeType();
    Envelope envelope = createEnvelopeFromWkt(wkt);
    List<Double> lowerCornerCoordinates = coordinateStrategy.lowerCorner(envelope);
    List<Double> upperCornerCoordinates = coordinateStrategy.upperCorner(envelope);
    DirectPositionType lowerCorner = new DirectPositionType();
    lowerCorner.setValue(lowerCornerCoordinates);
    envelopeType.setLowerCorner(lowerCorner);
    DirectPositionType upperCorner = new DirectPositionType();
    upperCorner.setValue(upperCornerCoordinates);
    envelopeType.setUpperCorner(upperCorner);
    bboxType.setEnvelope(gmlObjectFactory.createEnvelope(envelopeType));
    return filterObjectFactory.createBBOX(bboxType);
}
Also used : EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) BBOXType(net.opengis.filter.v_1_1_0.BBOXType) DirectPositionType(net.opengis.gml.v_3_1_1.DirectPositionType) Envelope(org.locationtech.jts.geom.Envelope)

Example 10 with DirectPositionType

use of org.geotoolkit.gml.xml.v311.DirectPositionType in project ddf by codice.

the class WfsFilterDelegate method createEnvelope.

private JAXBElement<EnvelopeType> createEnvelope(Geometry geometry) {
    EnvelopeType envelopeType = gml320ObjectFactory.createEnvelopeType();
    envelopeType.setSrsName(GeospatialUtil.EPSG_4326_URN);
    Envelope envelope = geometry.getEnvelopeInternal();
    DirectPositionType lowerCorner = gml320ObjectFactory.createDirectPositionType();
    lowerCorner.getValue().add(envelope.getMinX());
    lowerCorner.getValue().add(envelope.getMinY());
    envelopeType.setLowerCorner(lowerCorner);
    DirectPositionType upperCorner = gml320ObjectFactory.createDirectPositionType();
    upperCorner.getValue().add(envelope.getMaxX());
    upperCorner.getValue().add(envelope.getMaxY());
    envelopeType.setUpperCorner(upperCorner);
    return gml320ObjectFactory.createEnvelope(envelopeType);
}
Also used : EnvelopeType(net.opengis.gml.v_3_2_1.EnvelopeType) DirectPositionType(net.opengis.gml.v_3_2_1.DirectPositionType) Envelope(org.locationtech.jts.geom.Envelope)

Aggregations

DirectPositionType (org.geotoolkit.gml.xml.v311.DirectPositionType)24 ArrayList (java.util.ArrayList)14 PointType (org.geotoolkit.gml.xml.v311.PointType)14 Test (org.junit.Test)11 StringWriter (java.io.StringWriter)10 DirectPositionType (net.opengis.gml.v_3_1_1.DirectPositionType)10 DirectPositionType (org.geotoolkit.gml.xml.v321.DirectPositionType)10 EnvelopeType (org.geotoolkit.gml.xml.v311.EnvelopeType)9 StringReader (java.io.StringReader)8 JAXBElement (javax.xml.bind.JAXBElement)8 EnvelopeType (net.opengis.gml.v_3_1_1.EnvelopeType)7 Geometry (org.locationtech.jts.geom.Geometry)7 Coordinate (org.locationtech.jts.geom.Coordinate)6 BBOXType (net.opengis.filter.v_1_1_0.BBOXType)5 CoordinateReferenceSystem (org.opengis.referencing.crs.CoordinateReferenceSystem)5 DirectPositionType (net.opengis.gml.x32.DirectPositionType)4 FeaturePropertyType (org.geotoolkit.gml.xml.v311.FeaturePropertyType)4 SamplingPointType (org.geotoolkit.sampling.xml.v100.SamplingPointType)4 FilterType (net.opengis.filter.v_1_1_0.FilterType)3 DirectPositionType (net.opengis.gml.v_3_2_1.DirectPositionType)3