public class TLcdGMLTransformer extends TLcdTransformer
Specialized TLcdTransformer
can transforms objects from a given source
data model into GML and vice versa. Note that the inverse transformation is only
supported for source data models that are editable (this means that new instances
of their types can be created and all properties can be set).
This class can also write out the GML application schema
according to which the transformation is done.
New instances of this class are created using the TLcdGMLTransformerBuilder
.
This builder can be used to configure the GML transformation. It can for instance
be used to specify the GML version and whether or not a Simple Feature Profile
should be used.
More fine-grained customization of the GML transformation is possible by
adding appropriate annotations
on the source data model. The abstract base classes of these annotation classes
(such as for instance ALcdGMLNameAnnotation
) can be found in this package.
Version specific concrete extensions (such as for instance TLcdGML32NameAnnotation
) can be found
in separate packages grouped by version.
Modifier and Type | Method and Description |
---|---|
Map<Object,Object> |
createTransformationContext(ILcdModelReference aModelReference)
Creates a transformation context and configures it with the given model reference.
|
TLcdDataModel |
getSourceDataModel()
Returns the source data model.
|
TLcdDataModel |
getTargetDataModel()
Returns the target data model.
|
Object |
transform(Object aObject,
TLcdDataType aType,
Map<Object,Object> aContext)
Transforms the given object of the specified type with the given transformation context.
|
void |
writeSchema(OutputStream aOutputStream)
Writes out the GML application schema to the given output stream.
|
void |
writeSchema(XMLStreamWriter aStreamWriter)
Writes out the GML application schema to the given XMLStreamWriter.
|
createTransformationContext, getInverse, getProvider, transform, transform, transformTo, transformTo, transformTo
public TLcdDataModel getSourceDataModel()
public TLcdDataModel getTargetDataModel()
TLcdGML32DataTypes.getDataModel()
.
Source data objects are transformed into instances of the target data model.public void writeSchema(OutputStream aOutputStream) throws IOException
aOutputStream
- the output stream onto which the schema is to be writtenIOException
public void writeSchema(XMLStreamWriter aStreamWriter) throws XMLStreamException
aStreamWriter
- the stream writer to useXMLStreamException
public Map<Object,Object> createTransformationContext(ILcdModelReference aModelReference)
ILcdShape
instances into GML geometries. In GML, all geometries
require a model reference. Because LuciadLightspeed ILcdShape
implementations
don't expose this model reference, the model reference needs to be provided
separately in the transformation context.aModelReference
- the model reference of the shapes that are to be transformedpublic Object transform(Object aObject, TLcdDataType aType, Map<Object,Object> aContext)
TLcdTransformer
Transforms the given object of the specified type with the given transformation context.
The object is assumed to be of the given type. The transformer will look in its provider for a transformation that can transform objects of the given type. If one such transformation is found, the object is transformed using that transformation. Otherwise anIllegalArgumentException
is thrown to indicate that the object can't be transformed.
Note that this method is typically called for
objects that do not implement ILcdDataObject
. It allows for instance
to transform string values into integers.
transform
in class TLcdTransformer
aObject
- the object to transformaType
- the type of the objectaContext
- the transformation context