org.geotools.filter
Class SQLEncoderPostgisGeos

java.lang.Object
  extended byorg.geotools.filter.SQLEncoder
      extended byorg.geotools.filter.SQLEncoderPostgis
          extended byorg.geotools.filter.SQLEncoderPostgisGeos
All Implemented Interfaces:
FilterVisitor

public class SQLEncoderPostgisGeos
extends SQLEncoderPostgis
implements FilterVisitor

Encodes a filter into a SQL WHERE statement for postgis. With geos installed. This should be redone, probably integrated with the postgis stuff, but that whole hierarchy should be redone, since the capabilities stuff is a bit wacky. This should only be used on versions of postgis installed with GEOS support, to handle all the advanced spatial queries.

Version:
$Id: SQLEncoderPostgisGeos.java 18021 2006-02-14 20:36:18Z jdeolive $
Author:
Chris Holmes, TOPP

Field Summary
 
Fields inherited from class org.geotools.filter.SQLEncoderPostgis
looseBbox
 
Fields inherited from class org.geotools.filter.SQLEncoder
mapper, out
 
Constructor Summary
SQLEncoderPostgisGeos()
          Empty constructor TODO: rethink empty constructor, as BBOXes _need_ an SRID, must make client set it somehow.
SQLEncoderPostgisGeos(int srid)
          Constructor with srid.
 
Method Summary
 FilterCapabilities getCapabilities()
          Capabils of this encoder.
 void setDefaultGeometry(java.lang.String name)
          Sets the default geometry, so that filters with null for one of their expressions can assume that the default geometry is intended.
 void setSRID(int srid)
          Sets a spatial reference system ESPG number, so that the geometry can be properly encoded for postgis.
 void visit(GeometryFilter filter)
          Turns a geometry filter into the postgis sql bbox statement.
 void visit(LiteralExpression expression)
          Checks to see if the literal is a geometry, and encodes it if it is, if not just sends to the parent class.
 
Methods inherited from class org.geotools.filter.SQLEncoderPostgis
createFilterCapabilities, isLooseBbox, setLooseBbox, visitLiteralGeometry
 
Methods inherited from class org.geotools.filter.SQLEncoder
encode, encode, escapeName, getColnameEscape, setColnameEscape, setFIDMapper, setSqlNameEscape, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.geotools.filter.FilterVisitor
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
 

Constructor Detail

SQLEncoderPostgisGeos

public SQLEncoderPostgisGeos()
Empty constructor TODO: rethink empty constructor, as BBOXes _need_ an SRID, must make client set it somehow. Maybe detect when encode is called?


SQLEncoderPostgisGeos

public SQLEncoderPostgisGeos(int srid)
Constructor with srid.

Parameters:
srid - spatial reference id to encode geometries with.
Method Detail

getCapabilities

public FilterCapabilities getCapabilities()
Capabils of this encoder.

Overrides:
getCapabilities in class SQLEncoder
Returns:
See Also:
org.geotools.filter.SQLEncoder#getCapabils()

setSRID

public void setSRID(int srid)
Sets a spatial reference system ESPG number, so that the geometry can be properly encoded for postgis. If geotools starts actually creating geometries with valid srids then this method will no longer be needed.

Overrides:
setSRID in class SQLEncoderPostgis
Parameters:
srid - the integer code for the EPSG spatial reference system.

setDefaultGeometry

public void setDefaultGeometry(java.lang.String name)
Sets the default geometry, so that filters with null for one of their expressions can assume that the default geometry is intended.

Overrides:
setDefaultGeometry in class SQLEncoderPostgis
Parameters:
name - the name of the default geometry Attribute.
Task:
REVISIT: pass in a featureType so that geometries can figure out their own default geometry?

visit

public void visit(GeometryFilter filter)
           throws java.lang.RuntimeException
Turns a geometry filter into the postgis sql bbox statement.

Specified by:
visit in interface FilterVisitor
Overrides:
visit in class SQLEncoderPostgis
Parameters:
filter - the geometry filter to be encoded.
Throws:
java.lang.RuntimeException - for IO exception (need a better error)

visit

public void visit(LiteralExpression expression)
           throws java.lang.RuntimeException
Checks to see if the literal is a geometry, and encodes it if it is, if not just sends to the parent class.

Specified by:
visit in interface FilterVisitor
Overrides:
visit in class SQLEncoder
Parameters:
expression - the expression to visit and encode.
Throws:
java.lang.RuntimeException - for IO exception (need a better error)


Copyright © GeoTools. All Rights Reserved.