Package org.geotools.gml2.simple
Class GeometryEncoder<T extends Geometry>
Object
ObjectEncoder<T>
GeometryEncoder<T>
- Type Parameters:
 T-
- Direct Known Subclasses:
 GenericGeometryEncoder,GenericGeometryEncoder,GeometryCollectionEncoder,RingEncoder
Base class for all encoders writing a Geometry. Implementations should provide one of the two "encode" methods,
 
encode(Geometry, AttributesImpl, GMLWriter) or encode(Geometry, AttributesImpl, GMLWriter, String),
 failing to do so will result in a infinite recursion and eventually in a StackOverflowError- Author:
 - Justin Deoliveira, OpenGeo, Andrea Aime - GeoSolutions
 
- 
Field Summary
Fields inherited from class ObjectEncoder
encoder - 
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedGeometryEncoder(Encoder encoder) protectedGeometryEncoder(Encoder encoder, boolean encodeGmlId)  - 
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddGmlId(AttributesImpl attributes, String gmlId) Adds a gmlId to an existing and non null attribute setprotected AttributesImplcloneWithGmlId(AttributesImpl atts, String gmlId) Returns a new AttributesImpl based on the provided on, with the addition of a gml:id attributevoidencode(T geometry, AttributesImpl atts, GMLWriter handler) Encodes a geometry valuevoidencode(T geometry, AttributesImpl atts, GMLWriter handler, String gmlId) Encodes a geometry value with a given gmlId (implementations might choose to use it to generate gml:id attributes, depending on the GML version. 
- 
Constructor Details
- 
GeometryEncoder
 - 
GeometryEncoder
 
 - 
 - 
Method Details
- 
encode
public void encode(T geometry, AttributesImpl atts, GMLWriter handler, String gmlId) throws Exception Encodes a geometry value with a given gmlId (implementations might choose to use it to generate gml:id attributes, depending on the GML version. The default implementation does not use gmlId and simply delegates toencode(Geometry, AttributesImpl, GMLWriter)- Parameters:
 geometry- The Geometry to be encodedatts- Its attributeshandler- The handler used to write XMLgmlId- If not null, some implementation will use to as the gml:id (and to build ids for the nested features)- Throws:
 Exception
 - 
cloneWithGmlId
Returns a new AttributesImpl based on the provided on, with the addition of a gml:id attribute- Parameters:
 atts- The base attributes (can be null)gmlId- The desired gml:id value- Returns:
 - The provided atts object if gmlId is null, a clone of the provided one plus the gml:id attribute otherwise
 
 - 
addGmlId
Adds a gmlId to an existing and non null attribute set - 
encode
Encodes a geometry value- Specified by:
 encodein classObjectEncoder<T extends Geometry>- Parameters:
 geometry- The Geometry to be encodedatts- Its attributeshandler- The handler used to write XML- Throws:
 Exception
 
 -