use of org.opengis.filter.spatial.Within in project polymap4-core by Polymap4.
the class LuceneQueryDialect method supports.
public static boolean supports(Filter _filter) {
final List notSupported = new ArrayList();
_filter.accept(new DefaultFilterVisitor() {
public Object visit(Beyond filter, Object data) {
notSupported.add(filter);
return super.visit(filter, data);
}
public Object visit(Contains filter, Object data) {
notSupported.add(filter);
return super.visit(filter, data);
}
public Object visit(Crosses filter, Object data) {
notSupported.add(filter);
return super.visit(filter, data);
}
public Object visit(Disjoint filter, Object data) {
notSupported.add(filter);
return super.visit(filter, data);
}
public Object visit(Divide expression, Object data) {
notSupported.add(expression);
return super.visit(expression, data);
}
public Object visit(DWithin filter, Object data) {
notSupported.add(filter);
return super.visit(filter, data);
}
public Object visit(org.opengis.filter.expression.Function expression, Object data) {
notSupported.add(expression);
return super.visit(expression, data);
}
public Object visit(Intersects filter, Object data) {
notSupported.add(filter);
return super.visit(filter, data);
}
public Object visit(Multiply expression, Object data) {
notSupported.add(expression);
return super.visit(expression, data);
}
public Object visit(Overlaps filter, Object data) {
notSupported.add(filter);
return super.visit(filter, data);
}
public Object visit(Subtract expression, Object data) {
notSupported.add(expression);
return super.visit(expression, data);
}
public Object visit(Touches filter, Object data) {
notSupported.add(filter);
return super.visit(filter, data);
}
public Object visit(Within filter, Object data) {
notSupported.add(filter);
return super.visit(filter, data);
}
}, notSupported);
return notSupported.isEmpty();
}
use of org.opengis.filter.spatial.Within in project ddf by codice.
the class FilterBuilderTest method withinGeoTest.
/**
*/
@Test
public void withinGeoTest() {
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute(Metacard.GEOGRAPHY).within().wkt(POINT_WKT);
filter.accept(new DefaultFilterVisitor() {
@Override
public Object visit(Within filter, Object data) {
Literal literalWrapper = (Literal) filter.getExpression2();
Geometry geometry = (Geometry) literalWrapper.evaluate(null);
geometry.getCentroid().getCoordinate();
return super.visit(filter, data);
}
}, null);
}
use of org.opengis.filter.spatial.Within in project ddf by codice.
the class TestCswRecordMapperFilterVisitor method testVisitBBox.
@Test
public void testVisitBBox() {
BBOX filter = factory.bbox(attrExpr, 0, 0, 10, 20, "EPSG:4269");
String polygon = "POLYGON ((0 0, 0 20, 10 20, 10 0, 0 0))";
Object obj = visitor.visit(filter, null);
assertThat(obj, instanceOf(Within.class));
Within duplicate = (Within) obj;
assertThat(duplicate.getExpression1(), is(attrExpr));
assertThat(duplicate.getExpression2().toString(), is(polygon));
}
use of org.opengis.filter.spatial.Within in project ddf by codice.
the class FilterBuilderTest method within.
@Test
public void within() {
FilterVisitor visitor = spy(new DefaultFilterVisitor() {
});
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute(Metacard.GEOGRAPHY).within().wkt(POINT_WKT);
filter.accept(visitor, null);
filter = builder.attribute(Metacard.GEOGRAPHY).is().within().wkt(MULTIPOLYGON_WKT);
filter.accept(visitor, null);
InOrder inOrder = inOrder(visitor);
inOrder.verify(visitor, times(2)).visit(isA(Within.class), any());
}
use of org.opengis.filter.spatial.Within in project ddf by codice.
the class CswRecordMapperFilterVisitorTest method testVisitBBox.
@Test
public void testVisitBBox() {
BBOX filter = factory.bbox(attrExpr, 0, 0, 10, 20, "EPSG:4326");
String polygon = "POLYGON ((0 0, 0 20, 10 20, 10 0, 0 0))";
Object obj = visitor.visit(filter, null);
assertThat(obj, instanceOf(Within.class));
Within duplicate = (Within) obj;
assertThat(duplicate.getExpression1(), is(attrExpr));
assertThat(duplicate.getExpression2().toString(), is(polygon));
}
Aggregations