Class TLcdGMLTransformer
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.
- Since:
- 11.0
-
Method Summary
Modifier and TypeMethodDescriptioncreateTransformationContext
(ILcdModelReference aModelReference) Creates a transformation context and configures it with the given model reference.Returns the source data model.Returns the target data model.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.Methods inherited from class com.luciad.datamodel.transformation.TLcdTransformer
createTransformationContext, getInverse, getProvider, transform, transform, transformTo, transformTo, transformTo
-
Method Details
-
getSourceDataModel
Returns the source data model. The transformer is able to transform instances of types of the source data model into GML. The source data model should NOT depend on GML.- Returns:
- the source data model of this GML transformer
-
getTargetDataModel
Returns the target data model. This data model depends on a GML data model (such as for instanceTLcdGML32DataTypes.getDataModel()
. Source data objects are transformed into instances of the target data model.- Returns:
- the target data model of this GML transformer
-
writeSchema
Writes out the GML application schema to the given output stream.- Parameters:
aOutputStream
- the output stream onto which the schema is to be written- Throws:
IOException
-
writeSchema
Writes out the GML application schema to the given XMLStreamWriter. Using a custom XMLStreamWriter makes it possible to tweak the generated schema such that for instance appropriate schema import statements are used.- Parameters:
aStreamWriter
- the stream writer to use- Throws:
XMLStreamException
-
createTransformationContext
Creates a transformation context and configures it with the given model reference. This model reference is used by the geometry transformations that transformILcdShape
instances into GML geometries. In GML, all geometries require a model reference. Because LuciadLightspeedILcdShape
implementations don't expose this model reference, the model reference needs to be provided separately in the transformation context.- Parameters:
aModelReference
- the model reference of the shapes that are to be transformed- Returns:
- a new transformation context configured for the given model reference
-
transform
Description copied from class: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.- Overrides:
transform
in classTLcdTransformer
- Parameters:
aObject
- the object to transformaType
- the type of the objectaContext
- the transformation context- Returns:
- the transformed object
-