use of org.geotoolkit.ogc.xml.v100.UnaryLogicOpType in project ddf by codice.
the class WfsFilterDelegateTest method testDisjointAsNotBBox.
@Test
public void testDisjointAsNotBBox() {
WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.BBOX.getValue(), new LonLatCoordinateStrategy());
FilterType filter = delegate.disjoint(Metacard.ANY_GEO, POLYGON);
assertThat(filter.getLogicOps().getValue(), is(instanceOf(UnaryLogicOpType.class)));
UnaryLogicOpType type = (UnaryLogicOpType) filter.getLogicOps().getValue();
assertThat(type.getSpatialOps().getValue(), is(instanceOf(BBOXType.class)));
BBOXType bboxType = (BBOXType) type.getSpatialOps().getValue();
EnvelopeType envelope = bboxType.getEnvelope().getValue();
DirectPositionType lowerCorner = envelope.getLowerCorner();
assertThat("The bounding box's lower corner was null.", lowerCorner, is(notNullValue()));
assertThat(lowerCorner.getValue(), is(asList(10.0, -10.0)));
DirectPositionType upperCorner = envelope.getUpperCorner();
assertThat("The bounding box's upper corner was null.", upperCorner, is(notNullValue()));
assertThat(upperCorner.getValue(), is(asList(40.0, 30.0)));
}
use of org.geotoolkit.ogc.xml.v100.UnaryLogicOpType in project ddf by codice.
the class WfsFilterDelegate method not.
@Override
public FilterType not(FilterType filterToBeNoted) {
FilterType returnFilter = new FilterType();
if (filterToBeNoted == null) {
return returnFilter;
}
UnaryLogicOpType notType = new UnaryLogicOpType();
if (filterToBeNoted.isSetComparisonOps()) {
notType.setComparisonOps(filterToBeNoted.getComparisonOps());
} else if (filterToBeNoted.isSetLogicOps()) {
notType.setLogicOps(filterToBeNoted.getLogicOps());
} else if (filterToBeNoted.isSetSpatialOps()) {
notType.setSpatialOps(filterToBeNoted.getSpatialOps());
} else {
return returnFilter;
}
returnFilter.setLogicOps(filterObjectFactory.createNot(notType));
return returnFilter;
}
use of org.geotoolkit.ogc.xml.v100.UnaryLogicOpType in project ddf by codice.
the class WfsFilterDelegate method not.
@Override
public FilterType not(FilterType filterToBeNoted) {
areLogicalOperationsSupported();
FilterType returnFilter = new FilterType();
if (filterToBeNoted == null) {
return null;
}
UnaryLogicOpType notType = new UnaryLogicOpType();
if (filterToBeNoted.isSetComparisonOps()) {
notType.setComparisonOps(filterToBeNoted.getComparisonOps());
} else if (filterToBeNoted.isSetLogicOps()) {
notType.setLogicOps(filterToBeNoted.getLogicOps());
} else if (filterToBeNoted.isSetSpatialOps()) {
notType.setSpatialOps(filterToBeNoted.getSpatialOps());
} else {
return returnFilter;
}
returnFilter.setLogicOps(filterObjectFactory.createNot(notType));
return returnFilter;
}
use of org.geotoolkit.ogc.xml.v100.UnaryLogicOpType in project ddf by codice.
the class WfsFilterDelegateTest method testLogicalNotOfSpatial.
@Test
public void testLogicalNotOfSpatial() {
String mockProperty = "myPropertyName";
String mockType = "myType";
WfsFilterDelegate delegate = mockFeatureMetacardCreateDelegate(mockProperty, mockType);
FilterType spatialFilter1 = delegate.dwithin(Metacard.ANY_GEO, "POINT (30 10)", 1000);
// Perform Test
FilterType filter = delegate.not(spatialFilter1);
// Verify
assertThat(filter.getLogicOps().getName().toString(), is(LOGICAL_NOT_NAME));
UnaryLogicOpType logicOpType = (UnaryLogicOpType) filter.getLogicOps().getValue();
DistanceBufferType spatialOpsType1 = (DistanceBufferType) logicOpType.getSpatialOps().getValue();
assertThat(spatialOpsType1.getDistance().getValue(), is(1000d));
}
use of org.geotoolkit.ogc.xml.v100.UnaryLogicOpType 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);
}
Aggregations