Class KMLLayerTreeNode
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.util.tree.BasicTreeNode
-
- gov.nasa.worldwind.util.layertree.LayerTreeNode
-
- gov.nasa.worldwind.util.layertree.KMLLayerTreeNode
-
- All Implemented Interfaces:
AVList
,MessageListener
,TreeNode
,WWObject
,java.beans.PropertyChangeListener
,java.util.EventListener
public class KMLLayerTreeNode extends LayerTreeNode
ALayerTreeNode
that represents a KML feature hierarchy defined by a
.KMLRoot
- See Also:
KMLFeatureTreeNode
-
-
Field Summary
Fields Modifier and Type Field Description protected KMLRoot
kmlRoot
Indicates the KML feature hierarchy this node represents.-
Fields inherited from class gov.nasa.worldwind.util.layertree.LayerTreeNode
DEFAULT_IMAGE, layer
-
Fields inherited from class gov.nasa.worldwind.util.tree.BasicTreeNode
children, description, enabled, imageSource, parent, selected, text, texture, treeSelected, visible
-
Fields inherited from interface gov.nasa.worldwind.util.tree.TreeNode
NOT_SELECTED, PARTIALLY_SELECTED, SELECTED
-
-
Constructor Summary
Constructors Constructor Description KMLLayerTreeNode(Layer layer, KMLRoot kmlRoot)
Creates a newKMLLayerTreeNode
from the specifiedlayer
andkmlRoot
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addChildFeatures()
Adds a newKMLFeatureTreeNode
to this node for each KML feature in theKMLRoot
.protected void
addFeatureNode(KMLAbstractFeature feature)
Adds the a newKMLFeatureTreeNode
created with the specifiedfeature
to this node.void
expandOpenContainers(Tree tree)
Expands paths in the specifiedtree
corresponding to open KML container elements.protected boolean
mustExpandNode()
Indicates whether the tree path for this node must expanded.protected void
refresh()
Refresh the tree model to match the contents of the KML document.void
setSelected(boolean selected)
Specifies whether this node's layer is enabled for rendering.-
Methods inherited from class gov.nasa.worldwind.util.layertree.LayerTreeNode
initialize, isSelected
-
Methods inherited from class gov.nasa.worldwind.util.tree.BasicTreeNode
addChild, addChild, computeTreeSelected, getChildren, getDescription, getImageSource, getParent, getPath, getText, getTexture, hasImage, initializeTexture, isEnabled, isLeaf, isTreeSelected, isVisible, propertyChange, removeAllChildren, removeChild, setDescription, setEnabled, setImageSource, setParent, setVisible
-
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage
-
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
-
kmlRoot
protected KMLRoot kmlRoot
Indicates the KML feature hierarchy this node represents. Initialized during construction.
-
-
Constructor Detail
-
KMLLayerTreeNode
public KMLLayerTreeNode(Layer layer, KMLRoot kmlRoot)
Creates a newKMLLayerTreeNode
from the specifiedlayer
andkmlRoot
. The node's name is set to the layer's name, and the node's hierarchy is populated from the feature hierarchy of theKMLRoot
.- Parameters:
layer
- theLayer
thekmlRoot
corresponds to.kmlRoot
- the KML feature hierarchy this node represents.- Throws:
java.lang.IllegalArgumentException
- if thelayer
isnull
, or ifkmlRoot
isnull
.
-
-
Method Detail
-
setSelected
public void setSelected(boolean selected)
Specifies whether this node's layer is enabled for rendering. If the KMLRoot's feature is a container (Document or Folder), this method sets the visibility of that container as well as the node that represents the layer.- Specified by:
setSelected
in interfaceTreeNode
- Overrides:
setSelected
in classLayerTreeNode
- Parameters:
selected
-true
to enable the layer, otherwisefalse
.- See Also:
TreeNode.isSelected()
-
addChildFeatures
protected void addChildFeatures()
Adds a newKMLFeatureTreeNode
to this node for each KML feature in theKMLRoot
.If the
KMLRoot
's top level feature is aDocument
orFolder
, this method ignores this container and adds its children directly to this node. Creating a node for the container adds an extra level to the tree node that doesn't provide any meaningful grouping.This does nothing if the
KMLRoot
's top level feature isnull
.
-
addFeatureNode
protected void addFeatureNode(KMLAbstractFeature feature)
Adds the a newKMLFeatureTreeNode
created with the specifiedfeature
to this node.- Parameters:
feature
- the KML feature to add.
-
expandOpenContainers
public void expandOpenContainers(Tree tree)
Expands paths in the specifiedtree
corresponding to open KML container elements. This assumes that thetree
's model contains this node.This node's path is expanded if it's top level KML feature is an open KML container, an open KML network link, or is any other kind of KML feature.
This calls
expandOpenContainers
on all children which are instances ofKMLFeatureTreeNode
.- Parameters:
tree
- theTree
who's paths should be expanded.- Throws:
java.lang.IllegalArgumentException
- if thetree
is null.
-
mustExpandNode
protected boolean mustExpandNode()
Indicates whether the tree path for this node must expanded. If theKMLRoot
's feature is a KML container or a KML network link, this returns whether that KML element'sopen
property istrue
. Otherwise this returnstrue
- Returns:
true
if the tree path for this node must be expanded, otherwisefalse
.
-
refresh
protected void refresh()
Refresh the tree model to match the contents of the KML document.
-
-