Search in sources :

Example 6 with DistanceBufferType

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

the class CswQueryFactoryTest method createDistanceBufferType.

private DistanceBufferType createDistanceBufferType() {
    DistanceBufferType distanceBuffer = new DistanceBufferType();
    PropertyNameType propName = new PropertyNameType();
    propName.getContent().add(SPATIAL_TEST_ATTRIBUTE);
    distanceBuffer.setPropertyName(propName);
    DistanceType distance = filterObjectFactory.createDistanceType();
    distance.setUnits(REL_GEO_UNITS);
    distance.setValue(REL_GEO_DISTANCE);
    distanceBuffer.setDistance(distance);
    distanceBuffer.setGeometry(createPolygon());
    return distanceBuffer;
}
Also used : DistanceBufferType(net.opengis.filter.v_1_1_0.DistanceBufferType) DistanceType(net.opengis.filter.v_1_1_0.DistanceType) PropertyNameType(net.opengis.filter.v_1_1_0.PropertyNameType)

Example 7 with DistanceBufferType

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

the class CswQueryFactoryTest method testPostGetRecordsSpatialBeyondOgcFilter.

@Test
public void testPostGetRecordsSpatialBeyondOgcFilter() throws CswException, UnsupportedQueryException, SourceUnavailableException, FederationException {
    DistanceBufferType op = createDistanceBufferType();
    ogcSpatialRelativeQuery(Beyond.class, filterObjectFactory.createBeyond(op));
}
Also used : DistanceBufferType(net.opengis.filter.v_1_1_0.DistanceBufferType) Test(org.junit.Test)

Example 8 with DistanceBufferType

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

the class CswFilterFactory method createDistanceBufferType.

@SuppressWarnings("unchecked")
private DistanceBufferType createDistanceBufferType(PropertyNameType propertyName, JAXBElement<? extends AbstractGeometryType> geometry, DistanceType distance) {
    DistanceBufferType distanceBuffer = new DistanceBufferType();
    distanceBuffer.setDistance(distance);
    distanceBuffer.setGeometry((JAXBElement<AbstractGeometryType>) geometry);
    distanceBuffer.setPropertyName(propertyName);
    return distanceBuffer;
}
Also used : AbstractGeometryType(net.opengis.gml.v_3_1_1.AbstractGeometryType) DistanceBufferType(net.opengis.filter.v_1_1_0.DistanceBufferType)

Example 9 with DistanceBufferType

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

the class WfsFilterDelegateTest method testDwithinAsNotBeyond.

@Test
public void testDwithinAsNotBeyond() {
    WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.BEYOND.toString());
    FilterType filter = delegate.dwithin(Metacard.ANY_GEO, POLYGON, DISTANCE);
    assertTrue(filter.getLogicOps().getValue() instanceof UnaryLogicOpType);
    UnaryLogicOpType type = (UnaryLogicOpType) filter.getLogicOps().getValue();
    assertTrue(type.getSpatialOps().getValue() instanceof DistanceBufferType);
}
Also used : UnaryLogicOpType(net.opengis.filter.v_2_0_0.UnaryLogicOpType) FilterType(net.opengis.filter.v_2_0_0.FilterType) DistanceBufferType(net.opengis.filter.v_2_0_0.DistanceBufferType) Test(org.junit.Test)

Example 10 with DistanceBufferType

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

the class WfsFilterDelegateTest method testLogicalCombinationOfLogicals.

