/** * Checks if the bounding box of the feature's geometry overlaps the specified bounding box. * * <p>Similar to: <code> * geom().disjoint( geom( bbox )).not() * </code> */ public BBOX bbox( String propertyName, double minx, double miny, double maxx, double maxy, String srs) { PropertyName name = property(propertyName); return bbox(name, minx, miny, maxx, maxy, srs); }
public Intersects intersects(String propertyName, Geometry geometry, MatchAction matchAction) { PropertyName name = property(propertyName); Literal geom = literal(geometry); return intersects(name, geom, matchAction); }
public void testIntersects() throws Exception { FilterFactoryImpl ff = new FilterFactoryImpl(); SimpleFeatureType type = null; try { type = DataUtilities.createType("testSchema", "name:String,*geom:Geometry"); } catch (SchemaException e) { java.util.logging.Logger.getGlobal().log(java.util.logging.Level.INFO, "", e); } WKTReader reader = new WKTReader(); Geometry geom1 = reader.read("LINESTRING(0 0 0, 10 10 10)"); Feature f = SimpleFeatureBuilder.build(type, new Object[] {"testFeature1", geom1}, null); Geometry geom2 = reader.read("LINESTRING(10 0 0, 0 10 10)"); Literal literal_geom = ff.literal(geom2); Function exp = ff.function("intersects3D", ff.property("geom"), literal_geom); Object value = exp.evaluate(f); assertTrue(value instanceof Boolean); assertTrue((Boolean) value); } }
@Override public PropertyName property(String name) { PropertyName ret = properties.get(name); if (ret == null && name.startsWith("viewparam:")) { final String paramName = name.substring(10); ret = new ParameterCQLExpressionPropertyName(name) { @Override protected Object get(ParameterMappingContext context) { return context.getViewParams().get(paramName); } }; } if (ret == null) { ret = super.property(name); } return ret; } }
public BBOX3D bbox(Expression geometry, BoundingBox3D env) { return bbox(geometry, env, MatchAction.ANY); }
private BBOXImpl bbox2d(Expression e, BoundingBox bounds, MatchAction matchAction) { PropertyName name = null; if (e instanceof PropertyName) { name = (PropertyName) e; } else { throw new IllegalArgumentException("BBOX requires PropertyName expression"); } Literal bbox = null; try { ReferencedEnvelope env = ReferencedEnvelope.reference(bounds); bbox = literal(BBOXImpl.boundingPolygon(env)); } catch (IllegalFilterException ife) { new IllegalArgumentException("Unable to convert to Polygon:" + bounds).initCause(ife); } return new BBOXImpl(name, bbox, matchAction); }
public BBOXImpl(FilterFactoryImpl factory, Expression name, double minx, double miny, double maxx, double maxy, String srs, MatchAction matchAction) { this(factory, name, factory.createBBoxExpression(new Envelope(minx, maxx, miny, maxy)), matchAction); this.srs = srs; }
public org.geotools.filter.Filter and( org.geotools.filter.Filter filter1, org.geotools.filter.Filter filter2 ) { return (org.geotools.filter.Filter) and( (Filter) filter1, (Filter) filter2 ); }