Package org.geotools.gml.stream
Class XmlStreamGeometryReader
- Object
-
- XmlStreamGeometryReader
-
public class XmlStreamGeometryReader extends Object
Parse GML geometries from a StAX XMLStreamReader.
-
-
Field Summary
Fields Modifier and Type Field Description static double
DEFAULT_CURVE_TOLERANCE
-
Constructor Summary
Constructors Constructor Description XmlStreamGeometryReader(XMLStreamReader reader)
Create a new instance of the XML Stream Geometry Reader.XmlStreamGeometryReader(XMLStreamReader reader, GeometryFactory geometryFactory)
Create a new instance of the XML Stream Geometry Reader.XmlStreamGeometryReader(XMLStreamReader reader, GeometryFactory geometryFactory, CurvedGeometryFactory curvedGeometryFactory)
Create a new instance of the XML Stream Geometry Reader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GeometryFactory
getGeometryFactory()
boolean
isUnsafeXMLAllowed()
Geometry
readGeometry()
Reads the nextGeometry
from the stream.void
setGeometryFactory(GeometryFactory geometryFactory)
void
setInvertAxisNeeded(Predicate<CoordinateReferenceSystem> invertAxisNeeded)
By default axis are not inverted, you can provide a predicate that determines whether axes need to be inverted for a CRS (only called once per CRS).void
setUnsafeXMLAllowed(boolean unsafeXMLAllowed)
-
-
-
Field Detail
-
DEFAULT_CURVE_TOLERANCE
public static final double DEFAULT_CURVE_TOLERANCE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
XmlStreamGeometryReader
public XmlStreamGeometryReader(XMLStreamReader reader)
Create a new instance of the XML Stream Geometry Reader.- Parameters:
reader
- the reader providing the data to parse
-
XmlStreamGeometryReader
public XmlStreamGeometryReader(XMLStreamReader reader, GeometryFactory geometryFactory)
Create a new instance of the XML Stream Geometry Reader.- Parameters:
reader
- the reader providing the data to parsegeometryFactory
- a specificGeometryFactory
to use for constructing geometries
-
XmlStreamGeometryReader
public XmlStreamGeometryReader(XMLStreamReader reader, GeometryFactory geometryFactory, CurvedGeometryFactory curvedGeometryFactory)
Create a new instance of the XML Stream Geometry Reader.- Parameters:
reader
- the reader providing the data to parsegeometryFactory
- a specificGeometryFactory
to use for constructing geometriescurvedGeometryFactory
- a specificCurvedGeometryFactory
to use for constructing curved geometries
-
-
Method Detail
-
setGeometryFactory
public void setGeometryFactory(GeometryFactory geometryFactory)
-
getGeometryFactory
public GeometryFactory getGeometryFactory()
-
isUnsafeXMLAllowed
public boolean isUnsafeXMLAllowed()
-
setUnsafeXMLAllowed
public void setUnsafeXMLAllowed(boolean unsafeXMLAllowed)
- Parameters:
unsafeXMLAllowed
- true if you want to parse from an XMLStreamReader not configured for safe XML parsing (XMLInputFactory.SUPPORT_DTD is true)
-
setInvertAxisNeeded
public void setInvertAxisNeeded(Predicate<CoordinateReferenceSystem> invertAxisNeeded)
By default axis are not inverted, you can provide a predicate that determines whether axes need to be inverted for a CRS (only called once per CRS).
-
readGeometry
public Geometry readGeometry() throws NoSuchAuthorityCodeException, FactoryException, XMLStreamException, IOException
Reads the nextGeometry
from the stream.Precondition: parser cursor positioned on a geometry property (eg.
gml:Point
, etc).Postcondition: parser gets positioned at the end tag of the element it started parsing the geometry at.
- Throws:
XMLStreamException
- when the parser cursor is not positioned on the expected elementNoSuchAuthorityCodeException
- when parsing the EPSG code failsFactoryException
- when finding an EPSG parser failsIOException
- unkown error
-
-