|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.deegree.gml.GMLStreamReader
public class GMLStreamReader
Stream-based reader for GML instance documents or GML document fragments. Currently supports GML 2/3.0/3.1/3.2.
GMLStreamReader always works on top of a XMLStreamReader instance. Use the
methods provided in GMLInputFactory to create a GMLStreamReader instance.
...
GMLStreamReader gmlReader = GMLInputFactory.createGMLStreamReader( GMLVersion.GML_2, new URL ("...") );
...
read() is used to consume the next GML object element
(geometry, feature, feature collection, etc.) from the stream and turn it into an object representation.
... GMLObject object = gmlReader.read(); ...It's vital that the underlying
XMLStreamReader points to the START_ELEMENT event of the GML
element to be read. After calling, the underlying XMLStreamReader will be positioned on the event after the
corresponding END_ELEMENT event.
Depending on the actual element, a corresponding GMLObject instance will be created (Geometry,
FeatureCollection, Feature, etc.). In order to work with the object, it has to be cast to the
concrete type. Alternatively (if one knows the type of element to be read beforehand), use on of the specific
read methods to avoid the cast:
... Feature feature = gmlReader.readFeature(); ...
GMLObject,
GMLInputFactory| Method Summary | |
|---|---|
void |
close()
Closes the underlying XML stream. |
GMLDictionaryReader |
getDictionaryReader()
Returns a configured GMLDictionaryReader instance for calling specific dictionary parsing methods. |
GMLFeatureReader |
getFeatureReader()
Returns a configured GMLFeatureReader instance for calling specific feature parsing methods. |
GMLGeometryReader |
getGeometryReader()
Returns a configured GMLGeometryReader instance for calling specific geometry parsing methods. |
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. |
StreamFeatureCollection |
readFeatureCollectionStream()
Returns a StreamFeatureCollection that allows stream-based access to the members of the feature
collection that the cursor of the given XMLStreamReader points at. |
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. |
void |
setApplicationSchema(AppSchema schema)
Controls the application schema that is assumed when features or feature collections are parsed. |
void |
setDefaultCRS(ICRS 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)
Sets the GMLReferenceResolver that the generated GMLReferences will use for resolving themselves. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public void setApplicationSchema(AppSchema schema)
schema - application schema, can be null (use xsi:schemaLocation attribute to build the
application schema)public void setDefaultCRS(ICRS defaultCRS)
defaultCRS - default CRS, can be nullpublic void setGeometryFactory(GeometryFactory geomFac)
GeometryFactory instance to be used for creating geometries.
geomFac - geometry factory, can be null (use a default factory)public boolean isGeometryElement()
XMLStreamConstants.START_ELEMENT && the current element's name
is a known geometry (with respect to it's gml version).public boolean isGeometryOrEnvelopeElement()
XMLStreamConstants.START_ELEMENT && the current element's name
is a known geometry (with respect to it's gml version).public void setResolver(GMLReferenceResolver resolver)
GMLReferenceResolver that the generated GMLReferences will use for resolving themselves.
resolver -
public GMLObject read()
throws XMLStreamException,
XMLParsingException,
UnknownCRSException
null
XMLStreamException
UnknownCRSException
XMLParsingException
public Feature readFeature()
throws XMLStreamException,
XMLParsingException,
UnknownCRSException
null
XMLStreamException
XMLParsingException
UnknownCRSException
public FeatureCollection readFeatureCollection()
throws XMLStreamException,
XMLParsingException,
UnknownCRSException
Please note that readFeatureCollectionStream() should be preferred (especially for large feature
collections), because it does not build and store all features in memory at once.
null
XMLStreamException
XMLParsingException
UnknownCRSException
public StreamFeatureCollection readFeatureCollectionStream()
throws XMLStreamException,
XMLParsingException,
UnknownCRSException
StreamFeatureCollection that allows stream-based access to the members of the feature
collection that the cursor of the given XMLStreamReader points at.
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.
null
XMLStreamException
XMLParsingException
UnknownCRSException
public Geometry readGeometryOrEnvelope()
throws XMLStreamException,
XMLParsingException,
UnknownCRSException
null
XMLStreamException
XMLParsingException
UnknownCRSException
public Geometry readGeometry()
throws XMLStreamException,
XMLParsingException,
UnknownCRSException
null
XMLStreamException
XMLParsingException
UnknownCRSException
public Dictionary readDictionary()
throws XMLStreamException
null
XMLStreamException
public CRS readCRS()
throws XMLStreamException
null
XMLStreamExceptionpublic GMLDocumentIdContext getIdContext()
GMLDocumentIdContext that keeps track of objects, identifiers and references.
GMLDocumentIdContext, never nullpublic XMLStreamReader getXMLReader()
XMLStreamReader.
XMLStreamReader, never null
public void close()
throws XMLStreamException
XMLStreamExceptionpublic GMLFeatureReader getFeatureReader()
GMLFeatureReader instance for calling specific feature parsing methods.
GMLFeatureReader instance, never nullpublic GMLGeometryReader getGeometryReader()
GMLGeometryReader instance for calling specific geometry parsing methods.
GMLGeometryReader instance, never nullpublic GMLDictionaryReader getDictionaryReader()
GMLDictionaryReader instance for calling specific dictionary parsing methods.
GMLDictionaryReader instance, never null
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||