Search in sources :

Example 6 with GeometryOperand

use of net.opengis.filter.v_2_0_0.GeometryOperandsType.GeometryOperand 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)

Aggregations

GeometryOperand (net.opengis.filter.v_2_0_0.GeometryOperandsType.GeometryOperand)6 FilterCapabilities (net.opengis.filter.v_2_0_0.FilterCapabilities)5 SpatialOperatorType (net.opengis.filter.v_2_0_0.SpatialOperatorType)5 ArrayList (java.util.ArrayList)4 BinarySpatialOpType (net.opengis.filter.v_2_0_0.BinarySpatialOpType)4 FilterType (net.opengis.filter.v_2_0_0.FilterType)4 Test (org.junit.Test)4 FeatureAttributeDescriptor (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureAttributeDescriptor)2 QName (javax.xml.namespace.QName)1 ComparisonOperatorType (net.opengis.filter.v_2_0_0.ComparisonOperatorType)1 ComparisonOperatorsType (net.opengis.filter.v_2_0_0.ComparisonOperatorsType)1 ConformanceType (net.opengis.filter.v_2_0_0.ConformanceType)1 GeometryOperandsType (net.opengis.filter.v_2_0_0.GeometryOperandsType)1 LogicalOperators (net.opengis.filter.v_2_0_0.LogicalOperators)1 ScalarCapabilitiesType (net.opengis.filter.v_2_0_0.ScalarCapabilitiesType)1 SpatialCapabilitiesType (net.opengis.filter.v_2_0_0.SpatialCapabilitiesType)1 SpatialOperatorsType (net.opengis.filter.v_2_0_0.SpatialOperatorsType)1 TemporalCapabilitiesType (net.opengis.filter.v_2_0_0.TemporalCapabilitiesType)1 TemporalOperandsType (net.opengis.filter.v_2_0_0.TemporalOperandsType)1 TemporalOperand (net.opengis.filter.v_2_0_0.TemporalOperandsType.TemporalOperand)1