private void testLogicalCombinationOfLogicals(String methName, String compOpName) throws Exception {
    String mockProperty = "myPropertyName";
    String mockType = "myType";
    WfsFilterDelegate delegate = mockFeatureMetacardCreateDelegate(mockProperty, mockType);
    FilterType compFilter1 = delegate.propertyIsLike(Metacard.ANY_TEXT, LITERAL, true);
    FilterType compFilter2 = delegate.propertyIsLike(Metacard.ANY_TEXT, LITERAL, true);
    List<FilterType> subFiltersToBeOred = new ArrayList<>();
    subFiltersToBeOred.add(compFilter1);
    subFiltersToBeOred.add(compFilter2);
    FilterType spatialFilter1 = delegate.dwithin(Metacard.ANY_GEO, "POINT (30 10)", 1000);
    FilterType spatialFilter2 = delegate.dwithin(Metacard.ANY_GEO, "POINT (50 10)", 1500);
    List<FilterType> subFiltersToBeAnded = new ArrayList<>();
    subFiltersToBeAnded.add(spatialFilter1);
    subFiltersToBeAnded.add(spatialFilter2);
    List<FilterType> filtersToCombine = new ArrayList<>();
    filtersToCombine.add(delegate.or(subFiltersToBeOred));
    filtersToCombine.add(delegate.and(subFiltersToBeAnded));
    Method method = WfsFilterDelegate.class.getMethod(methName, List.class);
    FilterType filter = (FilterType) method.invoke(delegate, filtersToCombine);
    // Verify
    assertThat(filter.getLogicOps().getName().toString(), is(compOpName));
    BinaryLogicOpType logicOpType = (BinaryLogicOpType) filter.getLogicOps().getValue();
    BinaryLogicOpType logicOrType = (BinaryLogicOpType) logicOpType.getComparisonOpsOrSpatialOpsOrTemporalOps().get(0).getValue();
    assertThat(logicOpType.getComparisonOpsOrSpatialOpsOrTemporalOps().get(0).getName().toString(), is(LOGICAL_OR_NAME));
    assertThat(logicOrType.getComparisonOpsOrSpatialOpsOrTemporalOps().size(), is(2));
    for (JAXBElement<?> jaxbElement : logicOrType.getComparisonOpsOrSpatialOpsOrTemporalOps()) {
        PropertyIsLikeType compOpsType = (PropertyIsLikeType) jaxbElement.getValue();
        String valRef = fetchPropertyIsLikeExpression(compOpsType, VALUE_REFERENCE);
        assertThat(valRef, is(mockProperty));
        String literal = fetchPropertyIsLikeExpression(compOpsType, LITERAL);
        assertThat(literal, is(LITERAL));
    }
    BinaryLogicOpType logicAndType = (BinaryLogicOpType) logicOpType.getComparisonOpsOrSpatialOpsOrTemporalOps().get(1).getValue();
    assertThat(logicOpType.getComparisonOpsOrSpatialOpsOrTemporalOps().get(1).getName().toString(), is(LOGICAL_AND_NAME));
    DistanceBufferType spatialOpsType1 = (DistanceBufferType) logicAndType.getComparisonOpsOrSpatialOpsOrTemporalOps().get(0).getValue();
    assertThat(spatialOpsType1.getDistance().getValue(), is(1000d));
    DistanceBufferType spatialOpsType2 = (DistanceBufferType) logicAndType.getComparisonOpsOrSpatialOpsOrTemporalOps().get(1).getValue();
    assertThat(spatialOpsType2.getDistance().getValue(), is(1500d));
}
Also used : FilterType(net.opengis.filter.v_2_0_0.FilterType) BinaryLogicOpType(net.opengis.filter.v_2_0_0.BinaryLogicOpType) ArrayList(java.util.ArrayList) Method(java.lang.reflect.Method) DistanceBufferType(net.opengis.filter.v_2_0_0.DistanceBufferType) PropertyIsLikeType(net.opengis.filter.v_2_0_0.PropertyIsLikeType)

Aggregations

Test (org.junit.Test)21 DistanceBufferType (net.opengis.filter.v_2_0_0.DistanceBufferType)18 FilterType (net.opengis.filter.v_2_0_0.FilterType)18 DistanceBufferType (net.opengis.filter.v_1_1_0.DistanceBufferType)11 ArrayList (java.util.ArrayList)6 BinaryLogicOpType (net.opengis.filter.v_2_0_0.BinaryLogicOpType)6 UnaryLogicOpType (net.opengis.filter.v_2_0_0.UnaryLogicOpType)6 Method (java.lang.reflect.Method)4 PointType (net.opengis.gml.v_3_1_1.PointType)4 DistanceType (net.opengis.filter.v_1_1_0.DistanceType)3 FilterType (net.opengis.filter.v_1_1_0.FilterType)3 PropertyNameType (net.opengis.filter.v_1_1_0.PropertyNameType)3 Query (ddf.catalog.operation.Query)2 QueryImpl (ddf.catalog.operation.impl.QueryImpl)2 QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)2 BinaryTemporalOpType (net.opengis.filter.v_2_0_0.BinaryTemporalOpType)2 PropertyIsLikeType (net.opengis.filter.v_2_0_0.PropertyIsLikeType)2 QueryType (net.opengis.wfs.v_1_1_0.QueryType)2 DateTime (org.joda.time.DateTime)2 Geometry (org.locationtech.jts.geom.Geometry)2