Class KMLAbstractContainer
- java.lang.Object
-
- gov.nasa.worldwind.util.xml.AbstractXMLEventParser
-
- gov.nasa.worldwind.ogc.kml.KMLAbstractObject
-
- gov.nasa.worldwind.ogc.kml.KMLAbstractFeature
-
- gov.nasa.worldwind.ogc.kml.KMLAbstractContainer
-
- All Implemented Interfaces:
MessageListener,KMLRenderable,XMLEventParser
- Direct Known Subclasses:
KMLDocument,KMLFolder,KMLNetworkLink
public class KMLAbstractContainer extends KMLAbstractFeature
Represents the KML Container element and provides access to its contents.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.ArrayList<KMLAbstractFeature>features-
Fields inherited from class gov.nasa.worldwind.ogc.kml.KMLAbstractFeature
balloon, region, styleSelectors, visibility
-
Fields inherited from class gov.nasa.worldwind.ogc.kml.KMLAbstractObject
MSG_BOX_CHANGED, MSG_GEOMETRY_CHANGED, MSG_LINK_CHANGED, MSG_STYLE_CHANGED, MSG_TIME_CHANGED, MSG_VIEW_CHANGED
-
Fields inherited from class gov.nasa.worldwind.util.xml.AbstractXMLEventParser
CHARACTERS_CONTENT, fields, namespaceURI, parent
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedKMLAbstractContainer(java.lang.String namespaceURI)Construct an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFeature(KMLAbstractFeature feature)voidapplyChange(KMLAbstractObject sourceValues)protected voidbeginRendering(KMLTraversalContext tc, DrawContext dc)Prepares this KML container for rendering.protected voiddoAddEventContent(java.lang.Object o, XMLEventParserContext ctx, javax.xml.stream.events.XMLEvent event, java.lang.Object... args)protected voiddoPreRender(KMLTraversalContext tc, DrawContext dc)Pre-renders the KML features held by thisKMLAbstractContainer.protected voiddoRender(KMLTraversalContext tc, DrawContext dc)Renders the KML features held by thisKMLAbstractContainer.protected voidendRendering(KMLTraversalContext tc, DrawContext dc)Restores any rendering state changed during rendering.java.util.List<KMLAbstractFeature>getFeatures()protected booleanisFeatureActive(KMLTraversalContext tc, DrawContext dc)Indicates whether thisKMLAbstractContaineris active and should be rendered on the specifiedDrawContext.protected voidmergeFeatures(KMLAbstractContainer sourceContainer)Merge a list of incoming features with the current list.voidonMessage(Message msg)Invoked when a message is received.protected voidpreRenderFeatures(KMLTraversalContext tc, DrawContext dc)PreRenders this KML container's list of KML features, in the order they appear in the list.voidremoveFeature(KMLAbstractFeature feature)protected voidrenderFeatures(KMLTraversalContext tc, DrawContext dc)Draws this KML container's list of KML features, in the order they appear in the list.-
Methods inherited from class gov.nasa.worldwind.ogc.kml.KMLAbstractFeature
addStyleSelector, getAddress, getAddressDetails, getAuthor, getBalloon, getDescription, getExtendedData, getLink, getName, getOpen, getPhoneNumber, getRegion, getSnippet, getSnippetText, getStyleSelectors, getStyleUrl, getSubStyle, getTimePrimitive, getView, getVisibility, hasStyle, hasStyleSelectors, mergeStyleSelectors, preRender, render, renderBalloon, setBalloon, setRegion, setTimePrimitive, setView, setVisibility
-
Methods inherited from class gov.nasa.worldwind.ogc.kml.KMLAbstractObject
getId, getRoot, getTargetId, onChange
-
Methods inherited from class gov.nasa.worldwind.util.xml.AbstractXMLEventParser
allocate, doAddCharacters, doAddEventAttribute, doParseEventAttributes, doParseEventContent, freeResources, getAConstructor, getCharacters, getField, getField, getFields, getNamespaceURI, getParent, hasField, hasField, hasFields, mergeFields, newInstance, overrideFields, parse, parseCharacterContent, removeField, setField, setField, setFields, setNamespaceURI, setParent
-
-
-
-
Field Detail
-
features
protected java.util.ArrayList<KMLAbstractFeature> features
-
-
Method Detail
-
doAddEventContent
protected void doAddEventContent(java.lang.Object o, XMLEventParserContext ctx, javax.xml.stream.events.XMLEvent event, java.lang.Object... args) throws javax.xml.stream.XMLStreamException- Overrides:
doAddEventContentin classKMLAbstractFeature- Throws:
javax.xml.stream.XMLStreamException
-
getFeatures
public java.util.List<KMLAbstractFeature> getFeatures()
-
addFeature
public void addFeature(KMLAbstractFeature feature)
-
removeFeature
public void removeFeature(KMLAbstractFeature feature)
-
isFeatureActive
protected boolean isFeatureActive(KMLTraversalContext tc, DrawContext dc)
Indicates whether thisKMLAbstractContaineris active and should be rendered on the specifiedDrawContext. This returnstrueif this container'svisibilityis unspecified (null) or is set totrue.Regions do not apply directly to KML containers, because a descendant features can override the container's Region with its own. Since a descendant Region may be larger or have a less restrictive LOD range than this container, we cannot determine the visibility of the entire tree based on this container's Region. A container's Region is inherited by any descendants that do not specify a Region, and Region visibility is determined at the leaf nodes.
- Overrides:
isFeatureActivein classKMLAbstractFeature- Parameters:
tc- the current KML traversal context. This parameter is ignored.dc- the draw context. This parameter is ignored.- Returns:
trueif this container should be rendered, otherwisefalse.
-
doPreRender
protected void doPreRender(KMLTraversalContext tc, DrawContext dc)
Pre-renders the KML features held by thisKMLAbstractContainer.Pushes this container's Region on the KML traversal context's region stack before rendering the features, and pops the Region off the stack afterward. Descendant features use the KML traversal context's region stack to inherit Regions from parent containers.
- Overrides:
doPreRenderin classKMLAbstractFeature- Parameters:
tc- the current KML traversal context.dc- the current draw context.
-
doRender
protected void doRender(KMLTraversalContext tc, DrawContext dc)
Renders the KML features held by thisKMLAbstractContainer.Pushes this container's Region on the KML traversal context's region stack before rendering the features, and pops the Region off the stack afterward. Descendant features use the KML traversal context's region stack to inherit Regions from parent containers.
- Overrides:
doRenderin classKMLAbstractFeature- Parameters:
tc- the current KML traversal context.dc- the current draw context.
-
beginRendering
protected void beginRendering(KMLTraversalContext tc, DrawContext dc)
Prepares this KML container for rendering. This pushes this container's Region on the KML traversal context's region stack. Descendant features use the KML traversal context's region stack to inherit Regions from parent containers. This must be followed by a call toendRendering.- Parameters:
tc- the current KML traversal context.dc- the current draw context.
-
endRendering
protected void endRendering(KMLTraversalContext tc, DrawContext dc)
Restores any rendering state changed during rendering. This pops this container's Region off the KML traversal context's region stack to restore the previous container's Region (if any). This must be preceded by a call tobeginRendering.- Parameters:
tc- the current KML traversal context.dc- the current draw context.
-
preRenderFeatures
protected void preRenderFeatures(KMLTraversalContext tc, DrawContext dc)
PreRenders this KML container's list of KML features, in the order they appear in the list. This does nothing if the list of features is empty.- Parameters:
tc- the current KML traversal context.dc- the current draw context.
-
renderFeatures
protected void renderFeatures(KMLTraversalContext tc, DrawContext dc)
Draws this KML container's list of KML features, in the order they appear in the list. This does nothing if the list of features is empty.- Parameters:
tc- the current KML traversal context.dc- the current draw context.
-
applyChange
public void applyChange(KMLAbstractObject sourceValues)
- Overrides:
applyChangein classKMLAbstractFeature
-
mergeFeatures
protected void mergeFeatures(KMLAbstractContainer sourceContainer)
Merge a list of incoming features with the current list. If an incoming feature has the same ID as an existing one, replace the existing one, otherwise add the incoming one.- Parameters:
sourceContainer- the incoming container of features.
-
onMessage
public void onMessage(Message msg)
Description copied from interface:MessageListenerInvoked when a message is received.- Specified by:
onMessagein interfaceMessageListener- Overrides:
onMessagein classKMLAbstractObject- Parameters:
msg- The message that was received.
-
-