Class TLspLayerTreeNode

All Implemented Interfaces:
ILcdPropertyChangeSource, ILcdSelection<Object>, ILcdLayer, ILcdLayered, ILcdLayerTreeNode, ILspSnappable, ILspEditableStyledLayer, ILspInteractivePaintableLayer, ILspLayer, ILspPaintableLayer, ILspStyledLayer, Serializable

public class TLspLayerTreeNode extends TLspLayer implements ILcdLayerTreeNode
Extension of TLspLayer that implements ILcdLayerTreeNode and hence can also have child layers.
Since:
2012.0
See Also:
  • Constructor Details

    • TLspLayerTreeNode

      public TLspLayerTreeNode(ILcdModel aModel)

      Constructs a new layer tree node for the specified model. The layer label will be the display name of the model descriptor, if available.

      The typical use-case for this method is an ILspLayerFactory which is creating a layer structure which matches the structure of an incoming ILcdModelTreeNode.

      
         @Override
         public Collection<ILspLayer> createLayers(ILcdModel aModel){
           if (aModel instanceof ILcdModelTreeNode){
             ILcdModelTreeNode modelNode = (ILcdModelTreeNode)aModel;
             TLspLayerTreeNode result = new TLspLayerTreeNode(aModel);
             for(int i = 0; i < modelNode.modelCount(); i++){
               result.addLayers(createLayers(modelNode.getModel(i)));
             }
             return result;
           } else {
             ILspLayer layer = TLspShapeLayerBuilder.newBuilder().model(aModel).build();
             return layer;
           }
         }
       

      Note that the above snippet assumes that the ILcdModelTreeNode itself does not contain any data (the most common scenario). In case the ILcdModelTreeNode contains data which should be visualized, you need to configure the layer tree node just as you do for a regular layer: for example setting a painter.

      Parameters:
      aModel - The model
      Since:
      2016.1
    • TLspLayerTreeNode

      public TLspLayerTreeNode(String aLabel)

      Constructs a new instance of ILcdLayerTreeNode with label aLabel. The node will be initialized with a default, empty model.

      The main use-case for this constructor is the same as for the TLspLayerTreeNode(String, ILcdIcon) constructor. Consult the documentation of that constructor for more information.

      Parameters:
      aLabel - A short textual representation of this node
    • TLspLayerTreeNode

      public TLspLayerTreeNode(String aLabel, ILcdIcon aIcon)

      Constructs a new instance of ILcdLayerTreeNode with label aLabel and icon aIcon. The node will be initialized with a default, empty model.

      The typical use-case for this method is if you want to add a node to the view for grouping purposes. For example, if you have have several raster background layers which you want to group under a node in the view, you can use this constructor to create such a grouping node.

      
         ILspLayer[] rasterBackgroundLayers = ...;
      
         //create a node to group those background layers
         ILcdIcon icon = TLcdIconFactory.create(TLcdIconFactory.RASTER_LAYER_ICON);
         TLspLayerTreeNode node = new TLspLayerTreeNode("Background Data", icon);
         for(ILspLayer backgroundLayer : rasterBackgroundLayers){
           node.addLayer(backgroundLayer);
         }
      
         view.addLayer(node);
       
      Parameters:
      aLabel - A short textual representation of this node
      aIcon - A small visual representation of this node
    • TLspLayerTreeNode

      public TLspLayerTreeNode(ILcdModel aModel, String aLabel, ILspLayer.LayerType aLayerType)

      Initializes a new ILcdLayerTreeNode object with given model, label and layer type.

      The main use-case for this constructor is the same as for the TLspLayerTreeNode(ILcdModel) constructor. Consult the documentation of that constructor for more information.

      Parameters:
      aModel - the model that is to be added to the new layer
      aLabel - the label of the new layer
      aLayerType - the LayerType of the new layer
  • Method Details