Search in sources :

Example 16 with SpatialOperatorType

use of net.opengis.filter.v_1_1_0.SpatialOperatorType 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

ArrayList (java.util.ArrayList)11 SpatialOperatorType (net.opengis.filter.v_1_1_0.SpatialOperatorType)8 SpatialOperatorType (net.opengis.filter.v_2_0_0.SpatialOperatorType)8 FilterCapabilities (net.opengis.filter.v_2_0_0.FilterCapabilities)6 FeatureAttributeDescriptor (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureAttributeDescriptor)5 FilterType (net.opengis.filter.v_2_0_0.FilterType)4 QName (javax.xml.namespace.QName)3 FilterCapabilities (net.opengis.filter.v_1_1_0.FilterCapabilities)3 SpatialOperatorNameType (net.opengis.filter.v_1_1_0.SpatialOperatorNameType)3 SpatialOperatorsType (net.opengis.filter.v_1_1_0.SpatialOperatorsType)3 BinarySpatialOpType (net.opengis.filter.v_2_0_0.BinarySpatialOpType)3 GeometryOperand (net.opengis.filter.v_2_0_0.GeometryOperandsType.GeometryOperand)3 Test (org.junit.Test)3 EnumMap (java.util.EnumMap)2 ComparisonOperatorsType (net.opengis.filter.v_1_1_0.ComparisonOperatorsType)2 GeometryOperandsType (net.opengis.filter.v_1_1_0.GeometryOperandsType)2 LogicalOperators (net.opengis.filter.v_1_1_0.LogicalOperators)2 ScalarCapabilitiesType (net.opengis.filter.v_1_1_0.ScalarCapabilitiesType)2 SpatialCapabilitiesType (net.opengis.filter.v_1_1_0.SpatialCapabilitiesType)2 SpatialOperatorsType (net.opengis.filter.v_2_0_0.SpatialOperatorsType)2