Search in sources :

Example 11 with BinarySpatialOpType

use of net.opengis.filter.v_2_0_0.BinarySpatialOpType in project ddf by codice.

the class CswQueryFactoryTest method testPostGetRecordsSpatialTouchesOgcFilter.

@Test
public void testPostGetRecordsSpatialTouchesOgcFilter() throws CswException, UnsupportedQueryException, SourceUnavailableException, FederationException {
    BinarySpatialOpType op = createBinarySpatialOpType();
    ogcSpatialQuery(Touches.class, filterObjectFactory.createTouches(op));
}
Also used : BinarySpatialOpType(net.opengis.filter.v_1_1_0.BinarySpatialOpType) Test(org.junit.Test)

Example 12 with BinarySpatialOpType

use of net.opengis.filter.v_2_0_0.BinarySpatialOpType in project ddf by codice.

the class CswQueryFactoryTest method testPostGetRecordsSpatialIntersectsOgcFilter.

@Test
public void testPostGetRecordsSpatialIntersectsOgcFilter() throws CswException, UnsupportedQueryException, SourceUnavailableException, FederationException {
    BinarySpatialOpType op = createBinarySpatialOpType();
    ogcSpatialQuery(Intersects.class, filterObjectFactory.createIntersects(op));
}
Also used : BinarySpatialOpType(net.opengis.filter.v_1_1_0.BinarySpatialOpType) Test(org.junit.Test)

Example 13 with BinarySpatialOpType

use of net.opengis.filter.v_2_0_0.BinarySpatialOpType in project ddf by codice.

the class TestWfsFilterDelegate method testIntersectsWithEnvelope.

@Test
public void testIntersectsWithEnvelope() throws SAXException, IOException, JAXBException {
    List<String> gmlProps = new ArrayList<>();
    gmlProps.add(MOCK_GEOM);
    when(mockFeatureMetacardType.getGmlProperties()).thenReturn(gmlProps);
    when(mockFeatureMetacardType.getAttributeDescriptor(MOCK_GEOM)).thenReturn(new FeatureAttributeDescriptor(MOCK_GEOM, MOCK_GEOM, true, false, false, false, BasicTypes.STRING_TYPE));
    SpatialOperatorType operator = new SpatialOperatorType();
    operator.setName(SPATIAL_OPERATORS.Intersects.toString());
    FilterCapabilities capabilities = MockWfsServer.getFilterCapabilities();
    capabilities.getSpatialCapabilities().getSpatialOperators().getSpatialOperator().clear();
    capabilities.getSpatialCapabilities().getSpatialOperators().getSpatialOperator().add(operator);
    capabilities.getSpatialCapabilities().getGeometryOperands().getGeometryOperand().clear();
    GeometryOperand geoOperand = new GeometryOperand();
    geoOperand.setName(Wfs20Constants.ENVELOPE);
    capabilities.getSpatialCapabilities().getGeometryOperands().getGeometryOperand().add(geoOperand);
    WfsFilterDelegate delegate = new WfsFilterDelegate(mockFeatureMetacardType, capabilities, GeospatialUtil.EPSG_4326_URN, null, GeospatialUtil.LAT_LON_ORDER);
    FilterType filter = delegate.intersects(Metacard.ANY_GEO, POLYGON);
    assertTrue(filter.getSpatialOps().getValue() instanceof BinarySpatialOpType);
    assertFalse(filter.isSetLogicOps());
    assertXMLEqual(MockWfsServer.getIntersectsWithEnvelopeXmlFilter(), getXmlFromMarshaller(filter));
}
Also used : GeometryOperand(net.opengis.filter.v_2_0_0.GeometryOperandsType.GeometryOperand) FilterCapabilities(net.opengis.filter.v_2_0_0.FilterCapabilities) FilterType(net.opengis.filter.v_2_0_0.FilterType) FeatureAttributeDescriptor(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureAttributeDescriptor) SpatialOperatorType(net.opengis.filter.v_2_0_0.SpatialOperatorType) ArrayList(java.util.ArrayList) BinarySpatialOpType(net.opengis.filter.v_2_0_0.BinarySpatialOpType) Test(org.junit.Test)

Example 14 with BinarySpatialOpType

use of net.opengis.filter.v_2_0_0.BinarySpatialOpType in project ddf by codice.

the class TestWfsFilterDelegate method testDisjointAsNotIntersects.

@Test
public void testDisjointAsNotIntersects() throws SAXException, IOException, JAXBException {
    WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.Intersects.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 BinarySpatialOpType);
    assertXMLEqual(MockWfsServer.getNotIntersectsXmlFilter(), getXmlFromMarshaller(filter));
}
Also used : UnaryLogicOpType(net.opengis.filter.v_2_0_0.UnaryLogicOpType) FilterType(net.opengis.filter.v_2_0_0.FilterType) BinarySpatialOpType(net.opengis.filter.v_2_0_0.BinarySpatialOpType) Test(org.junit.Test)

Example 15 with BinarySpatialOpType

use of net.opengis.filter.v_2_0_0.BinarySpatialOpType in project ddf by codice.

the class CswFilterFactory method createBinarySpatialOpTypeUsingGeometry.

@SuppressWarnings("unchecked")
private BinarySpatialOpType createBinarySpatialOpTypeUsingGeometry(PropertyNameType propertyName, JAXBElement<? extends AbstractGeometryType> geometry) {
    BinarySpatialOpType binarySpatialOpType = new BinarySpatialOpType();
    binarySpatialOpType.setPropertyName(propertyName);
    binarySpatialOpType.setGeometry((JAXBElement<AbstractGeometryType>) geometry);
    return binarySpatialOpType;
}
Also used : AbstractGeometryType(net.opengis.gml.v_3_1_1.AbstractGeometryType) BinarySpatialOpType(net.opengis.filter.v_1_1_0.BinarySpatialOpType)

Aggregations

Test (org.junit.Test)17 BinarySpatialOpType (net.opengis.filter.v_1_1_0.BinarySpatialOpType)12 BinarySpatialOpType (net.opengis.filter.v_2_0_0.BinarySpatialOpType)9 FilterType (net.opengis.filter.v_2_0_0.FilterType)9 ArrayList (java.util.ArrayList)3 FilterCapabilities (net.opengis.filter.v_2_0_0.FilterCapabilities)3 SpatialOperatorType (net.opengis.filter.v_2_0_0.SpatialOperatorType)3 FeatureAttributeDescriptor (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureAttributeDescriptor)3 GeometryOperand (net.opengis.filter.v_2_0_0.GeometryOperandsType.GeometryOperand)2 UnaryLogicOpType (net.opengis.filter.v_2_0_0.UnaryLogicOpType)2 Geometry (com.vividsolutions.jts.geom.Geometry)1 PropertyNameType (net.opengis.filter.v_1_1_0.PropertyNameType)1 AbstractGeometryType (net.opengis.gml.v_3_1_1.AbstractGeometryType)1 EnvelopeType (net.opengis.gml.v_3_1_1.EnvelopeType)1