@Test public void testAndDisjoint() { Coordinate[] coords = new Coordinate[] { new Coordinate(0, 0), new Coordinate(10, 10) }; LineString lineString = new GeometryFactory().createLineString(coords); Filter filter = ff.disjoint(ff.property("name"), ff.literal(lineString)); filter = ff.and(filter, ff.bbox(ff.property("geom"), 50, 50, 150, 150, null)); Envelope env = (Envelope) filter.accept(visitor, null); assertEquals(new Envelope(50, 150, 50, 150), env); }
private ReferencedEnvelope bbox( Object data ) { if( data == null ){ return null; } else if (data instanceof ReferencedEnvelope) { return (ReferencedEnvelope) data; } else if (data instanceof Envelope){ return new ReferencedEnvelope( (Envelope) data, null ); } else if (data instanceof CoordinateReferenceSystem){ return new ReferencedEnvelope( (CoordinateReferenceSystem) data ); } throw new ClassCastException("Could not cast data to ReferencedEnvelope"); }
ExtractBoundsFilterVisitor extends NullFilterVisitor { private ReferencedEnvelope bbox( Object data ) { if( data == null ){ return null; } else if (data instanceof ReferencedEnvelope) { return (ReferencedEnvelope) data; } else if (data instanceof Envelope){ return new ReferencedEnvelope( (Envelope) data, null ); } else if (data instanceof CoordinateReferenceSystem){ return new ReferencedEnvelope( (CoordinateReferenceSystem) data ); } throw new ClassCastException("Could not cast data to ReferencedEnvelope"); } }
ExtractBoundsFilterVisitor extends NullFilterVisitor { private ReferencedEnvelope bbox( Object data ) { if( data == null ){ return null; } else if (data instanceof ReferencedEnvelope) { return (ReferencedEnvelope) data; } else if (data instanceof Envelope){ return new ReferencedEnvelope( (Envelope) data, null ); } else if (data instanceof CoordinateReferenceSystem){ return new ReferencedEnvelope( (CoordinateReferenceSystem) data ); } throw new ClassCastException("Could not cast data to ReferencedEnvelope"); } protected  ExtractBoundsFilterVisitor(); }
ExtractBoundsFilterVisitor extends NullFilterVisitor { private ReferencedEnvelope bbox( Object data ) { if( data == null ){ return null; } else if (data instanceof ReferencedEnvelope) { return (ReferencedEnvelope) data; } else if (data instanceof Envelope){ return new ReferencedEnvelope( (Envelope) data, null ); } else if (data instanceof CoordinateReferenceSystem){ return new ReferencedEnvelope( (CoordinateReferenceSystem) data ); } throw new ClassCastException("Could not cast data to ReferencedEnvelope"); } protected  ExtractBoundsFilterVisitor(); Object visit( ExcludeFilter filter, Object data ); Object visit( IncludeFilter filter, Object data ); Object visit( BBOX filter, Object data ); Object visit( Literal expression, Object data ); @Override Object visit(And filter, Object data); Object visit(Not filter, Object data); @Override Object visit(Or filter, Object data); Object visit( Beyond filter, Object data ); Object visit( Contains filter, Object data ); Object visit( Crosses filter, Object data ); Object visit( Disjoint filter, Object data ); Object visit( DWithin filter, Object data ); Object visit( Equals filter, Object data ); Object visit( Intersects filter, Object data ); Object visit( Overlaps filter, Object data ); Object visit( Touches filter, Object data ); Object visit( Within filter, Object data ); @Override Object visit(Add expression, Object data); @Override Object visit(Divide expression, Object data); @Override Object visit(Function expression, Object data); @Override Object visit(Id filter, Object data); @Override Object visit(Multiply expression, Object data); @Override Object visit(NilExpression expression, Object data); @Override Object visit(PropertyIsBetween filter, Object data); @Override Object visit(PropertyIsEqualTo filter, Object data); @Override Object visit(PropertyIsGreaterThan filter, Object data); @Override Object visit(PropertyIsGreaterThanOrEqualTo filter, Object data); @Override Object visit(PropertyIsLessThan filter, Object data); @Override Object visit(PropertyIsLessThanOrEqualTo filter, Object data); @Override Object visit(PropertyIsLike filter, Object data); @Override Object visit(PropertyIsNotEqualTo filter, Object data); @Override Object visit(PropertyIsNull filter, Object data); @Override Object visit(PropertyName expression, Object data); @Override Object visit(Subtract expression, Object data); @Override Object visitNullFilter(Object data); }
ExtractBoundsFilterVisitor extends NullFilterVisitor { private ReferencedEnvelope bbox( Object data ) { if( data == null ){ return null; } else if (data instanceof ReferencedEnvelope) { return (ReferencedEnvelope) data; } else if (data instanceof Envelope){ return new ReferencedEnvelope( (Envelope) data, null ); } else if (data instanceof CoordinateReferenceSystem){ return new ReferencedEnvelope( (CoordinateReferenceSystem) data ); } throw new ClassCastException("Could not cast data to ReferencedEnvelope"); } protected  ExtractBoundsFilterVisitor(); Object visit( ExcludeFilter filter, Object data ); Object visit( IncludeFilter filter, Object data ); Object visit( BBOX filter, Object data ); Object visit( Literal expression, Object data ); @Override Object visit(And filter, Object data); Object visit(Not filter, Object data); @Override Object visit(Or filter, Object data); Object visit( Beyond filter, Object data ); Object visit( Contains filter, Object data ); Object visit( Crosses filter, Object data ); Object visit( Disjoint filter, Object data ); Object visit( DWithin filter, Object data ); Object visit( Equals filter, Object data ); Object visit( Intersects filter, Object data ); Object visit( Overlaps filter, Object data ); Object visit( Touches filter, Object data ); Object visit( Within filter, Object data ); @Override Object visit(Add expression, Object data); @Override Object visit(Divide expression, Object data); @Override Object visit(Function expression, Object data); @Override Object visit(Id filter, Object data); @Override Object visit(Multiply expression, Object data); @Override Object visit(NilExpression expression, Object data); @Override Object visit(PropertyIsBetween filter, Object data); @Override Object visit(PropertyIsEqualTo filter, Object data); @Override Object visit(PropertyIsGreaterThan filter, Object data); @Override Object visit(PropertyIsGreaterThanOrEqualTo filter, Object data); @Override Object visit(PropertyIsLessThan filter, Object data); @Override Object visit(PropertyIsLessThanOrEqualTo filter, Object data); @Override Object visit(PropertyIsLike filter, Object data); @Override Object visit(PropertyIsNotEqualTo filter, Object data); @Override Object visit(PropertyIsNull filter, Object data); @Override Object visit(PropertyName expression, Object data); @Override Object visit(Subtract expression, Object data); @Override Object visitNullFilter(Object data); static public NullFilterVisitor BOUNDS_VISITOR; }