Search in sources :

Example 6 with SpatialOperatorType

use of net.opengis.fes.x20.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 7 with SpatialOperatorType

use of net.opengis.fes.x20.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 8 with SpatialOperatorType

use of net.opengis.fes.x20.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 9 with SpatialOperatorType

use of net.opengis.fes.x20.SpatialOperatorType in project ddf by codice.

the class TestCswFilterDelegate method getSpatialOperatorsList.

private static List<SpatialOperatorType> getSpatialOperatorsList() {
    List<SpatialOperatorType> spatialOperatorList = new ArrayList<>();
    SpatialOperatorType intersectsSpatialOperator = new SpatialOperatorType();
    intersectsSpatialOperator.setName(INTERSECTS);
    spatialOperatorList.add(intersectsSpatialOperator);
    SpatialOperatorType bboxSpatialOperator = new SpatialOperatorType();
    bboxSpatialOperator.setName(BBOX);
    spatialOperatorList.add(bboxSpatialOperator);
    SpatialOperatorType crossesSpatialOperator = new SpatialOperatorType();
    crossesSpatialOperator.setName(CROSSES);
    spatialOperatorList.add(crossesSpatialOperator);
    SpatialOperatorType withinSpatialOperator = new SpatialOperatorType();
    withinSpatialOperator.setName(WITHIN);
    spatialOperatorList.add(withinSpatialOperator);
    SpatialOperatorType containsSpatialOperator = new SpatialOperatorType();
    containsSpatialOperator.setName(CONTAINS);
    spatialOperatorList.add(containsSpatialOperator);
    SpatialOperatorType beyondSpatialOperator = new SpatialOperatorType();
    beyondSpatialOperator.setName(BEYOND);
    spatialOperatorList.add(beyondSpatialOperator);
    SpatialOperatorType dwithinSpatialOperator = new SpatialOperatorType();
    dwithinSpatialOperator.setName(D_WITHIN);
    spatialOperatorList.add(dwithinSpatialOperator);
    SpatialOperatorType disjointSpatialOperator = new SpatialOperatorType();
    disjointSpatialOperator.setName(DISJOINT);
    spatialOperatorList.add(disjointSpatialOperator);
    SpatialOperatorType overlapsSpatialOperator = new SpatialOperatorType();
    overlapsSpatialOperator.setName(OVERLAPS);
    spatialOperatorList.add(overlapsSpatialOperator);
    SpatialOperatorType touchesSpatialOperator = new SpatialOperatorType();
    touchesSpatialOperator.setName(TOUCHES);
    spatialOperatorList.add(touchesSpatialOperator);
    return spatialOperatorList;
}
Also used : SpatialOperatorType(net.opengis.filter.v_1_1_0.SpatialOperatorType) ArrayList(java.util.ArrayList)

Example 10 with SpatialOperatorType

use of net.opengis.fes.x20.SpatialOperatorType in project ddf by codice.

the class TestCswEndpoint method verifyFilterCapabilities.

/**
     * Helper method to verify the FilterCapabilities section matches the endpoint's definition
     *
     * @param ct The CapabilitiesType to verify
     */
private void verifyFilterCapabilities(CapabilitiesType ct) {
    FilterCapabilities fc = ct.getFilterCapabilities();
    assertThat(fc.getIdCapabilities(), notNullValue());
    assertThat(fc.getIdCapabilities().getEIDOrFID(), hasSize(1));
    assertThat(fc.getScalarCapabilities(), notNullValue());
    assertThat(CswEndpoint.COMPARISON_OPERATORS, hasSize(fc.getScalarCapabilities().getComparisonOperators().getComparisonOperator().size()));
    for (ComparisonOperatorType cot : CswEndpoint.COMPARISON_OPERATORS) {
        assertThat(fc.getScalarCapabilities().getComparisonOperators().getComparisonOperator(), hasItem(cot));
    }
    assertThat(fc.getSpatialCapabilities(), notNullValue());
    assertThat(CswEndpoint.SPATIAL_OPERATORS, hasSize(fc.getSpatialCapabilities().getSpatialOperators().getSpatialOperator().size()));
    for (SpatialOperatorType sot : fc.getSpatialCapabilities().getSpatialOperators().getSpatialOperator()) {
        assertThat(CswEndpoint.SPATIAL_OPERATORS, hasItem(sot.getName()));
    }
}
Also used : FilterCapabilities(net.opengis.filter.v_1_1_0.FilterCapabilities) SpatialOperatorType(net.opengis.filter.v_1_1_0.SpatialOperatorType) ComparisonOperatorType(net.opengis.filter.v_1_1_0.ComparisonOperatorType)

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 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 SPATIAL_OPERATORS (org.codice.ddf.spatial.ogc.wfs.v2_0_0.catalog.common.Wfs20Constants.SPATIAL_OPERATORS)2