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

org.deegree.gml
Class GMLStreamReader

java.lang.Object
  extended by org.deegree.gml.GMLStreamReader

public class GMLStreamReader
extends Object

Stream-based reader for all kinds of GML objects supported by deegree.

Instances of this class are not thread-safe.

Version:
$Revision: 22822 $, $Date: 2010-03-03 17:34:30 +0100 (Mi, 03 Mrz 2010) $
Author:
Markus Schneider, last edited by: $Author: rbezema $
See Also:
GMLObject, GMLInputFactory

Constructor Summary
GMLStreamReader(GMLVersion version, XMLStreamReaderWrapper xmlStream)
          Creates a new GMLStreamReader instance.
 
Method Summary
 void close()
          Closes the underlying XML stream.
 GMLDocumentIdContext getIdContext()
          Returns the GMLDocumentIdContext that keeps track of objects, identifiers and references.
 XMLStreamReader getXMLReader()
          Returns the underlying XMLStreamReader.
 boolean isGeometryElement()
           
 boolean isGeometryOrEnvelopeElement()
           
 GMLObject read()
          Returns the deegree model representation for the GML object element event that the cursor of the underlying xml stream points to.
 CRS readCRS()
          Returns the deegree model representation for the GML crs element event that the cursor of the underlying xml stream points to.
 Dictionary readDictionary()
          Returns the deegree model representation for the GML dictionary element event that the cursor of the underlying xml stream points to.
 Feature readFeature()
          Returns the deegree model representation for the GML feature element event that the cursor of the underlying xml stream points to.
 FeatureCollection readFeatureCollection()
          Returns the deegree model representation for the GML feature collection element event that the cursor of the underlying xml stream points to.
 Geometry readGeometry()
          Returns the deegree model representation for the GML geometry element event that the cursor of the underlying xml stream points to.
 Geometry readGeometryOrEnvelope()
          Returns the deegree model representation for the GML geometry element event that the cursor of the underlying xml stream points to.
 StreamFeatureCollection readStreamFeatureCollection()
          Returns the deegree model representation for the GML feature collection element event that the cursor of the underlying xml stream points to.
 void setApplicationSchema(ApplicationSchema schema)
          Controls the application schema that is assumed when features or feature collections are parsed.
 void setDefaultCRS(CRS defaultCRS)
          Controls the default CRS that is assumed when GML objects (especially geometries) without SRS information are parsed.
 void setGeometryFactory(GeometryFactory geomFac)
          Controls the GeometryFactory instance to be used for creating geometries.
 void setResolver(GMLReferenceResolver resolver)
          Controls the GMLReferenceResolver that the generated GMLReferences shall use for resolving themselves.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GMLStreamReader

GMLStreamReader(GMLVersion version,
                XMLStreamReaderWrapper xmlStream)
Creates a new GMLStreamReader instance.

Parameters:
version - GML version of the input, must not be null
xmlStream - XML stream used to read the input, must not be null
Method Detail

setApplicationSchema

public void setApplicationSchema(ApplicationSchema schema)
Controls the application schema that is assumed when features or feature collections are parsed.

Parameters:
schema - application schema, can be null (use xsi:schemaLocation attribute to build the application schema)

setDefaultCRS

public void setDefaultCRS(CRS defaultCRS)
Controls the default CRS that is assumed when GML objects (especially geometries) without SRS information are parsed.

Parameters:
defaultCRS - default CRS, can be null

setGeometryFactory

public void setGeometryFactory(GeometryFactory geomFac)
Controls the GeometryFactory instance to be used for creating geometries.

Parameters:
geomFac - geometry factory, can be null (use a default factory)

isGeometryElement

