use of org.opengis.filter.spatial.Contains in project ddf by codice.
the class OpenSearchFilterVisitorTest method testContainsWithPoint.
@Test
public void testContainsWithPoint() {
Contains containsFilter = (Contains) geotoolsFilterBuilder.attribute(SPATIAL_ATTRIBUTE_NAME).containing().wkt(WKT_POINT);
OpenSearchFilterVisitorObject openSearchFilterVisitorObject = new OpenSearchFilterVisitorObject();
openSearchFilterVisitorObject.setCurrentNest(NestedTypes.AND);
OpenSearchFilterVisitorObject result = (OpenSearchFilterVisitorObject) openSearchFilterVisitor.visit(containsFilter, openSearchFilterVisitorObject);
assertThat(result.getPointRadiusSearches(), is(empty()));
assertThat(result.getGeometrySearches(), contains(hasToString(is(WKT_POINT))));
}
use of org.opengis.filter.spatial.Contains in project ddf by codice.
the class OpenSearchFilterVisitorTest method testContainsCqlFilter.
@Test
public void testContainsCqlFilter() throws CQLException {
Contains containsFilter = (Contains) ECQL.toFilter("(CONTAINS(" + SPATIAL_ATTRIBUTE_NAME + ", " + WKT_POLYGON + "))");
OpenSearchFilterVisitorObject openSearchFilterVisitorObject = new OpenSearchFilterVisitorObject();
openSearchFilterVisitorObject.setCurrentNest(NestedTypes.AND);
OpenSearchFilterVisitorObject result = (OpenSearchFilterVisitorObject) openSearchFilterVisitor.visit(containsFilter, openSearchFilterVisitorObject);
assertThat(result.getGeometrySearches(), contains(hasToString(is(WKT_POLYGON))));
}
use of org.opengis.filter.spatial.Contains in project ddf by codice.
the class OpenSearchFilterVisitorTest method testContainsNullNest.
@Test
public void testContainsNullNest() {
Contains containsFilter = (Contains) geotoolsFilterBuilder.attribute(SPATIAL_ATTRIBUTE_NAME).containing().wkt(WKT_POLYGON);
OpenSearchFilterVisitorObject openSearchFilterVisitorObject = new OpenSearchFilterVisitorObject();
OpenSearchFilterVisitorObject result = (OpenSearchFilterVisitorObject) openSearchFilterVisitor.visit(containsFilter, openSearchFilterVisitorObject);
assertThat(result.getGeometrySearches(), contains(hasToString(is(WKT_POLYGON))));
}
use of org.opengis.filter.spatial.Contains in project ddf by codice.
the class OpenSearchFilterVisitorTest method testContainsOrNest.
@Test
public void testContainsOrNest() {
Contains containsFilter = (Contains) geotoolsFilterBuilder.attribute(SPATIAL_ATTRIBUTE_NAME).containing().wkt(WKT_POLYGON);
OpenSearchFilterVisitorObject openSearchFilterVisitorObject = new OpenSearchFilterVisitorObject();
openSearchFilterVisitorObject.setCurrentNest(NestedTypes.OR);
OpenSearchFilterVisitorObject result = (OpenSearchFilterVisitorObject) openSearchFilterVisitor.visit(containsFilter, openSearchFilterVisitorObject);
assertThat(result.getPointRadiusSearches(), is(empty()));
assertThat(result.getGeometrySearches(), contains(hasToString(is(WKT_POLYGON))));
}
use of org.opengis.filter.spatial.Contains in project ddf by codice.
the class OpenSearchFilterVisitorTest method testMultipleFilters.
/**
* Test that the {@link OpenSearchFilterVisitorObject} is populated with multiple filters.
* Combines the {@link Filter}s from {@link #testDuringDates} and {@link #testContains()}.
*/
@Test
public void testMultipleFilters() {
During duringFilter = (During) geotoolsFilterBuilder.attribute(TEMPORAL_ATTRIBUTE_NAME).during().dates(START_DATE, END_DATE);
Contains containsFilter = (Contains) geotoolsFilterBuilder.attribute(SPATIAL_ATTRIBUTE_NAME).containing().wkt(WKT_POLYGON);
And andFilter = geotoolsFilterBuilder.allOf(duringFilter, containsFilter);
OpenSearchFilterVisitorObject openSearchFilterVisitorObject = new OpenSearchFilterVisitorObject();
openSearchFilterVisitorObject.setCurrentNest(NestedTypes.AND);
OpenSearchFilterVisitorObject result = (OpenSearchFilterVisitorObject) openSearchFilterVisitor.visit(andFilter, openSearchFilterVisitorObject);
assertThat(result.getTemporalSearch(), allOf(is(notNullValue()), hasProperty("startDate", is(START_DATE)), hasProperty("endDate", is(END_DATE))));
assertThat(result.getGeometrySearches(), contains(hasToString(is(WKT_POLYGON))));
}
Aggregations