Class TLcyLspLayerTreeNodeFormatWrapper


public class TLcyLspLayerTreeNodeFormatWrapper extends ALcyLspFormatWrapper

This ALcyLspFormatWrapper adds support for working with ILcdLayerTreeNodes. When an ILcdModelTreeNode is given to its ILspLayerFactory it automatically creates a matching layer tree node structure. The creation of the layers for the sub-models is left to the delegate ALcyFormat. Consider this model structure:


            ILcdModelTreeNode-A
             |               |
   ILcdModelTreeNode-B     ILcdModel-E
      |            |
 ILcdModel-C  ILcdModel-D
 

A matching structure of ILcdLayerTreeNodes is created. The layer nodes for A and B are created by this wrapper, the creation of the (regular) layers for the models C, D and E are left to the wrapped format.

It also adds workspace support for the layer nodes it creates.

Limitations

  • When any of the nodes in the model structure is an ILcdModelTreeNode and when this tree node contains data, the creation of the layer is left to the delegate format. This class assumes that the delegate format creates an ILcdLayerTreeNode in that case.
  • The canHandleModel(com.luciad.model.ILcdModel) of the delegate format should accept the ILcdModelTreeNode instances.
  • It assumes a TLcyLspSafeGuardFormatWrapper will be applied around this format before plugging the format into the Lucy back-end.
Since:
2012.0
  • Constructor Details

    • TLcyLspLayerTreeNodeFormatWrapper

      public TLcyLspLayerTreeNodeFormatWrapper(ALcyLspFormat aFormat)
      Creates a wrapper for the specified ALcyLspFormat. Layer tree nodes will be created for all ILcdModelTreeNode instances that belong to aFormat (see ALcyLspFormat.canHandleModel(com.luciad.model.ILcdModel)).
      Parameters:
      aFormat - The ALcyLspFormat to decorate. Must not be null.
  • Method Details

    • isLayerOfFormat

      public boolean isLayerOfFormat(ILspLayer aLayer)

      Returns true if and only if the given layer is a layer of this format.

      The default implementation uses the ALcyLspFormat.canHandleModel(com.luciad.model.ILcdModel) to determine whether aLayer is a layer of this format.

      Returns true when aLayer is a node of this format (as determined by the isLayerTreeNodeOfFormat method), or when the delegate format accepts the layer.

      Overrides:
      isLayerOfFormat in class ALcyLspFormatWrapper
      Parameters:
      aLayer - The layer to check
      Returns:
      true if and only if the given layer is a layer of this format
    • isLayerTreeNodeOfFormat

      public boolean isLayerTreeNodeOfFormat(ILspLayer aLayer)

      Returns true if and only if the given layer is an ILcdLayerTreeNode of the current data format.

      Parameters:
      aLayer - the layer to check
      Returns:
      true if and only if the given layer is an ILcdLayerTreeNode of the current data format.
      See Also:
    • canHandleModel

      public boolean canHandleModel(ILcdModel aModel)

      Returns true if and only if the given model can be visualized by this format.

      Warning: the decorated format should accept the ILcdModelTreeNode instances which are passed to this format, or this format will not accept them.

      Overrides:
      canHandleModel in class ALcyLspFormatWrapper
      Parameters:
      aModel - The model to check
      Returns:
      true if and only if the given model can be visualized by this format.
    • createLayerNode

      public ILcdLayerTreeNode createLayerNode(ILcdModel aModel)

      Creates a new ILcdLayerTreeNode with model aModel.

      If you overwrite this method, make sure the created nodes still pass the isLayerTreeNodeOfFormat(com.luciad.view.lightspeed.layer.ILspLayer) check.

      Parameters:
      aModel - The model for the layer node
      Returns:
      a new ILcdLayerTreeNode which passes the isLayerTreeNodeOfFormat(com.luciad.view.lightspeed.layer.ILspLayer) check
    • createLayerFactory

      public ILspLayerFactory createLayerFactory()

      Creates the layer factory for this format. The default implementation returns null.

      This implementations returns the instance created by the decorated format.

      Returns a layer factory which creates ILcdLayerTreeNode instances for an ILcdModelTreeNode, and delegates the creation of the child layers to the layer factory of the decorated format. This is explained in more detail in the class javadoc.

      Overrides:
      createLayerFactory in class ALcyLspFormatWrapper
      Returns:
      The ILspLayerFactory for this format. May be null
      See Also:
    • createLayerWorkspaceCodecs

      public ALcyWorkspaceObjectCodec[] createLayerWorkspaceCodecs()

      Creates the ALcyWorkspaceObjectCodecs that can encode the state of the layers created by the layer factory of this format.

      The default implementation returns an array with a single codec which uses the layer factory and the layer style codecs of the format.

      This implementations returns the instance created by the decorated format.

      This format adds layer codecs for the ILcdLayerTreeNode instances it creates. The workspace support for the child layers is left to the delegate format, which has also created these layers.

      Overrides:
      createLayerWorkspaceCodecs in class ALcyLspFormatWrapper
      Returns:
      The array of ALcyWorkspaceObjectCodecs to encode the state of the layers. May be empty but not null. Must not contain null
      See Also: