Package org.geotools.gml2.simple
Class GMLWriter
- Object
-
- GMLWriter
-
public class GMLWriter extends Object
Helper class writing out GML elements and coordinates. Geared towards efficiency, write out elements and ordinate lists with the minimim amount of garbage generation- Author:
- Andrea Aime - GeoSolutions
-
-
Constructor Summary
Constructors Constructor Description GMLWriter(ContentHandler delegate, NamespaceSupport namespaces, int numDecimals, boolean forceDecimal, boolean padWithZeros, String gmlPrefix)
Create a new content handlerGMLWriter(ContentHandler delegate, NamespaceSupport namespaces, int numDecimals, boolean forceDecimal, boolean padWithZeros, String gmlPrefix, boolean encodeMeasures)
Create a new content handlerGMLWriter(ContentHandler delegate, NamespaceSupport namespaces, int numDecimals, boolean forceDecimal, String gmlPrefix)
Create a new content handler
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
coordinates(CoordinateSequence cs)
Writes a GML2 coordinates elementvoid
endDocument()
void
endElement(QualifiedName qn)
void
endPrefixMapping(String prefix)
void
ordinate(double x)
Writes a single ordinate, without wrapping it inside any elementvoid
position(double x, double y, double z)
Writes a single x/y position, without wrapping it in any elementvoid
position(CoordinateSequence coordinates)
Encodes the provided coordinates sequence, if encoding of measures is enabled this method will encode all the available ordinates.void
posList(CoordinateSequence coordinateSequence)
Write a GML3 posListvoid
setDocumentLocator(Locator locator)
void
startDocument()
void
startElement(QualifiedName qn, Attributes atts)
void
startPrefixMapping(String prefix, String uri)
-
-
-
Constructor Detail
-
GMLWriter
public GMLWriter(ContentHandler delegate, NamespaceSupport namespaces, int numDecimals, boolean forceDecimal, String gmlPrefix)
Create a new content handler- Parameters:
delegate
- The actual XML writernamespaces
- The namespaces known to the EncodernumDecimals
- How many decimals to preserve when writing ordinatesforceDecimal
- If xs:decimal compliant encoding should be used, or notgmlPrefix
- The GML namespace prefix
-
GMLWriter
public GMLWriter(ContentHandler delegate, NamespaceSupport namespaces, int numDecimals, boolean forceDecimal, boolean padWithZeros, String gmlPrefix)
Create a new content handler- Parameters:
delegate
- The actual XML writernamespaces
- The namespaces known to the EncodernumDecimals
- How many decimals to preserve when writing ordinatesforceDecimal
- If xs:decimal compliant encoding should be used, or notpadWithZeros
- If apply zero paddinggmlPrefix
- The GML namespace prefix
-
GMLWriter
public GMLWriter(ContentHandler delegate, NamespaceSupport namespaces, int numDecimals, boolean forceDecimal, boolean padWithZeros, String gmlPrefix, boolean encodeMeasures)
Create a new content handler- Parameters:
delegate
- The actual XML writernamespaces
- The namespaces known to the EncodernumDecimals
- How many decimals to preserve when writing ordinatesforceDecimal
- If xs:decimal compliant encoding should be used, or notgmlPrefix
- The GML namespace prefixencodeMeasures
- TRUE if coordinates measures should be included
-
-
Method Detail
-
setDocumentLocator
public void setDocumentLocator(Locator locator)
-
startDocument
public void startDocument() throws SAXException
- Throws:
SAXException
- See Also:
ContentHandler.startDocument()
-
endDocument
public void endDocument() throws SAXException
- Throws:
SAXException
- See Also:
ContentHandler.endDocument()
-
startPrefixMapping
public void startPrefixMapping(String prefix, String uri) throws SAXException
-
endPrefixMapping
public void endPrefixMapping(String prefix) throws SAXException
- Throws:
SAXException
- See Also:
ContentHandler.endPrefixMapping(java.lang.String)
-
startElement
public void startElement(QualifiedName qn, Attributes atts) throws SAXException
-
endElement
public void endElement(QualifiedName qn) throws SAXException
-
coordinates
public void coordinates(CoordinateSequence cs) throws SAXException
Writes a GML2 coordinates element- Throws:
SAXException
-
position
public void position(double x, double y, double z) throws SAXException
Writes a single x/y position, without wrapping it in any element- Throws:
SAXException
-
position
public void position(CoordinateSequence coordinates) throws SAXException
Encodes the provided coordinates sequence, if encoding of measures is enabled this method will encode all the available ordinates.- Parameters:
coordinates
- the coordinates sequence- Throws:
SAXException
-
ordinate
public void ordinate(double x) throws SAXException
Writes a single ordinate, without wrapping it inside any element- Throws:
SAXException
-
posList
public void posList(CoordinateSequence coordinateSequence) throws SAXException
Write a GML3 posList- Throws:
SAXException
-
-