Class TLcdGMLTransformer


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.

  • Method Details

    • getSourceDataModel

      public TLcdDataModel 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.
      the source data model of this GML transformer
    • getTargetDataModel

      public TLcdDataModel getTargetDataModel()
      Returns the target data model. This data model depends on a GML data model (such as for instance TLcdGML32DataTypes.getDataModel(). Source data objects are transformed into instances of the target data model.
      the target data model of this GML transformer
    • writeSchema

      public void writeSchema(OutputStream aOutputStream) throws IOException
      Writes out the GML application schema to the given output stream.
      aOutputStream - the output stream onto which the schema is to be written
    • writeSchema

      public void writeSchema(XMLStreamWriter aStreamWriter) throws XMLStreamException
      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.
      aStreamWriter - the stream writer to use
    • createTransformationContext

      public Map<Object,Object> createTransformationContext(ILcdModelReference aModelReference)
      Creates a transformation context and configures it with the given model reference. This model reference is used by the geometry transformations that transform 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 transformed
      a new transformation context configured for the given model reference
    • transform

      public Object transform(Object aObject, TLcdDataType aType, Map<Object,Object> aContext)
      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 an IllegalArgumentException 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 transform
      aType - the type of the object
      aContext - the transformation context
      the transformed object