org.geotools.filter
Class FilterFilter

java.lang.Object
  extended byorg.xml.sax.helpers.XMLFilterImpl
      extended byorg.geotools.filter.FilterFilter
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, GMLHandlerJTS, org.xml.sax.XMLFilter, org.xml.sax.XMLReader

public class FilterFilter
extends org.xml.sax.helpers.XMLFilterImpl
implements GMLHandlerJTS

Creates an OGC filter using a SAX filter.

Possibly the worst-named class of all time, FilterFilter extracts an OGC filter object from an XML stream and passes it to its parent as a fully instantiated OGC filter object.

Version:
$Id: FilterFilter.java 17701 2006-01-23 00:00:51Z desruisseaux $
Author:
Rob Hranac, Vision for New York

Field Summary
protected  boolean insideFilter
          Whether Whether we are currently processing a filter.
 
Constructor Summary
FilterFilter(FilterHandler parent, FeatureType schema)
          Constructor with parent, which must implement GMLHandlerJTS.
 
Method Summary
 void characters(char[] chars, int start, int length)
          Reads the only internal characters read by filters.
protected static short convertType(java.lang.String filterType)
          Converts the string representation of the expression to the AbstractFilter or DefaultExpression short type.
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
          Checks for filter element end and - if not a Filter then sends it directly to the appropriate filter factory.
 void geometry(com.vividsolutions.jts.geom.Geometry geometry)
          Recieves a geometry from its child filter.
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
          Checks the name of the element, and sends to the appropriate filter creation factory.
 
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
endDocument, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, parse, parse, processingInstruction, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, setProperty, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.ContentHandler
endDocument, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping
 

Field Detail

insideFilter

protected boolean insideFilter
Whether Whether we are currently processing a filter.

Constructor Detail

FilterFilter

public FilterFilter(FilterHandler parent,
                    FeatureType schema)
Constructor with parent, which must implement GMLHandlerJTS.

Parameters:
parent - The parent of this filter, to recieve the filters created.
schema - The schema that the filter will be used against.
Method Detail

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Checks the name of the element, and sends to the appropriate filter creation factory.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Parameters:
namespaceURI - The namespace of the element.
localName - The local name of the element.
qName - The full name of the element, including namespace prefix.
atts - The element attributes.
Throws:
org.xml.sax.SAXException - Some parsing error occured while reading filter.

characters

public void characters(char[] chars,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Reads the only internal characters read by filters. If we are in a distance filter than the distance is set in the filter factory, if not we forward directly along to the expression factory.

Specified by:
characters in interface org.xml.sax.ContentHandler
Parameters:
chars - Raw coordinate string from the filter document.
start - Beginning character position of raw string.
length - Length of the character string.
Throws:
org.xml.sax.SAXException - Some parsing error occurred while reading coordinates.

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Checks for filter element end and - if not a Filter then sends it directly to the appropriate filter factory.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Parameters:
namespaceURI - Namespace of the element.
localName - Local name of the element.
qName - Full name of the element, including namespace prefix.
Throws:
org.xml.sax.SAXException - Parsing error occurred while reading coordinates.

geometry

public void geometry(com.vividsolutions.jts.geom.Geometry geometry)
              throws java.lang.RuntimeException
Recieves a geometry from its child filter.

Specified by:
geometry in interface GMLHandlerJTS
Parameters:
geometry - The geometry from the filter.
Throws:
java.lang.RuntimeException - if the filterFactory can't handle the geometry
Task:
REVISIT: can we throw another exception?

convertType

protected static short convertType(java.lang.String filterType)
Converts the string representation of the expression to the AbstractFilter or DefaultExpression short type.

Parameters:
filterType - Type of filter for check.
Returns:
the short representation of the filter.


Copyright © GeoTools. All Rights Reserved.