public boolean isGeometryElement()
Returns:
true if the stream's event is an XMLStreamConstants.START_ELEMENT && the current element's name is a known geometry (in respect to it's gml version).

isGeometryOrEnvelopeElement

public boolean isGeometryOrEnvelopeElement()
Returns:
true if the stream's event is an XMLStreamConstants.START_ELEMENT && the current element's name is a known geometry (in respect to it's gml version).

setResolver

public void setResolver(GMLReferenceResolver resolver)
Controls the GMLReferenceResolver that the generated GMLReferences shall use for resolving themselves.

Parameters:
resolver -

read

public GMLObject read()
               throws XMLStreamException,
                      XMLParsingException,
                      UnknownCRSException
Returns the deegree model representation for the GML object element event that the cursor of the underlying xml stream points to.

Returns:
deegree model representation for the current GML object element, never null
Throws:
XMLStreamException
UnknownCRSException
XMLParsingException

readFeature

public Feature readFeature()
                    throws XMLStreamException,
                           XMLParsingException,
                           UnknownCRSException
Returns the deegree model representation for the GML feature element event that the cursor of the underlying xml stream points to.

Returns:
deegree model representation for the current GML feature element, never null
Throws:
XMLStreamException
XMLParsingException
UnknownCRSException

readFeatureCollection

public FeatureCollection readFeatureCollection()
                                        throws XMLStreamException,
                                               XMLParsingException,
                                               UnknownCRSException
Returns the deegree model representation for the GML feature collection element event that the cursor of the underlying xml stream points to.

Please note that readStreamFeatureCollection() should be preferred (especially for large feature collections), because it does not need to built and store all features in memory at once.

Returns:
deegree model representation for the current GML feature collection element, never null
Throws:
XMLStreamException
XMLParsingException
UnknownCRSException

readStreamFeatureCollection

public StreamFeatureCollection readStreamFeatureCollection()
                                                    throws XMLStreamException,
                                                           XMLParsingException,
                                                           UnknownCRSException
Returns the deegree model representation for the GML feature collection element event that the cursor of the underlying xml stream points to.

This method does not automatically consume all events from the underlying XML stream. Instead, it allows the caller to control the consumption by iterating over the features in the returned collection.

Returns:
deegree model representation for the current GML feature collection element, never null
Throws:
XMLStreamException
XMLParsingException
UnknownCRSException

readGeometryOrEnvelope

public Geometry readGeometryOrEnvelope()
                                throws XMLStreamException,
                                       XMLParsingException,
                                       UnknownCRSException
Returns the deegree model representation for the GML geometry element event that the cursor of the underlying xml stream points to.

Returns:
deegree model representation for the current GML geometry element, never null
Throws:
XMLStreamException
XMLParsingException
UnknownCRSException

readGeometry

public Geometry readGeometry()
                      throws XMLStreamException,
                             XMLParsingException,
                             UnknownCRSException
Returns the deegree model representation for the GML geometry element event that the cursor of the underlying xml stream points to.

Returns:
deegree model representation for the current GML geometry element, never null
Throws:
XMLStreamException
XMLParsingException
UnknownCRSException

readDictionary

public Dictionary readDictionary()
                          throws XMLStreamException
Returns the deegree model representation for the GML dictionary element event that the cursor of the underlying xml stream points to.

Returns:
deegree model representation for the current GML dictionary element, never null
Throws:
XMLStreamException

readCRS

public CRS readCRS()
            throws XMLStreamException
Returns the deegree model representation for the GML crs element event that the cursor of the underlying xml stream points to.

Returns:
deegree model representation for the current GML crs element, never null
Throws:
XMLStreamException

getIdContext

public GMLDocumentIdContext getIdContext()
Returns the GMLDocumentIdContext that keeps track of objects, identifiers and references.

Returns:
the GMLDocumentIdContext, never null

getXMLReader

public XMLStreamReader getXMLReader()
Returns the underlying XMLStreamReader.

Returns:
the underlying XMLStreamReader, never null

close

public void close()
           throws XMLStreamException
Closes the underlying XML stream.

Throws:
XMLStreamException

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

]]>