Class KMLFeatureTreeNode
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.util.tree.BasicTreeNode
-
- gov.nasa.worldwind.util.layertree.KMLFeatureTreeNode
-
- All Implemented Interfaces:
AVList,MessageListener,TreeNode,WWObject,java.beans.PropertyChangeListener,java.util.EventListener
- Direct Known Subclasses:
KMLContainerTreeNode
public class KMLFeatureTreeNode extends BasicTreeNode
ATreeNodethat represents a KML feature defined by a.KMLAbstractFeatureThe node's selection state is synchronized with its KML feature's visibility state.
returns whether the node's feature is visible. CallingisSelected()specifies both the the node's selection state, and whether its feature should be enabled for rendering and selection.setSelected(boolean)
-
-
Field Summary
Fields Modifier and Type Field Description protected KMLAbstractFeaturefeatureIndicates the KML feature this node represents.-
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 KMLFeatureTreeNode(KMLAbstractFeature feature)Creates a newKMLFeatureTreeNodefrom the specifiedfeature.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexpandOpenContainers(Tree tree)Expands paths in the specifiedtreecorresponding to open KML container elements.static KMLFeatureTreeNodefromKMLFeature(KMLAbstractFeature feature)Creates a newKMLFeatureTreeNodefrom the specifiedfeature.java.lang.StringgetDescription()Get extra text associated with this node.KMLAbstractFeaturegetFeature()Indicates the KML feature this node represents.java.lang.StringgetText()Get the text of this node.protected voidinitialize()Places the KML feature in the node'sAVKey.CONTEXTfield.booleanisSelected()Indicates whether this node's KML feature is enabled for rendering.protected java.lang.StringmakeFeatureDescription()Makes this node's description text from its KML feature.protected booleanmustExpandNode()Indicates whether the tree path for this node must expanded.voidsetSelected(boolean selected)Specifies whether this node's feature is enabled for rendering and selection.protected java.lang.StringstripHtmlTags(java.lang.String input)Remove HTML tags and extra whitespace from a string.-
Methods inherited from class gov.nasa.worldwind.util.tree.BasicTreeNode
addChild, addChild, computeTreeSelected, getChildren, getImageSource, getParent, getPath, 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
-
feature
protected KMLAbstractFeature feature
Indicates the KML feature this node represents. Initialized during construction.
-
-
Constructor Detail
-
KMLFeatureTreeNode
public KMLFeatureTreeNode(KMLAbstractFeature feature)
Creates a newKMLFeatureTreeNodefrom the specifiedfeature. The node's name is set to the feature's name.- Parameters:
feature- the KML feature this node represents.- Throws:
java.lang.IllegalArgumentException- if thefeatureisnull.
-
-
Method Detail
-
initialize
protected void initialize()
Places the KML feature in the node'sAVKey.CONTEXTfield.
-
fromKMLFeature
public static KMLFeatureTreeNode fromKMLFeature(KMLAbstractFeature feature)
Creates a newKMLFeatureTreeNodefrom the specifiedfeature. This maps the feature type to a node type as follows:- KML container to
KMLContainerTreeNode. - KML network link
to
KMLNetworkLink. - All other KML features to
KMLFeatureTreeNode.
- Parameters:
feature- the KML feature to create a newKMLFeatureTreeNodefor.- Returns:
- a new
KMLFeatureTreeNode. - Throws:
java.lang.IllegalArgumentException- if thefeatureisnull.
- KML container to
-
getFeature
public KMLAbstractFeature getFeature()
Indicates the KML feature this node represents.- Returns:
- this node's KML feature.
-
isSelected
public boolean isSelected()
Indicates whether this node's KML feature is enabled for rendering.- Specified by:
isSelectedin interfaceTreeNode- Overrides:
isSelectedin classBasicTreeNode- Returns:
trueif the KML feature is enabled for rendering, otherwisefalse.- See Also:
TreeNode.setSelected(boolean),TreeNode.isTreeSelected()
-
setSelected
public void setSelected(boolean selected)
Specifies whether this node's feature is enabled for rendering and selection. This sets both the node's selection state and its KML feature's visible state.- Specified by:
setSelectedin interfaceTreeNode- Overrides:
setSelectedin classBasicTreeNode- Parameters:
selected-trueto enable the KML feature, otherwisefalse.- See Also:
TreeNode.isSelected()
-
expandOpenContainers
public void expandOpenContainers(Tree tree)
Expands paths in the specifiedtreecorresponding to open KML container elements. This assumes that thetree's model contains this node.This node's path is expanded if the feature's
openproperty istrue.This calls
expandOpenContainerson all children which are instances ofKMLFeatureTreeNode.- Parameters:
tree- theTreewho's paths should be expanded.- Throws:
java.lang.IllegalArgumentException- if thetreeis null.
-
mustExpandNode
protected boolean mustExpandNode()
Indicates whether the tree path for this node must expanded. This returntrueif the KML feature'sopenproperty istrue, andfalseotherwise.- Returns:
trueif the tree path for this node must be expanded, otherwisefalse.
-
getText
public java.lang.String getText()
Description copied from class:BasicTreeNodeGet the text of this node.- Specified by:
getTextin interfaceTreeNode- Overrides:
getTextin classBasicTreeNode- Returns:
- Node text.
-
getDescription
public java.lang.String getDescription()
Description copied from interface:TreeNodeGet extra text associated with this node.- Specified by:
getDescriptionin interfaceTreeNode- Overrides:
getDescriptionin classBasicTreeNode- Returns:
- Description of node.
-
makeFeatureDescription
protected java.lang.String makeFeatureDescription()
Makes this node's description text from its KML feature. This uses the feature'sKMLSnippetif present, or the feature'sdescriptionif there is no snippet.- Returns:
- The feature description.
-
stripHtmlTags
protected java.lang.String stripHtmlTags(java.lang.String input)
Remove HTML tags and extra whitespace from a string. Runs of whitespace will be collapsed to a single space.- Parameters:
input- Text to strip of HTML tags and extra whitespace.- Returns:
- The input string with HTML tags removed, and runs of whitespace collapsed to a single space. Returns
nullifinputisnull.
-
-