|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.nasa.worldwind.avlist.AVListImpl
gov.nasa.worldwind.WWObjectImpl
gov.nasa.worldwind.util.tree.BasicTreeModel
gov.nasa.worldwind.util.layertree.LayerTreeModel
public class LayerTreeModel
A tree model representing objects and their content.
LayerLayerTreeModel initializes itself with a default root node. By default, this root node is of type
BasicTreeNode and its text is "Layers". Nodes added under the tree model's root should always be of type
. a LayerTreeNodeLayerTreeNode may be of any type.
LayerTreeModel provides operations for performing the following common tasks on a layer tree: LayerList.LayerList from appearing in the tree. For example, the layer that renders the tree itself
usually should not appear in the tree. If it did then the user could turn off the tree layer and have no way of
getting it back. A layer can be marked as hidden by setting AVKey.HIDDEN to true:
hiddenLayer.setValue(AVKey.HIDDEN, true); // Prevent layer from being displayed in the layer tree
| Field Summary | |
|---|---|
protected static String |
DEFAULT_ROOT_NAME
The default root name: "Layers". |
protected boolean |
includeHiddenLayers
Indicates whether or not the tree model must include hidden layers. |
| Fields inherited from class gov.nasa.worldwind.util.tree.BasicTreeModel |
|---|
root |
| Constructor Summary | |
|---|---|
LayerTreeModel()
Creates a new LayerTreeModel with the default root node. |
|
LayerTreeModel(LayerList layerList)
Creates a new LayerTreeModel with the default root node and adds a new LayerTreeNode
for each non-hidden Layer in the specified layerList. |
|
LayerTreeModel(LayerList layerList,
boolean includeHiddenLayers)
Creates a new LayerTreeModel with the default root node and adds a new LayerTreeNode
for each Layer in the specified layerList. |
|
| Method Summary | |
|---|---|
LayerTreeNode |
addLayer(Layer layer)
Adds the a new LayerTreeNode created with the specified layer to this tree model's root
node. |
void |
addLayer(LayerTreeNode layerNode)
Adds the specified layerNode to this tree model's root node. |
protected LayerTreeNode |
createLayerNode(Layer layer)
Returns a new root LayerTreeNode for the specified layer. |
protected TreeNode |
createRootNode()
Returns a new root TreeNode for this tree model. |
protected void |
initialize()
Initializes this tree model with the default root node. |
boolean |
isIncludeHiddenLayers()
Indicates whether or not this tree model includes layers marked as hidden. |
protected boolean |
mustIncludeLayer(Layer layer)
Determines if a layer must be included in the layer tree. |
void |
refresh(LayerList layerList)
Refreshes this tree model's layer nodes with the specified layerList. |
void |
removeAllLayers()
Clears this tree model by removing all children of the root node. |
void |
setIncludeHiddenLayers(boolean includeHiddenLayers)
Specifies whether or not this tree model includes layers marked as hidden. |
| Methods inherited from class gov.nasa.worldwind.util.tree.BasicTreeModel |
|---|
getRoot, setRoot |
| 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 |
|---|
protected static final String DEFAULT_ROOT_NAME
protected boolean includeHiddenLayers
| Constructor Detail |
|---|
public LayerTreeModel()
LayerTreeModel with the default root node. Otherwise the new model is empty.
public LayerTreeModel(LayerList layerList)
LayerTreeModel with the default root node and adds a new LayerTreeNode
for each non-hidden Layer in the specified layerList. The tree will not include layers
marked as hidden.
layerList - the list of Layer objects to the new model represents.
IllegalArgumentException - if the layerList is null.
public LayerTreeModel(LayerList layerList,
boolean includeHiddenLayers)
LayerTreeModel with the default root node and adds a new LayerTreeNode
for each Layer in the specified layerList.
layerList - the list of Layer objects to the new model represents.includeHiddenLayers - if this parameter is true, layers marked as hidden will be included in
the tree. Otherwise hidden layers will not be included in the tree.
IllegalArgumentException - if the layerList is null.| Method Detail |
|---|
public LayerTreeNode addLayer(Layer layer)
LayerTreeNode created with the specified layer to this tree model's root
node. Nodes added under this tree model's root should always be of type LayerTreeNode. Note:
this method adds the layer to the tree model regardless of whether or not the layer is marked as hidden.
layer - the layer to add.
LayerTreeNode created for the specified layer.
IllegalArgumentException - if the layer is null.public void addLayer(LayerTreeNode layerNode)
layerNode to this tree model's root node. Nodes added under this tree model's
root should always be of type LayerTreeNode. Note: this method adds the layer to the tree
model regardless of whether or not the layer is marked as hidden.
layerNode - the layer node to add.
IllegalArgumentException - if the layerNode is null.protected LayerTreeNode createLayerNode(Layer layer)
LayerTreeNode for the specified layer. Called from
addLayer(Layer).
layer - the Layer to create a new LayerTreeNode for.
LayerTreeNode.protected TreeNode createRootNode()
TreeNode for this tree model. Called from initialize.
TreeNode.protected void initialize()
public boolean isIncludeHiddenLayers()
true if hidden layers are included in the tree mode. false if hidden layers are
not included.protected boolean mustIncludeLayer(Layer layer)
layer - Layer to test.
true if the layer must be included in the tree, false if the layer must not be
included.public void refresh(LayerList layerList)
layerList. Clears this tree model by
removing all children of the root node, then adds a new LayerTreeNode for each Layer in
the specified layerList. Layers marked as hidden will not be included in the tree model, unless the
includeHiddenLayers property is set to true.
layerList - the list of Layer objects to the new model represents.
IllegalArgumentException - if the layerList is null.setIncludeHiddenLayers(boolean)public void removeAllLayers()
public void setIncludeHiddenLayers(boolean includeHiddenLayers)
refresh. A layer can be marked as hidden by setting
the value for key AVKey.HIDDEN to true.
includeHiddenLayers - true if the tree model should include hidden layers. false
if the model should ignore layers marked as hidden.
|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||