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
ARenderable
tree of
objects and their content. By default, aLayer
LayerTree
is created with a
, and aLayerTreeModel
that 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.String
DEFAULT_FRAME_IMAGE
The default frame image.protected static java.lang.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
Constructors Constructor Description LayerTree()
Creates a newLayerTree
with an emptyLayerTreeModel
and the default screen location.LayerTree(Offset offset)
Creates a newLayerTree
with an emptyLayerTreeModel
and the specified screen location.LayerTree(LayerTreeModel model)
Creates a newLayerTree
with the specifiedmodel
and the default screen location.LayerTree(LayerTreeModel model, Offset offset)
Creates a newLayerTree
with the specifiedmodel
and the specified screen location.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TreeLayout
createTreeLayout(Offset offset)
Returns a newTreeLayout
suitable for displaying the layer tree on aWorldWindow
.protected LayerTreeModel
createTreeModel()
Returns a newLayerTreeModel
.LayerTreeModel
getModel()
Get the tree model.protected void
initialize(LayerTreeModel model, Offset offset)
Initializes this tree with the specifiedmodel
andoffset
.-
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 newLayerTree
with an emptyLayerTreeModel
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 newLayerTree
with the specifiedmodel
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:
java.lang.IllegalArgumentException
- ifmodel
isnull
.
-
LayerTree
public LayerTree(Offset offset)
Creates a newLayerTree
with an emptyLayerTreeModel
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:
java.lang.IllegalArgumentException
- ifoffset
isnull
.
-
LayerTree
public LayerTree(LayerTreeModel model, Offset offset)
Creates a newLayerTree
with the specifiedmodel
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:
java.lang.IllegalArgumentException
- ifmodel
isnull
, or ifoffset
isnull
.
-
-
Method Detail
-
initialize
protected void initialize(LayerTreeModel model, Offset offset)
Initializes this tree with the specifiedmodel
andoffset
. This configures the tree's model, its layout, and expands the path to the root node. If either parameter isnull
this uses a suitable default.- Parameters:
model
- this tree's model to use, ornull
to create a newLayerTreeModel
.offset
- the screen location of this tree's upper left corner, ornull
to use the default.
-
createTreeModel
protected LayerTreeModel createTreeModel()
Returns a newLayerTreeModel
. Called frominitialize
when no model is specified.- Returns:
- a new
LayerTreeModel
.
-
createTreeLayout
protected TreeLayout createTreeLayout(Offset offset)
Returns a newTreeLayout
suitable for displaying the layer tree on aWorldWindow
. If theoffset
isnull
this the default value.- Parameters:
offset
- the screen location of this tree's upper left corner, ornull
to use the default.- Returns:
- new
TreeLayout
.
-
getModel
public LayerTreeModel getModel()
Get the tree model. The model determines the contents of the tree.- Specified by:
getModel
in interfaceTree
- Overrides:
getModel
in classBasicTree
- Returns:
- the tree model.
- See Also:
Tree.setModel(TreeModel)
-
-