Search in sources :

Example 1 with BBOXType

use of org.geotoolkit.ogc.xml.v100.BBOXType in project ddf by codice.

the class TestWfsFilterDelegate method testIntersectsAsBoundingBox.

@Test
public void testIntersectsAsBoundingBox() throws SAXException, IOException, JAXBException {
    WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.BBOX.toString());
    FilterType filter = delegate.intersects(Metacard.ANY_GEO, POLYGON);
    assertNotNull(filter);
    assertTrue(filter.getSpatialOps().getValue() instanceof BBOXType);
    assertFalse(filter.isSetLogicOps());
    assertXMLEqual(MockWfsServer.getBboxXmlFilter(), getXmlFromMarshaller(filter));
}
Also used : FilterType(net.opengis.filter.v_2_0_0.FilterType) BBOXType(net.opengis.filter.v_2_0_0.BBOXType) Test(org.junit.Test)

Example 2 with BBOXType

use of org.geotoolkit.ogc.xml.v100.BBOXType in project ddf by codice.

the class WfsFilterDelegate method buildBBoxType.

private JAXBElement<BBOXType> buildBBoxType(String propertyName, String wkt) {
    BBOXType bboxType = new BBOXType();
    JAXBElement<BoxType> box = createBoxType(wkt);
    bboxType.setBox(box.getValue());
    bboxType.setPropertyName(createPropertyNameType(propertyName).getValue());
    return filterObjectFactory.createBBOX(bboxType);
}
Also used : BBOXType(ogc.schema.opengis.filter.v_1_0_0.BBOXType) BoxType(ogc.schema.opengis.gml.v_2_1_2.BoxType)

Example 3 with BBOXType

use of org.geotoolkit.ogc.xml.v100.BBOXType 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 4 with BBOXType

use of org.geotoolkit.ogc.xml.v100.BBOXType 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 5 with BBOXType

use of org.geotoolkit.ogc.xml.v100.BBOXType 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)

Aggregations

Test (org.junit.Test)8 BBOXType (net.opengis.filter.v_1_1_0.BBOXType)6 EnvelopeType (net.opengis.gml.v_3_1_1.EnvelopeType)6 JAXBElement (javax.xml.bind.JAXBElement)5 BBOXType (net.opengis.filter.v_2_0_0.BBOXType)5 DirectPositionType (net.opengis.gml.v_3_1_1.DirectPositionType)5 FilterType (net.opengis.filter.v_1_1_0.FilterType)4 FilterType (net.opengis.filter.v_2_0_0.FilterType)4 PropertyNameType (org.geotoolkit.ogc.xml.v110.PropertyNameType)4 List (java.util.List)3 BBOXType (net.opengis.fes.x20.BBOXType)3 DirectPositionType (org.geotoolkit.gml.xml.v311.DirectPositionType)3 EnvelopeType (org.geotoolkit.gml.xml.v311.EnvelopeType)3 OverlapsType (org.geotoolkit.ogc.xml.v110.OverlapsType)3 Envelope (org.locationtech.jts.geom.Envelope)3 Expression (org.opengis.filter.Expression)3 ArrayList (java.util.ArrayList)2 UnaryLogicOpType (net.opengis.filter.v_2_0_0.UnaryLogicOpType)2 BBOXType (org.geosdi.geoplatform.xml.filter.v110.BBOXType)2 TimeInstantType (org.geotoolkit.gml.xml.v321.TimeInstantType)2