Search in sources :

Example 1 with SpatialOperatorType

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

the class TestWfsFilterDelegate method testIntersectsLonLat.

@Test
public void testIntersectsLonLat() 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);
    WfsFilterDelegate delegate = new WfsFilterDelegate(mockFeatureMetacardType, capabilities, GeospatialUtil.EPSG_4326_URN, null, GeospatialUtil.LON_LAT_ORDER);
    FilterType filter = delegate.intersects(Metacard.ANY_GEO, POLYGON);
    assertTrue(filter.getSpatialOps().getValue() instanceof BinarySpatialOpType);
    assertFalse(filter.isSetLogicOps());
    assertXMLEqual(MockWfsServer.getIntersectsLonLatXmlFilter(), getXmlFromMarshaller(filter));
}
Also used : 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 2 with SpatialOperatorType

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

the class TestWfsFilterDelegate method testIntersectsWithEnvelopeLonLat.

@Test
public void testIntersectsWithEnvelopeLonLat() 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.LON_LAT_ORDER);
    FilterType filter = delegate.intersects(Metacard.ANY_GEO, POLYGON);
    assertTrue(filter.getSpatialOps().getValue() instanceof BinarySpatialOpType);
    assertFalse(filter.isSetLogicOps());
    assertXMLEqual(MockWfsServer.getIntersectsWithEnvelopeLonLatXmlFilter(), 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 3 with SpatialOperatorType

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

the class TestWfsFilterDelegate method intersectsMultiple.

private void intersectsMultiple(boolean indexed) {
    List<String> gmlProps = new ArrayList<>();
    gmlProps.add(MOCK_GEOM);
    gmlProps.add(MOCK_GEOM2);
    when(mockFeatureMetacardType.getGmlProperties()).thenReturn(gmlProps);
    for (String gmlProp : gmlProps) {
        when(mockFeatureMetacardType.getAttributeDescriptor(gmlProp)).thenReturn(new FeatureAttributeDescriptor(gmlProp, gmlProp, indexed, 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);
    WfsFilterDelegate delegate = new WfsFilterDelegate(mockFeatureMetacardType, capabilities, GeospatialUtil.EPSG_4326_URN, null, GeospatialUtil.LAT_LON_ORDER);
    FilterType filter = delegate.intersects(Metacard.ANY_GEO, POLYGON);
    if (indexed) {
        assertNotNull(filter);
        assertTrue(filter.isSetLogicOps());
        assertNotNull(filter.getLogicOps());
    } else {
        assertNull(filter);
    }
}
Also used : 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)

Example 4 with SpatialOperatorType

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

the class TestWfsFilterDelegate method setupFilterDelegate.

private WfsFilterDelegate setupFilterDelegate(String spatialOpType) {
    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(spatialOpType);
    FilterCapabilities capabilities = MockWfsServer.getFilterCapabilities();
    capabilities.getSpatialCapabilities().getSpatialOperators().getSpatialOperator().clear();
    capabilities.getSpatialCapabilities().getSpatialOperators().getSpatialOperator().add(operator);
    return new WfsFilterDelegate(mockFeatureMetacardType, capabilities, GeospatialUtil.EPSG_4326_URN, null, GeospatialUtil.LAT_LON_ORDER);
}
Also used : FilterCapabilities(net.opengis.filter.v_2_0_0.FilterCapabilities) FeatureAttributeDescriptor(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureAttributeDescriptor) SpatialOperatorType(net.opengis.filter.v_2_0_0.SpatialOperatorType) ArrayList(java.util.ArrayList)

Example 5 with SpatialOperatorType

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

the class WfsSource method updateSupportedSpatialOperators.

private void updateSupportedSpatialOperators(SpatialOperatorsType spatialOperatorsType) {
    if (spatialOperatorsType == null) {
        return;
    }
    supportedSpatialOperators = spatialOperatorsType;
    if (NO_FORCED_SPATIAL_FILTER.equals(forceSpatialFilter)) {
        return;
    }
    SpatialOperatorsType forcedSpatialOpType = new SpatialOperatorsType();
    SpatialOperatorType sot = new SpatialOperatorType();
    sot.setName(forceSpatialFilter);
    forcedSpatialOpType.getSpatialOperator().add(sot);
    for (WfsFilterDelegate delegate : featureTypeFilters.values()) {
        delegate.setSpatialOps(forcedSpatialOpType);
    }
}
Also used : SpatialOperatorsType(net.opengis.filter.v_2_0_0.SpatialOperatorsType) SpatialOperatorType(net.opengis.filter.v_2_0_0.SpatialOperatorType)

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