NASA World Wind

gov.nasa.worldwind.util.layertree
Class LayerTree

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.util.tree.BasicTree
              extended by gov.nasa.worldwind.util.layertree.LayerTree
All Implemented Interfaces:
AVList, MessageListener, OrderedRenderable, PreRenderable, Renderable, Tree, WWObject, PropertyChangeListener, EventListener

public class LayerTree
extends BasicTree

A Renderable tree of Layer objects and their content. By default, a LayerTree is created with a LayerTreeModel, and a BasicTreeLayout that is configured for displaying a layer tree. Callers can specify the model to use either by specifying one during construction, or by calling BasicTree.setModel(gov.nasa.worldwind.util.tree.TreeModel). Once created, callers add layers to the tree using methods on LayerTreeModel.

See Also:
LayerTreeModel, LayerTreeNode

Field Summary
protected static String DEFAULT_FRAME_IMAGE
          The default frame image.
protected static String DEFAULT_FRAME_TITLE
          The default frame title: "Layers".
protected static Offset DEFAULT_OFFSET
          The default screen location: 20x140 pixels from the upper left screen corner.
 
Fields inherited from class gov.nasa.worldwind.util.tree.BasicTree
expandedNodes, layout, model
 
Constructor Summary
LayerTree()
          Creates a new LayerTree with an empty LayerTreeModel and the default screen location.
LayerTree(LayerTreeModel model)
          Creates a new LayerTree with the specified model and the default screen location.
LayerTree(LayerTreeModel model, Offset offset)
          Creates a new LayerTree with the specified model and the specified screen location.
LayerTree(Offset offset)
          Creates a new LayerTree with an empty LayerTreeModel and the specified screen location.
 
Method Summary
protected  TreeLayout createTreeLayout(Offset offset)
          Returns a new TreeLayout suitable for displaying the layer tree on a WorldWindow.
protected  LayerTreeModel createTreeModel()
          Returns a new LayerTreeModel.
 LayerTreeModel getModel()
          Get the tree model.
protected  void initialize(LayerTreeModel model, Offset offset)
          Initializes this tree with the specified model and offset.
 
Methods inherited from class gov.nasa.worldwind.util.tree.BasicTree
collapsePath, expandPath, getDistanceFromEye, getLayout, getNode, isNodeExpanded, isPathExpanded, makeVisible, pick, preRender, render, setLayout, setModel, togglePath
 
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage, propertyChange
 
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
 
Methods inherited from interface gov.nasa.worldwind.event.MessageListener
onMessage
 

Field Detail

DEFAULT_FRAME_IMAGE

protected static final String DEFAULT_FRAME_IMAGE
The default frame image. Appears to the left of the frame title.

See Also:
Constant Field Values

DEFAULT_FRAME_TITLE

protected static final String DEFAULT_FRAME_TITLE
The default frame title: "Layers".

See Also:
Constant Field Values

DEFAULT_OFFSET

protected static final Offset DEFAULT_OFFSET
The default screen location: 20x140 pixels from the upper left screen corner.

Constructor Detail

LayerTree

public LayerTree()
Creates a new LayerTree with an empty LayerTreeModel and the default screen location. The tree's upper left corner is placed 20x140 pixels from the upper left screen corner.


LayerTree

public LayerTree(LayerTreeModel model)
Creates a new LayerTree with the specified model and the default screen location. The tree's upper left corner is placed 20x140 pixels from the upper left screen corner.

Parameters:
model - the tree model to use.
Throws:
IllegalArgumentException - if model is null.

LayerTree

public LayerTree(LayerTreeModel model,
                 Offset offset)
Creates a new LayerTree with the specified model and the specified screen location.

Parameters:
model - the tree model to use.
offset - the screen location of the tree's upper left corner, relative to the screen's upper left corner.
Throws:
IllegalArgumentException - if model is null, or if offset is null.

LayerTree

public LayerTree(Offset offset)
Creates a new LayerTree with an empty LayerTreeModel and the specified screen location.

Parameters:
offset - the screen location of the tree's upper left corner, relative to the screen's upper left corner.
Throws:
IllegalArgumentException - if offset is null.
Method Detail

createTreeLayout

protected TreeLayout createTreeLayout(Offset offset)
Returns a new TreeLayout suitable for displaying the layer tree on a WorldWindow. If the offset is null this the default value.

Parameters:
offset - the screen location of this tree's upper left corner, or null to use the default.
Returns:
new TreeLayout.

createTreeModel

protected LayerTreeModel createTreeModel()
Returns a new LayerTreeModel. Called from initialize when no model is specified.

Returns:
a new LayerTreeModel.

getModel

public LayerTreeModel getModel()
Get the tree model. The model determines the contents of the tree.

Specified by:
getModel in interface Tree
Overrides:
getModel in class BasicTree
Returns:
the tree model.
See Also:
Tree.setModel(TreeModel)

initialize

protected void initialize(LayerTreeModel model,
                          Offset offset)
Initializes this tree with the specified model and offset. This configures the tree's model, its layout, and expands the path to the root node. If either parameter is null this uses a suitable default.

Parameters:
model - this tree's model to use, or null to create a new LayerTreeModel.
offset - the screen location of this tree's upper left corner, or null to use the default.

NASA World Wind