Search in sources :

Example 11 with BBOXType

use of net.opengis.filter.v_1_1_0.BBOXType in project ddf by codice.

the class WfsFilterDelegateTest method testDisjointAsNotBBox.

@Test
public void testDisjointAsNotBBox() throws SAXException, IOException, JAXBException {
    WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.BBOX.toString());
    FilterType filter = delegate.disjoint(Metacard.ANY_GEO, POLYGON);
    assertTrue(filter.getLogicOps().getValue() instanceof UnaryLogicOpType);
    UnaryLogicOpType type = (UnaryLogicOpType) filter.getLogicOps().getValue();
    assertTrue(type.getSpatialOps().getValue() instanceof BBOXType);
    assertXMLEqual(MockWfsServer.getNotBboxXmlFilter(), getXmlFromMarshaller(filter));
}
Also used : UnaryLogicOpType(net.opengis.filter.v_2_0_0.UnaryLogicOpType) FilterType(net.opengis.filter.v_2_0_0.FilterType) BBOXType(net.opengis.filter.v_2_0_0.BBOXType) Test(org.junit.Test)

Example 12 with BBOXType

use of net.opengis.filter.v_1_1_0.BBOXType in project ddf by codice.

the class TestWfsFilterDelegate method testDisjointAsNotBBox.

@Test
public void testDisjointAsNotBBox() throws SAXException, IOException, JAXBException {
    WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.BBOX.toString());
    FilterType filter = delegate.disjoint(Metacard.ANY_GEO, POLYGON);
    assertTrue(filter.getLogicOps().getValue() instanceof UnaryLogicOpType);
    UnaryLogicOpType type = (UnaryLogicOpType) filter.getLogicOps().getValue();
    assertTrue(type.getSpatialOps().getValue() instanceof BBOXType);
    assertXMLEqual(MockWfsServer.getNotBboxXmlFilter(), getXmlFromMarshaller(filter));
}
Also used : UnaryLogicOpType(net.opengis.filter.v_2_0_0.UnaryLogicOpType) FilterType(net.opengis.filter.v_2_0_0.FilterType) BBOXType(net.opengis.filter.v_2_0_0.BBOXType) Test(org.junit.Test)

Example 13 with BBOXType

use of net.opengis.filter.v_1_1_0.BBOXType in project ddf by codice.

the class WfsFilterDelegate method buildBBoxType.

private JAXBElement<BBOXType> buildBBoxType(String propertyName, String wkt) {
    BBOXType bboxType = new BBOXType();
    bboxType.setExpression(filterObjectFactory.createValueReference(propertyName));
    try {
        bboxType.setAny(createEnvelope(getGeometryFromWkt(wkt)));
    } catch (ParseException e) {
        throw new UnsupportedOperationException("Unable to parse WKT Geometry [" + wkt + "]", e);
    }
    return filterObjectFactory.createBBOX(bboxType);
}
Also used : BBOXType(net.opengis.filter.v_2_0_0.BBOXType) ParseException(org.locationtech.jts.io.ParseException)

Example 14 with BBOXType

use of net.opengis.filter.v_1_1_0.BBOXType in project ddf by codice.

the class CswFilterFactory method createBBoxType.

private JAXBElement<BBOXType> createBBoxType(String propertyName, String wkt) {
    BBOXType bboxType = new BBOXType();
    JAXBElement<EnvelopeType> envelope = createEnvelopeType(wkt);
    bboxType.setEnvelope(envelope);
    bboxType.setPropertyName(createPropertyNameType(propertyName));
    return filterObjectFactory.createBBOX(bboxType);
}
Also used : EnvelopeType(net.opengis.gml.v_3_1_1.EnvelopeType) BBOXType(net.opengis.filter.v_1_1_0.BBOXType)

Example 15 with BBOXType

use of net.opengis.filter.v_1_1_0.BBOXType in project ddf by codice.

the class WfsFilterDelegateTest method testIntersectsAsBoundingBox.

@Test
public void testIntersectsAsBoundingBox() {
    WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.BBOX.getValue(), new LonLatCoordinateStrategy());
    FilterType filter = delegate.intersects(Metacard.ANY_GEO, POLYGON);
    assertThat(filter.getSpatialOps().getValue(), is(instanceOf(BBOXType.class)));
    assertThat(filter.isSetLogicOps(), is(false));
    BBOXType bboxType = (BBOXType) filter.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 : 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 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 BBOXType (net.opengis.fes.x20.BBOXType)3 UnaryLogicOpType (net.opengis.filter.v_2_0_0.UnaryLogicOpType)2 XmlObject (org.apache.xmlbeans.XmlObject)2 Envelope (org.locationtech.jts.geom.Envelope)2 SpatialFilter (org.n52.shetland.ogc.filter.SpatialFilter)2 BBOXDocument (net.opengis.fes.x20.BBOXDocument)1 UnaryLogicOpType (net.opengis.filter.v_1_1_0.UnaryLogicOpType)1 BBOXType (ogc.schema.opengis.filter.v_1_0_0.BBOXType)1 BoxType (ogc.schema.opengis.gml.v_2_1_2.BoxType)1 XmlCursor (org.apache.xmlbeans.XmlCursor)1 XmlException (org.apache.xmlbeans.XmlException)1 Geometry (org.locationtech.jts.geom.Geometry)1 GeometryFactory (org.locationtech.jts.geom.GeometryFactory)1