Class LayerTree
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.util.tree.BasicTree
-
- gov.nasa.worldwind.util.layertree.LayerTree
-
- All Implemented Interfaces:
AVList,MessageListener,OrderedRenderable,PreRenderable,Renderable,Tree,WWObject,java.beans.PropertyChangeListener,java.util.EventListener
public class LayerTree extends BasicTree
ARenderabletree ofobjects and their content. By default, aLayerLayerTreeis created with a, and aLayerTreeModelthat is configured for displaying a layer tree. Callers can specify the model to use either by specifying one during construction, or by callingBasicTreeLayout. Once created, callers add layers to the tree using methods onBasicTree.setModel(gov.nasa.worldwind.util.tree.TreeModel)LayerTreeModel.- See Also:
LayerTreeModel,LayerTreeNode
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringDEFAULT_FRAME_IMAGEThe default frame image.protected static java.lang.StringDEFAULT_FRAME_TITLEThe default frame title: "Layers".protected static OffsetDEFAULT_OFFSETThe 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
Constructors Constructor Description LayerTree()Creates a newLayerTreewith an emptyLayerTreeModeland the default screen location.LayerTree(Offset offset)Creates a newLayerTreewith an emptyLayerTreeModeland the specified screen location.LayerTree(LayerTreeModel model)Creates a newLayerTreewith the specifiedmodeland the default screen location.LayerTree(LayerTreeModel model, Offset offset)Creates a newLayerTreewith the specifiedmodeland the specified screen location.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TreeLayoutcreateTreeLayout(Offset offset)Returns a newTreeLayoutsuitable for displaying the layer tree on aWorldWindow.protected LayerTreeModelcreateTreeModel()Returns a newLayerTreeModel.LayerTreeModelgetModel()Get the tree model.protected voidinitialize(LayerTreeModel model, Offset offset)Initializes this tree with the specifiedmodelandoffset.-
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, 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 gov.nasa.worldwind.event.MessageListener
onMessage
-
-
-
-
Field Detail
-
DEFAULT_OFFSET
protected static final Offset DEFAULT_OFFSET
The default screen location: 20x140 pixels from the upper left screen corner.
-
DEFAULT_FRAME_IMAGE
protected static final java.lang.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 java.lang.String DEFAULT_FRAME_TITLE
The default frame title: "Layers".- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LayerTree
public LayerTree()
Creates a newLayerTreewith an emptyLayerTreeModeland 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 newLayerTreewith the specifiedmodeland 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:
java.lang.IllegalArgumentException- ifmodelisnull.
-
LayerTree
public LayerTree(Offset offset)
Creates a newLayerTreewith an emptyLayerTreeModeland 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:
java.lang.IllegalArgumentException- ifoffsetisnull.
-
LayerTree
public LayerTree(LayerTreeModel model, Offset offset)
Creates a newLayerTreewith the specifiedmodeland 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:
java.lang.IllegalArgumentException- ifmodelisnull, or ifoffsetisnull.
-
-
Method Detail
-
initialize
protected void initialize(LayerTreeModel model, Offset offset)
Initializes this tree with the specifiedmodelandoffset. This configures the tree's model, its layout, and expands the path to the root node. If either parameter isnullthis uses a suitable default.- Parameters:
model- this tree's model to use, ornullto create a newLayerTreeModel.offset- the screen location of this tree's upper left corner, ornullto use the default.
-
createTreeModel
protected LayerTreeModel createTreeModel()
Returns a newLayerTreeModel. Called frominitializewhen no model is specified.- Returns:
- a new
LayerTreeModel.
-
createTreeLayout
protected TreeLayout createTreeLayout(Offset offset)
Returns a newTreeLayoutsuitable for displaying the layer tree on aWorldWindow. If theoffsetisnullthis the default value.- Parameters:
offset- the screen location of this tree's upper left corner, ornullto use the default.- Returns:
- new
TreeLayout.
-
getModel
public LayerTreeModel getModel()
Get the tree model. The model determines the contents of the tree.- Specified by:
getModelin interfaceTree- Overrides:
getModelin classBasicTree- Returns:
- the tree model.
- See Also:
Tree.setModel(TreeModel)
-
-