org.geotools.expr
Class AbstractGeometryExpr

java.lang.Object
  extended byorg.geotools.expr.AbstractExpr
      extended byorg.geotools.expr.AbstractGeometryExpr
All Implemented Interfaces:
Expr, GeometryExpr
Direct Known Subclasses:
AttributeGeometryExpr, LiteralGeometryExpr

public abstract class AbstractGeometryExpr
extends org.geotools.expr.AbstractExpr
implements GeometryExpr

Default implementation of GeometryExpr.

Provides chaining access to appropriate Expr constructors. Allows use of literal Geometry objects via Exprs.geom( literal ).


Field Summary
protected  FilterFactory factory
           
 
Constructor Summary
AbstractGeometryExpr()
           
 
Method Summary
 Expr and(Expr expr)
          Explicit Expr chain extention - required for custom Expressions.
 Expr bbox(com.vividsolutions.jts.geom.Envelope bbox)
          Convience method for: geom().disjoint( geom( bbox )).not()
 Expr between(Expr min, Expr max)
          min <= expr <= max
 GeometryExpr beyond(com.vividsolutions.jts.geom.Envelope extent, double distance)
          Convience method allowing literal extent
 GeometryExpr beyond(com.vividsolutions.jts.geom.Geometry geometry, double distance)
          Convience method allowing literal geometry
 GeometryExpr beyond(GeometryExpr expr, double distance)
           
 GeometryExpr contains(com.vividsolutions.jts.geom.Envelope extent)
          Convience method allowing literal extent
 GeometryExpr contains(com.vividsolutions.jts.geom.Geometry geometry)
          Convience method allowing literal geometry
 GeometryExpr contains(GeometryExpr expr)
           
 GeometryExpr crosses(com.vividsolutions.jts.geom.Envelope extent)
          Convience method allowing literal extent
 GeometryExpr crosses(com.vividsolutions.jts.geom.Geometry geometry)
          Convience method allowing literal geometry
 GeometryExpr crosses(GeometryExpr expr)
           
 GeometryExpr disjoint(com.vividsolutions.jts.geom.Envelope extent)
          Convience method allowing literal extent
 GeometryExpr disjoint(com.vividsolutions.jts.geom.Geometry geometry)
          Convience method allowing literal geometry
 GeometryExpr disjoint(GeometryExpr expr)
           
 GeometryExpr dwithin(com.vividsolutions.jts.geom.Envelope extent, double distance)
          Convience method allowing literal extent
 GeometryExpr dwithin(com.vividsolutions.jts.geom.Geometry geometry, double distance)
          Convience method allowing literal geometry
 GeometryExpr dwithin(GeometryExpr expr, double distance)
           
 Expr eq(Expr expr)
          expr == expr
 GeometryExpr equal(com.vividsolutions.jts.geom.Envelope extent)
          Convience method allowing literal extent
 GeometryExpr equal(com.vividsolutions.jts.geom.Geometry geometry)
          Convience method allowing literal geometry
 GeometryExpr equal(GeometryExpr expr)
           
 Expr eval()
          Evaludate Expr - with LiteralExpr as a goal.
 Expression expression(FeatureType schema)
          Turns a Filter into an a logical true/false expression.
 Expr fid(java.util.Set fids)
          expr.filter( fids ) Restruct current Expr to provided featureId(s).
 Expr fid(java.lang.String featureID)
          Convience method for accessing a single fid
 Filter filter(FeatureType schema)
          Useful super class that casts expressions into a Filter.
 Expr fn(java.lang.String name)
          name( expr )
 Expr fn(java.lang.String name, Expr expr)
          name( expr, expr )
 Expr fn(java.lang.String name, Expr[] expr)
          name( expr[0], expr[0], ... )
 Expr gt(Expr expr)
          expr > expr
 Expr gte(Expr expr)
          expr >= expr
 GeometryExpr intersects(com.vividsolutions.jts.geom.Envelope extent)
          Convience method allowing literal extent
 GeometryExpr intersects(com.vividsolutions.jts.geom.Geometry geometry)
          Convience method allowing literal geometry
 GeometryExpr intersects(GeometryExpr expr)
           
 Expr lt(Expr expr)
          expr < expr
 Expr lte(Expr expr)
          expr <= expr
 Expr ne(Expr expr)
          expr !
 Expr not()
          !
 Expr notNull()
          expr !
 Expr or(Expr expr)
          Expr Disjunction
 GeometryExpr overlaps(com.vividsolutions.jts.geom.Envelope extent)
          Convience method allowing literal extent
 GeometryExpr overlaps(com.vividsolutions.jts.geom.Geometry geometry)
          Convience method allowing literal geometry
 GeometryExpr overlaps(GeometryExpr expr)
           
 Expr reduce(java.lang.String bind)
          Reduce attributes matching "bind/x" to "x".
 Expr resolve(org.opengis.catalog.MetadataEntity metadata)
          Bind all meta entries according to provided metadata.
 Expr resolve(java.lang.String bind, Feature feature)
          Bind attributes matching "bind/x" to feature.getAttribute("x").
 GeometryExpr touches(com.vividsolutions.jts.geom.Envelope extent)
          Convience method allowing literal extent
 GeometryExpr touches(com.vividsolutions.jts.geom.Geometry geometry)
          Convience method allowing literal geometry
 GeometryExpr touches(GeometryExpr expr)
           
 GeometryExpr within(com.vividsolutions.jts.geom.Envelope extent)
          Convience method allowing literal extent
 GeometryExpr within(com.vividsolutions.jts.geom.Geometry geometry)
          Convience method allowing literal geometry
 GeometryExpr within(GeometryExpr expr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.geotools.expr.Expr
and, bbox, between, eq, eval, expression, fid, fid, filter, fn, fn, fn, gt, gte, lt, lte, ne, not, notNull, or, reduce, resolve, resolve
 

Field Detail

factory

protected FilterFactory factory
Constructor Detail

AbstractGeometryExpr

public AbstractGeometryExpr()
Method Detail

beyond

public GeometryExpr beyond(GeometryExpr expr,
                           double distance)
Specified by:
beyond in interface GeometryExpr

beyond

public GeometryExpr beyond(com.vividsolutions.jts.geom.Geometry geometry,
                           double distance)
Convience method allowing literal geometry

Specified by:
beyond in interface GeometryExpr

beyond

public GeometryExpr beyond(com.vividsolutions.jts.geom.Envelope extent,
                           double distance)
Convience method allowing literal extent

Specified by:
beyond in interface GeometryExpr

contains

public GeometryExpr contains(GeometryExpr expr)
Specified by:
contains in interface GeometryExpr

contains

public GeometryExpr contains(com.vividsolutions.jts.geom.Geometry geometry)
Convience method allowing literal geometry

Specified by:
contains in interface GeometryExpr

contains

public GeometryExpr contains(com.vividsolutions.jts.geom.Envelope extent)
Convience method allowing literal extent

Specified by:
contains in interface GeometryExpr

crosses

public GeometryExpr crosses(GeometryExpr expr)
Specified by:
crosses in interface GeometryExpr

crosses

public GeometryExpr crosses(com.vividsolutions.jts.geom.Geometry geometry)
Convience method allowing literal geometry

Specified by:
crosses in interface GeometryExpr

crosses

public GeometryExpr crosses(com.vividsolutions.jts.geom.Envelope extent)
Convience method allowing literal extent

Specified by:
crosses in interface GeometryExpr

disjoint

public GeometryExpr disjoint(GeometryExpr expr)
Specified by:
disjoint in interface GeometryExpr

disjoint

public GeometryExpr disjoint(com.vividsolutions.jts.geom.Geometry geometry)
Convience method allowing literal geometry

Specified by:
disjoint in interface GeometryExpr

disjoint

public GeometryExpr disjoint(com.vividsolutions.jts.geom.Envelope extent)
Convience method allowing literal extent

Specified by:
disjoint in interface GeometryExpr

dwithin

public GeometryExpr dwithin(GeometryExpr expr,
                            double distance)
Specified by:
dwithin in interface GeometryExpr

dwithin

public GeometryExpr dwithin(com.vividsolutions.jts.geom.Geometry geometry,
                            double distance)
Convience method allowing literal geometry

Specified by:
dwithin in interface GeometryExpr

dwithin

public GeometryExpr dwithin(com.vividsolutions.jts.geom.Envelope extent,
                            double distance)
Convience method allowing literal extent

Specified by:
dwithin in interface GeometryExpr

equal

public GeometryExpr equal(GeometryExpr expr)
Specified by:
equal in interface GeometryExpr

equal

public GeometryExpr equal(com.vividsolutions.jts.geom.Geometry geometry)
Convience method allowing literal geometry

Specified by:
equal in interface GeometryExpr

equal

public GeometryExpr equal(com.vividsolutions.jts.geom.Envelope extent)
Convience method allowing literal extent

Specified by:
equal in interface GeometryExpr

intersects

public GeometryExpr intersects(GeometryExpr expr)
Specified by:
intersects in interface GeometryExpr

intersects

public GeometryExpr intersects(com.vividsolutions.jts.geom.Geometry geometry)
Convience method allowing literal geometry

Specified by:
intersects in interface GeometryExpr

intersects

public GeometryExpr intersects(com.vividsolutions.jts.geom.Envelope extent)
Convience method allowing literal extent

Specified by:
intersects in interface GeometryExpr

overlaps

public GeometryExpr overlaps(GeometryExpr expr)
Specified by:
overlaps in interface GeometryExpr

overlaps

public GeometryExpr overlaps(com.vividsolutions.jts.geom.Geometry geometry)
Convience method allowing literal geometry

Specified by:
overlaps in interface GeometryExpr

overlaps

public GeometryExpr overlaps(com.vividsolutions.jts.geom.Envelope extent)
Convience method allowing literal extent

Specified by:
overlaps in interface GeometryExpr

touches

public GeometryExpr touches(GeometryExpr expr)
Specified by:
touches in interface GeometryExpr

touches

public GeometryExpr touches(com.vividsolutions.jts.geom.Geometry geometry)
Convience method allowing literal geometry

Specified by:
touches in interface GeometryExpr

touches

public GeometryExpr touches(com.vividsolutions.jts.geom.Envelope extent)
Convience method allowing literal extent

Specified by:
touches in interface GeometryExpr

within

public GeometryExpr within(GeometryExpr expr)
Specified by:
within in interface GeometryExpr

within

public GeometryExpr within(com.vividsolutions.jts.geom.Geometry geometry)
Convience method allowing literal geometry

Specified by:
within in interface GeometryExpr

within

public GeometryExpr within(com.vividsolutions.jts.geom.Envelope extent)
Convience method allowing literal extent

Specified by:
within in interface GeometryExpr

eval

public Expr eval()
Evaludate Expr - with LiteralExpr as a goal.

By default this method simply returns the current Expr.

Specified by:
eval in interface Expr

resolve

public Expr resolve(org.opengis.catalog.MetadataEntity metadata)
Bind all meta entries according to provided metadata.


 Feature
 

Specified by:
resolve in interface Expr
Parameters:
metadata -
Returns:
Expr with all meta( xpath ) Exprs resolved

reduce

public Expr reduce(java.lang.String bind)
Reduce attributes matching "bind/x" to "x".

This may be used to reduce an Expr as part of an otter join, to something simple that can be passed off to an DataStore by way of filter( FeatureType ).

Example:


 FeatureType RIVER = river.getSchema();
 FeatureType HAZZARD = hazard.getSchema();
 
 Expr joinExpr = Exprs.attribute("river/name").eq( Exprs.attribute("hazzard/river") );
 
 FeatureReader outer = river.getFeatures().reader();
 while( reader.hasNext() ){
   Feature aRiver = outer.next();
 
   Expr inner = joinExpr.resolve( "river", aRiver ).reduce( "hazzard" );
   FeatureReader inner = district.getFeatures( inner.filter( HAZZARD ) );
 	 while( inner.hasNext() ){
      Feature aHazzard = inner.next();
 
 		// code here has access to both aRiver and aHazzard 
   } 
   inner.close();
 }
 outer.close();
 

Specified by:
reduce in interface Expr

resolve

public Expr resolve(java.lang.String bind,
                    Feature feature)
Bind attributes matching "bind/x" to feature.getAttribute("x").

This may be used to reduce an Expr as part of an otter join, to something simple that can be passed off to an DataStore by way of filter( FeatureType ).

Specified by:
resolve in interface Expr
Parameters:
bind -
feature -
Returns:

filter

public Filter filter(FeatureType schema)
              throws java.io.IOException
Useful super class that casts expressions into a Filter.

To turn Expression into a Filter I am going to follow the usual Perl defaults of "true".

Where true means that the generated Filter will accept the results.

Specified by:
filter in interface Expr
Throws:
java.io.IOException

expression

public Expression expression(FeatureType schema)
                      throws java.io.IOException
Turns a Filter into an a logical true/false expression.

Specified by:
expression in interface Expr
Throws:
java.io.IOException

bbox

public Expr bbox(com.vividsolutions.jts.geom.Envelope bbox)
Convience method for: geom().disjoint( geom( bbox )).not()

Specified by:
bbox in interface Expr

fid

public Expr fid(java.lang.String featureID)
Convience method for accessing a single fid

Specified by:
fid in interface Expr
Returns:

fid

public Expr fid(java.util.Set fids)
Description copied from interface: Expr
expr.filter( fids )

Restruct current Expr to provided featureId(s).

Specified by:
fid in interface Expr

not

public Expr not()
Description copied from interface: Expr
!expr

Invert of logical TRUTH value. Can be used to test for non contained fitler contents or FALSE Expressions

Specified by:
not in interface Expr
Returns:
Invert of Logical TRUETH value

and

public Expr and(Expr expr)
Description copied from interface: Expr
Explicit Expr chain extention - required for custom Expressions.

Specified by:
and in interface Expr
Parameters:
expr -
Returns:
Explicit chain extention.

or

public Expr or(Expr expr)
Description copied from interface: Expr
Expr Disjunction

Specified by:
or in interface Expr

eq

public Expr eq(Expr expr)
Description copied from interface: Expr
expr == expr

Specified by:
eq in interface Expr

gt

public Expr gt(Expr expr)
Description copied from interface: Expr
expr > expr

Specified by:
gt in interface Expr

gte

public Expr gte(Expr expr)
Description copied from interface: Expr
expr >= expr

Specified by:
gte in interface Expr

lt

public Expr lt(Expr expr)
Description copied from interface: Expr
expr < expr

Specified by:
lt in interface Expr

lte

public Expr lte(Expr expr)
Description copied from interface: Expr
expr <= expr

Specified by:
lte in interface Expr

ne

public Expr ne(Expr expr)
Description copied from interface: Expr
expr != expr

Specified by:
ne in interface Expr

between

public Expr between(Expr min,
                    Expr max)
Description copied from interface: Expr
min <= expr <= max

Specified by:
between in interface Expr

notNull

public Expr notNull()
Description copied from interface: Expr
expr != null

Specified by:
notNull in interface Expr

fn

public Expr fn(java.lang.String name)
Description copied from interface: Expr
name( expr )

Specified by:
fn in interface Expr

fn

public Expr fn(java.lang.String name,
               Expr expr)
Description copied from interface: Expr
name( expr, expr )

Specified by:
fn in interface Expr

fn

public Expr fn(java.lang.String name,
               Expr[] expr)
Description copied from interface: Expr
name( expr[0], expr[0], ... )

Specified by:
fn in interface Expr


Copyright © GeoTools. All Rights Reserved.