use of org.opengis.filter.spatial.Beyond in project ddf by codice.
the class TestCswRecordMapperFilterVisitor method testVisitBeyond.
@Test
public void testVisitBeyond() {
GeometryFactory geoFactory = new GeometryFactory();
double val = 30;
Expression pt1 = factory.literal(geoFactory.createPoint(new Coordinate(4, 5)));
Expression pt2 = factory.literal(geoFactory.createPoint(new Coordinate(6, 7)));
Beyond filter = factory.beyond(pt1, pt2, val, "kilometers");
Beyond duplicate = (Beyond) visitor.visit(filter, null);
assertThat(duplicate.getExpression1(), is(pt1));
assertThat(duplicate.getExpression2(), is(pt2));
assertThat(duplicate.getDistanceUnits(), is(UomOgcMapping.METRE.name()));
assertThat(duplicate.getDistance(), is(1000 * val));
}
use of org.opengis.filter.spatial.Beyond 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.Beyond in project ddf by codice.
the class FilterBuilderTest method beyond.
@Test
public void beyond() {
FilterVisitor visitor = spy(new DefaultFilterVisitor() {
});
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute(Metacard.GEOGRAPHY).beyond().wkt(POINT_WKT, 123.45d);
filter.accept(visitor, null);
filter = builder.attribute(Metacard.GEOGRAPHY).beyond().wkt(POINT_WKT);
filter.accept(visitor, null);
InOrder inOrder = inOrder(visitor);
inOrder.verify(visitor, times(2)).visit(isA(Beyond.class), any());
// TODO check arguments
}
use of org.opengis.filter.spatial.Beyond in project ddf by codice.
the class CswRecordMapperFilterVisitorTest method testVisitBeyond.
@Test
public void testVisitBeyond() {
GeometryFactory geoFactory = new GeometryFactory();
double val = 30;
Expression pt1 = factory.literal(geoFactory.createPoint(new Coordinate(4, 5)));
Expression pt2 = factory.literal(geoFactory.createPoint(new Coordinate(6, 7)));
Beyond filter = factory.beyond(pt1, pt2, val, "kilometers");
Beyond duplicate = (Beyond) visitor.visit(filter, null);
assertThat(duplicate.getExpression1(), is(pt1));
assertThat(duplicate.getExpression2(), is(pt2));
assertThat(duplicate.getDistanceUnits(), is(UomOgcMapping.METRE.name()));
assertThat(duplicate.getDistance(), is(1000 * val));
}
Aggregations