Class TLcdGXYLayerTreeNode

All Implemented Interfaces:
ILcdPropertyChangeSource, ILcdSelection<Object>, ILcdGXYEditableLabelsLayer, ILcdGXYLayer, ILcdLayer, ILcdLayered, ILcdLayerTreeNode, Serializable

public class TLcdGXYLayerTreeNode extends TLcdGXYLayer implements ILcdLayerTreeNode

An ILcdLayerTreeNode for ILcdGXYLayers.

Since:
9.0
See Also:
  • Constructor Details

    • TLcdGXYLayerTreeNode

      @Deprecated public TLcdGXYLayerTreeNode()
      Deprecated.
      It is recommended to either use TLcdGXYLayerTreeNode(ILcdModel) in a layer factory, or TLcdGXYLayerTreeNode(String) or TLcdGXYLayerTreeNode(String, ILcdIcon) when creating a node only used for grouping purposes in the layer control
      Constructs a new instance of ILcdLayerTreeNode.
    • TLcdGXYLayerTreeNode

      public TLcdGXYLayerTreeNode(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 ILcdGXYLayerFactory which is creating a layer structure which matches the structure of an incoming ILcdModelTreeNode.

      
         @Override
         public ILcdGXYLayer createLayer(ILcdModel aModel){
           if (aModel instanceof ILcdModelTreeNode){
             ILcdModelTreeNode modelNode = (ILcdModelTreeNode)aModel;
             TLcdGXYLayerTreeNode result = new TLcdGXYLayerTreeNode(aModel);
             for(int i = 0; i < modelNode.modelCount(); i++){
               result.addLayer(createLayer(modelNode.getModel(i)));
             }
             return result;
           } else {
             TLcdGXYLayer layer = new TLcdGXYLayer(aModel);
             //setup painters, ...
             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 provider.

      Parameters:
      aModel - The model
      Since:
      2016.1
    • TLcdGXYLayerTreeNode

      public TLcdGXYLayerTreeNode(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 TLcdGXYLayerTreeNode(String, ILcdIcon) constructor. Consult the documentation of that constructor for more information.

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

      public TLcdGXYLayerTreeNode(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.

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