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;
}
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));
}
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;
}
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);
}
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));
}
Aggregations