org.geotools.gml
Class GMLFilterFeature

java.lang.Object
  extended byorg.xml.sax.helpers.XMLFilterImpl
      extended byorg.geotools.gml.GMLFilterFeature
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 GMLFilterFeature
extends org.xml.sax.helpers.XMLFilterImpl
implements GMLHandlerJTS

LEVEL3 GML filter: translates JTS elements and attribute data into features.

This filter simply reads in the events and coordinates passed to it by its GMLFilterDocument child and converts them into JTS objects. Note that it passes through anything not specifically sent to it by GMLFilterDocument (i.e. more or less everything not in geometry.xsd). The parent of this filter must implement GMLHandlerJTS in order to receive the JTS objects passed by this filter.

Version:
$Id: GMLFilterFeature.java 18052 2006-02-16 17:34:47Z cholmes $
Author:
Rob Hranac, Vision for New York

Constructor Summary
GMLFilterFeature(GMLHandlerFeature parent)
          Constructor with parent, which must implement GMLHandlerJTS.
 
Method Summary
 void characters(char[] ch, int start, int length)
          Reads the only internal characters read by pure GML parsers, which are coordinates.
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
          Checks for GML element end and - if not a coordinates element - sends it directly on down the chain to the appropriate parent handler.
 void geometry(com.vividsolutions.jts.geom.Geometry geometry)
          Manages the start of a new main or sub geometry.
 void setSchema(java.lang.String uri)
           
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
          Checks for GML element start and - if not a coordinates element - sends it directly on down the chain to the appropriate parent handler.
 
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
 

Constructor Detail

GMLFilterFeature

public GMLFilterFeature(GMLHandlerFeature parent)
Constructor with parent, which must implement GMLHandlerJTS.

Parameters:
parent - The parent of this filter.
Method Detail

setSchema

public void setSchema(java.lang.String uri)

geometry

public void geometry(com.vividsolutions.jts.geom.Geometry geometry)
Manages the start of a new main or sub geometry. This method looks at the status of the current handler and either returns a new sub-handler (if the last one was successfully returned already) or passes the element start notification along to the current handler as a sub geometry notice.

Specified by:
geometry in interface GMLHandlerJTS
Parameters:
geometry - The geometry from the child.

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 for GML element start and - if not a coordinates element - sends it directly on down the chain to the appropriate parent handler. If it is a coordinates (or coord) element, it uses internal methods to set the current state of the coordinates reader appropriately.

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 coordinates.
Task:
HACK:The method for determining if something is a feature or not is too crude.

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Reads the only internal characters read by pure GML parsers, which are coordinates. These coordinates are sent to the coordinates reader class which interprets them appropriately, depending on the its current state.

Specified by:
characters in interface org.xml.sax.ContentHandler
Parameters:
ch - Raw coordinate string from the GML document.
start - Beginning character position of raw coordinate 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 GML element end and - if not a coordinates element - sends it directly on down the chain to the appropriate parent handler. If it is a coordinates (or coord) element, it uses internal methods to set the current state of the coordinates reader appropriately.

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.


Copyright © GeoTools. All Rights Reserved.