Package org.geotools.gml.producer
Class FeatureTransformer.FeatureTranslator
Object
TransformerBase.TranslatorSupport
FeatureTranslator
- All Implemented Interfaces:
FeatureCollectionIteration.Handler
,Translator
- Enclosing class:
- FeatureTransformer
public class FeatureTransformer.FeatureTranslator
extends TransformerBase.TranslatorSupport
implements FeatureCollectionIteration.Handler
Outputs gml without any fancy indents or newlines.
-
Field Summary
FieldsFields inherited from class TransformerBase.TranslatorSupport
contentHandler, nsSupport, NULL_ATTS, schemaLocation
-
Constructor Summary
ConstructorsConstructorDescriptionFeatureTranslator
(ContentHandler handler, String prefix, String ns, FeatureTransformer.FeatureTypeNamespaces types, TransformerBase.SchemaLocationSupport schemaLoc) Constructor with handler. -
Method Summary
Modifier and TypeMethodDescriptionprotected GeometryTransformer.GeometryTranslator
createGeometryTranslator
(ContentHandler handler) Method to be subclassed to return a custom geometry translator, mostly for gml3 geometry support.protected GeometryTransformer.GeometryTranslator
createGeometryTranslator
(ContentHandler handler, int numDecimals, boolean padWithZeros, boolean forceDecimalEncoding) protected GeometryTransformer.GeometryTranslator
createGeometryTranslator
(ContentHandler handler, int numDecimals, boolean padWithZeros, boolean forceDecimalEncoding, boolean useDummyZ) protected GeometryTransformer.GeometryTranslator
createGeometryTranslator
(ContentHandler handler, int numDecimals, boolean padWithZeros, boolean forceDecimalEncoding, int dimension) Set up a GeometryTranslator for working with content of the indicate dimension.void
Encode the object.protected Attributes
void
Sends sax for the ending of a feature.void
void
endFeatureCollection
(FeatureCollection<?, ?> collection) Sends sax for the ending of a feature collection.void
handleAttribute
(PropertyDescriptor descriptor, Object value) handles sax for an attribute.void
Handles sax for a feature.void
handleFeatureCollection
(FeatureCollection<?, ?> collection) Prints up the gml for a featurecollection.void
handleFeatureIterator
(SimpleFeatureIterator iterator) void
void
void
void
writeBounds
(BoundingBox bounds) writes thegml:boundedBy
element to output based onfc.getBounds()
void
writes null bounds to the outputMethods inherited from class TransformerBase.TranslatorSupport
abort, addNamespaceDeclarations, cdata, chars, comment, commit, createAttributes, element, element, elementSafe, end, getDefaultNamespace, getDefaultPrefix, getNamespaceSupport, getSchemaLocationSupport, mark, reset, start, start
-
Field Details
-
geometryTranslator
-
-
Constructor Details
-
FeatureTranslator
public FeatureTranslator(ContentHandler handler, String prefix, String ns, FeatureTransformer.FeatureTypeNamespaces types, TransformerBase.SchemaLocationSupport schemaLoc) Constructor with handler.- Parameters:
handler
- the handler to use.prefix
- prefixns
- namespacetypes
- Capture namespace and prefix information for typesschemaLoc
- Schema location information
-
-
Method Details
-
createGeometryTranslator
Method to be subclassed to return a custom geometry translator, mostly for gml3 geometry support. -
createGeometryTranslator
protected GeometryTransformer.GeometryTranslator createGeometryTranslator(ContentHandler handler, int numDecimals, boolean padWithZeros, boolean forceDecimalEncoding) -
createGeometryTranslator
protected GeometryTransformer.GeometryTranslator createGeometryTranslator(ContentHandler handler, int numDecimals, boolean padWithZeros, boolean forceDecimalEncoding, boolean useDummyZ) -
createGeometryTranslator
protected GeometryTransformer.GeometryTranslator createGeometryTranslator(ContentHandler handler, int numDecimals, boolean padWithZeros, boolean forceDecimalEncoding, int dimension) Set up a GeometryTranslator for working with content of the indicate dimension.This method can be used by code explicitly wishing to output 2D ordinates.
- Returns:
- GeometryTranslator that will delegate a CoordinateWriter configured with the above parameters
- Since:
- 2.4.1
-
setLockId
-
getFeatureTypeNamespaces
-
encode
Description copied from interface:Translator
Encode the object.- Specified by:
encode
in interfaceTranslator
- Parameters:
o
- The Object to encode.- Throws:
IllegalArgumentException
- if the Object is not encodeable.
-
handleFeatureIterator
- Throws:
IOException
-
handleFeatureReader
public void handleFeatureReader(FeatureReader<SimpleFeatureType, SimpleFeature> reader) throws IOException- Throws:
IOException
-
startFeatureCollection
public void startFeatureCollection() -
endFeatureCollection
public void endFeatureCollection() -
handleFeatureCollection
Prints up the gml for a featurecollection.- Specified by:
handleFeatureCollection
in interfaceFeatureCollectionIteration.Handler
- Parameters:
collection
- FeatureCollection being encoded
-
writeBounds
writes thegml:boundedBy
element to output based onfc.getBounds()
- Throws:
RuntimeException
- if it is thorwn while writing the element or coordinates
-
writeNullBounds
public void writeNullBounds()writes null bounds to the output- Throws:
RuntimeException
- if it is thorwn while writing the element or coordinates
-
endFeatureCollection
Sends sax for the ending of a feature collection.- Specified by:
endFeatureCollection
in interfaceFeatureCollectionIteration.Handler
- Parameters:
collection
- Feature collection we have just finished encoding
-
endFeature
Sends sax for the ending of a feature.- Specified by:
endFeature
in interfaceFeatureCollectionIteration.Handler
- Parameters:
f
- Feature (implementation assume a SimpleFeature)- Throws:
RuntimeException
- if something goes wrong during encode it is wrapped up as a generic runtime exception
-
handleAttribute
handles sax for an attribute.- Specified by:
handleAttribute
in interfaceFeatureCollectionIteration.Handler
- Parameters:
descriptor
- Property descriptorvalue
- Value being encoded for this property- Throws:
RuntimeException
- Any problems are bundled up in a generic runtime exception
-
handleFeature
Handles sax for a feature.Please take care when considering the prefix/namespace for the feature. It is defined by either:
- the FeatureType using type.getName().getNamespaceURI() and the user data entry for "prefix".
- FeatureTypeNamespaces as provided to the constructor
- Specified by:
handleFeature
in interfaceFeatureCollectionIteration.Handler
- Parameters:
f
- Feature being encoded- Throws:
RuntimeException
- Used to report any troubles during encoding
-
encodeFeatureId
-