deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

org.deegree.gml.feature
Class GMLFeatureReader

java.lang.Object
  extended by org.deegree.commons.xml.XMLAdapter
      extended by org.deegree.gml.feature.GMLFeatureReader

public class GMLFeatureReader
extends XMLAdapter

Stream-based reader for GML-encoded features and feature collections.

Version:
$Revision:$, $Date:$
Author:
Markus Schneider , last edited by: $Author:$

Field Summary
 
Fields inherited from class org.deegree.commons.xml.XMLAdapter
DEFAULT_URL, nsContext, rootElement, XLN_NS
 
Constructor Summary
GMLFeatureReader(GMLVersion version, ApplicationSchema schema, GMLDocumentIdContext idContext)
          Creates a new GMLFeatureReader instance that is configured for building features with the specified feature types.
GMLFeatureReader(GMLVersion version, ApplicationSchema schema, GMLDocumentIdContext idContext, GMLReferenceResolver resolver)
          Creates a new GMLFeatureReader instance that is configured for building features with the specified feature types.
 
Method Summary
 ApplicationSchema getApplicationSchema()
          Returns the associated ApplicationSchema that describes the structure of the feature types.
 GMLDocumentIdContext getDocumentIdContext()
          Returns the GMLDocumentIdContext that keeps track of objects, identifieres and references.
protected  FeatureType lookupFeatureType(XMLStreamReaderWrapper xmlStreamReader, QName ftName)
          Returns the feature type with the given name.
 Feature parseFeature(XMLStreamReaderWrapper xmlStream, CRS crs)
          Returns the object representation for the feature (or feature collection) element event that the cursor of the given XMLStreamReader points at.
protected  String parseFeatureId(XMLStreamReaderWrapper xmlReader)
          Parses the feature id attribute from the feature START_ELEMENT event that the given XMLStreamReader points to.
 Property<?> parseProperty(XMLStreamReaderWrapper xmlStream, PropertyType propDecl, CRS crs, int occurence)
          Returns the object representation for the given property element.
 void registerCustomPropertyParser(PropertyType pt, CustomPropertyReader<?> parser)
          Registers a CustomPropertyReader that is invoked to parse properties of a certain type.
 void setGeometryReader(GMLGeometryReader geomReader)
           
 
Methods inherited from class org.deegree.commons.xml.XMLAdapter
evaluateXPath, getElement, getElements, getNamespaceContext, getNode, getNodeAsBoolean, getNodeAsDouble, getNodeAsFloat, getNodeAsInt, getNodeAsQName, getNodeAsString, getNodeAsURL, getNodeAsVersion, getNodes, getNodesAsQNames, getNodesAsStrings, getRequiredElement, getRequiredElements, getRequiredNode, getRequiredNodeAsBoolean, getRequiredNodeAsDouble, getRequiredNodeAsFloat, getRequiredNodeAsInteger, getRequiredNodeAsQName, getRequiredNodeAsString, getRequiredNodeAsURL, getRequiredNodeAsVersion, getRequiredNodes, getRootElement, getSchemas, getSystemId, hasSchemas, load, load, load, load, load, maybeWriteElement, maybeWriteElementNS, parseBoolean, parseDouble, parseFloat, parseInt, parseQName, parseSimpleLink, parseURL, resolve, setRootElement, setSystemId, toString, writeElement, writeElement, writeElement, writeElement, writeElement, writeOptionalAttribute, writeOptionalElement, writeOptionalNSAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GMLFeatureReader

public GMLFeatureReader(GMLVersion version,
                        ApplicationSchema schema,
                        GMLDocumentIdContext idContext)
Creates a new GMLFeatureReader instance that is configured for building features with the specified feature types.

Parameters:
version - GML version, must not be null
schema - application schema that defines the feature types, must not be null
idContext - id context to be used for registering gml:ids (features and geometries) and resolving local xlinks, can be null

GMLFeatureReader

public GMLFeatureReader(GMLVersion version,
                        ApplicationSchema schema,
                        GMLDocumentIdContext idContext,
                        GMLReferenceResolver resolver)
Creates a new GMLFeatureReader instance that is configured for building features with the specified feature types.

Parameters:
version - GML version, must not be null
schema - application schema that defines the feature types, must not be null
idContext - id context to be used for registering gml:ids (features and geometries and resolving local xlinks and
resolver -
Method Detail

setGeometryReader

public void setGeometryReader(GMLGeometryReader geomReader)

registerCustomPropertyParser

public void registerCustomPropertyParser(PropertyType pt,
                                         CustomPropertyReader<?> parser)
Registers a CustomPropertyReader that is invoked to parse properties of a certain type.

Parameters:
pt -
parser -

getApplicationSchema

public ApplicationSchema getApplicationSchema()
Returns the associated ApplicationSchema that describes the structure of the feature types.

Returns:
the associated ApplicationSchema

getDocumentIdContext

public GMLDocumentIdContext getDocumentIdContext()
Returns the GMLDocumentIdContext that keeps track of objects, identifieres and references.

Returns:
the GMLDocumentIdContext, never null

parseFeature

public Feature parseFeature(XMLStreamReaderWrapper xmlStream,
                            CRS crs)
                     throws XMLStreamException,
                            XMLParsingException,
                            UnknownCRSException
Returns the object representation for the feature (or feature collection) element event that the cursor of the given XMLStreamReader points at.

Parameters:
xmlStream - cursor must point at the START_ELEMENT event of the feature element, afterwards points at the next event after the END_ELEMENT event of the feature element
crs - default CRS for all descendant geometry properties
Returns:
object representation for the given feature element
Throws:
XMLStreamException
UnknownCRSException
XMLParsingException

parseProperty

public Property<?> parseProperty(XMLStreamReaderWrapper xmlStream,
                                 PropertyType propDecl,
                                 CRS crs,
                                 int occurence)
                          throws XMLParsingException,
                                 XMLStreamException,
                                 UnknownCRSException
Returns the object representation for the given property element.

Parameters:
xmlStream - cursor must point at the START_ELEMENT event of the property, afterwards points at the next event after the END_ELEMENT of the property
propDecl - property declaration
crs - default SRS for all a descendant geometry properties
occurence -
Returns:
object representation for the given property element.
Throws:
XMLParsingException
XMLStreamException
UnknownCRSException

lookupFeatureType

protected FeatureType lookupFeatureType(XMLStreamReaderWrapper xmlStreamReader,
                                        QName ftName)
                                 throws XMLParsingException
Returns the feature type with the given name.

If no feature type with the given name is defined, an XMLParsingException is thrown.

Parameters:
xmlStreamReader -
ftName - feature type name to look up
Returns:
the feature type with the given name
Throws:
XMLParsingException - if no feature type with the given name is defined

parseFeatureId

protected String parseFeatureId(XMLStreamReaderWrapper xmlReader)
Parses the feature id attribute from the feature START_ELEMENT event that the given XMLStreamReader points to.

Looks after 'gml:id' (GML 3) first, if no such attribute is present, the 'fid' (GML 2) attribute is used.

Parameters:
xmlReader - must point to the START_ELEMENT event of the feature
Returns:
the feature id, or "" (empty string) if neither a 'gml:id' nor a 'fid' attribute is present

deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org

]]>