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