Class TLcyTransformingModelFormatWrapper

java.lang.Object
com.luciad.lucy.format.ALcyFormat
com.luciad.lucy.format.ALcyFormatWrapper
com.luciad.lucy.format.TLcyTransformingModelFormatWrapper

public class TLcyTransformingModelFormatWrapper extends ALcyFormatWrapper
An ALcyFormatWrapper instance which adds support for transforming the models in the layer factory, for example to add support for clustering.

This format wrapper has a layer factory implementation which allows to convert the model into a ALcdTransformingModel and create a layer for that. A possible use-case is if you want to cluster the domain objects on the map.

The Lucy clustering sample illustrates a usage of this class. See samples.lucy.clustering.ClusteringSHPAddOn#createSHPFormat().
Since:
2017.1
See Also:
  • Constructor Details

    • TLcyTransformingModelFormatWrapper

      public TLcyTransformingModelFormatWrapper(ALcyFormat aFormat, Function<ILcdModel,Optional<ALcdTransformingModel>> aTransformingModelProducer, ILcdGXYLayerFactory aTransformedModelLayerFactory)
      Creates a new TLcyTransformingModelFormatWrapper instance
      Parameters:
      aFormat - The delegate format
      aTransformingModelProducer - Function which convert an ILcdModel into an ALcdTransformingModel when needed (for example to add clustering support). The function should return an empty Optional when the model does not need to be converted.
      aTransformedModelLayerFactory - Layer factory responsible for the creation of the layers for the ALcdTransformingModel instances created by aTransformingModelProducer
  • Method Details

    • createGXYLayerFactory

      protected final ILcdGXYLayerFactory createGXYLayerFactory()

      Creates a ILcdGXYLayerFactory for this format.

      The factory can also configure label algorithms on the created layers.

      For each incoming model, the layer factory will:

      1. Try transforming the model by calling the transforming model producer passed in the constructor.
      2. If an ALcdTransformingModel is produced, layer creation will be delegated to the layer factory passed in the constructor. If not, layer creation is delegated to the layer factory of the delegate format.
      Overrides:
      createGXYLayerFactory in class ALcyFormatWrapper
      Returns:
      the ILcdGXYLayerFactory for this data format. May be null.
      See Also:
    • transformModel

      public final ILcdModel transformModel(ILcdModel aModel)
      This public method can be called from other classes to obtain a transformed version of aModel, for example if a Lightspeed format wants to add clustering for its domain objects. It will delegate the creation of the transformed model to the transforming model producer function passed in the constructor.
      Parameters:
      aModel - The model
      Returns:
      An ALcdTransformingModel of aModel (for example to add clustering support) or aModel when no transformation is needed.
    • createModelWorkspaceCodecs

      protected final ALcyWorkspaceObjectCodec[] createModelWorkspaceCodecs()
      Description copied from class: ALcyFormat

      Creates the ALcyWorkspaceObjectCodec codecs that can encode and decode the ILcdModel instances produces by the model decoders of this format.

      Overrides:
      createModelWorkspaceCodecs in class ALcyFormatWrapper
      Returns:
      An array containing the ALcyWorkspaceObjectCodec instances. Must not be null, but may have length 0. Must not contain null.
      See Also:
    • isModelOfFormat

      public final boolean isModelOfFormat(ILcdModel aModel)
      Description copied from class: ALcyFormat
      Returns true if and only if the given model is a model of the current data format.
      Overrides:
      isModelOfFormat in class ALcyFormatWrapper
      Parameters:
      aModel - The model to check.
      Returns:
      true if and only if the given model is a model of the current data format.