use of net.opengis.fes.x20.DistanceBufferType in project ddf by codice.
the class WfsFilterDelegateTest method testPointLonLatOrder.
@Test
public void testPointLonLatOrder() {
final WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.DWITHIN.getValue(), new LonLatCoordinateStrategy());
final FilterType filter = delegate.dwithin(Metacard.ANY_GEO, POINT, DISTANCE);
assertThat(filter.getSpatialOps().getValue(), is(instanceOf(DistanceBufferType.class)));
final DistanceBufferType distanceBufferType = (DistanceBufferType) filter.getSpatialOps().getValue();
assertThat(distanceBufferType.getGeometry().getValue(), is(instanceOf(PointType.class)));
final PointType pointType = (PointType) distanceBufferType.getGeometry().getValue();
assertThat(pointType.getCoordinates().getValue(), is("30.0,-10.0"));
}
use of net.opengis.fes.x20.DistanceBufferType in project ddf by codice.
the class WfsSourceTest method testQueryLatLonCoordinateOrder.
@Test
public void testQueryLatLonCoordinateOrder() throws Exception {
mapSchemaToFeatures(ONE_GML_PROPERTY_SCHEMA, ONE_FEATURE);
setUpMocks(Collections.singletonList("DWithin"), SRS_NAME, ONE_FEATURE, ONE_FEATURE);
source.setPollInterval(1);
final Map<String, Object> configuration = ImmutableMap.<String, Object>builder().put("wfsUrl", "http://localhost/wfs").put("coordinateOrder", LAT_LON_ORDER).put("forceSpatialFilter", "NO_FILTER").put("allowRedirects", false).put("disableCnCheck", false).put("pollInterval", 1).put("disableSorting", false).put("supportsStartIndex", false).put("forceAllGeometryOperands", false).build();
source.refresh(configuration);
final Filter withinFilter = builder.attribute(Metacard.ANY_GEO).is().withinBuffer().wkt(POINT_WKT, 10.0);
final Query withinQuery = new QueryImpl(withinFilter);
final ArgumentCaptor<ExtendedGetFeatureType> captor = ArgumentCaptor.forClass(ExtendedGetFeatureType.class);
source.query(new QueryRequestImpl(withinQuery));
verify(mockWfs, times(2)).getFeature(captor.capture());
ExtendedGetFeatureType getFeatureType = captor.getAllValues().get(1);
assertThat(getFeatureType.getQuery(), hasSize(1));
final QueryType query = getFeatureType.getQuery().get(0);
assertThat(query.getFilter().getSpatialOps().getValue(), is(instanceOf(DistanceBufferType.class)));
final DistanceBufferType distanceBufferType = (DistanceBufferType) query.getFilter().getSpatialOps().getValue();
assertThat(distanceBufferType.getGeometry().getValue(), is(instanceOf(PointType.class)));
final PointType pointType = (PointType) distanceBufferType.getGeometry().getValue();
assertThat(pointType.getCoordinates().getValue(), is("-10.0,30.0"));
}
use of net.opengis.fes.x20.DistanceBufferType in project ddf by codice.
the class WfsFilterDelegateTest method testLogicalAndOrSpatial.
private void testLogicalAndOrSpatial(String methName, String compOpName) throws Exception {
String mockProperty = "myPropertyName";
String mockType = "myType";
WfsFilterDelegate delegate = mockFeatureMetacardCreateDelegate(mockProperty, mockType);
FilterType spatialFilter1 = delegate.dwithin(Metacard.ANY_GEO, "POINT (30 10)", 1000);
FilterType spatialFilter2 = delegate.dwithin(Metacard.ANY_GEO, "POINT (50 10)", 1500);
List<FilterType> filtersToCombine = new ArrayList<>();
filtersToCombine.add(spatialFilter1);
filtersToCombine.add(spatialFilter2);
// Perform Test
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();
DistanceBufferType spatialOpsType1 = (DistanceBufferType) logicOpType.getComparisonOpsOrSpatialOpsOrTemporalOps().get(0).getValue();
assertThat(spatialOpsType1.getDistance().getValue(), is(1000d));
DistanceBufferType spatialOpsType2 = (DistanceBufferType) logicOpType.getComparisonOpsOrSpatialOpsOrTemporalOps().get(1).getValue();
assertThat(spatialOpsType2.getDistance().getValue(), is(1500d));
}
use of net.opengis.fes.x20.DistanceBufferType in project ddf by codice.
the class WfsFilterDelegateTest method testDWithinFilterPoint.
@Test
public void testDWithinFilterPoint() throws SAXException, IOException, JAXBException {
WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.D_WITHIN.toString());
FilterType filter = delegate.dwithin(Metacard.ANY_GEO, POINT, DISTANCE);
assertFalse(filter.isSetLogicOps());
assertTrue(filter.isSetSpatialOps());
assertTrue(filter.getSpatialOps().getValue() instanceof DistanceBufferType);
assertXMLEqual(MockWfsServer.getDWithinPointXmlFilter(), getXmlFromMarshaller(filter));
}
use of net.opengis.fes.x20.DistanceBufferType in project ddf by codice.
the class WfsFilterDelegateTest method testBeyondFilter.
@Test
public void testBeyondFilter() throws JAXBException, SAXException, IOException {
WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.BEYOND.toString());
FilterType filter = delegate.beyond(Metacard.ANY_GEO, POLYGON, DISTANCE);
assertTrue(filter.isSetSpatialOps());
assertTrue(filter.getSpatialOps().getValue() instanceof DistanceBufferType);
assertXMLEqual(MockWfsServer.getBeyondXmlFilter(), getXmlFromMarshaller(filter));
}
Aggregations