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 protected
KMLAbstractContainer(java.lang.String namespaceURI)
Construct an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFeature(KMLAbstractFeature feature)
void
applyChange(KMLAbstractObject sourceValues)
protected void
beginRendering(KMLTraversalContext tc, DrawContext dc)
Prepares this KML container for rendering.protected void
doAddEventContent(java.lang.Object o, XMLEventParserContext ctx, javax.xml.stream.events.XMLEvent event, java.lang.Object... args)
protected void
doPreRender(KMLTraversalContext tc, DrawContext dc)
Pre-renders the KML features held by thisKMLAbstractContainer
.protected void
doRender(KMLTraversalContext tc, DrawContext dc)
Renders the KML features held by thisKMLAbstractContainer
.protected void
endRendering(KMLTraversalContext tc, DrawContext dc)
Restores any rendering state changed during rendering.java.util.List<KMLAbstractFeature>
getFeatures()
protected boolean
isFeatureActive(KMLTraversalContext tc, DrawContext dc)
Indicates whether thisKMLAbstractContainer
is active and should be rendered on the specifiedDrawContext
.protected void
mergeFeatures(KMLAbstractContainer sourceContainer)
Merge a list of incoming features with the current list.void
onMessage(Message msg)
Invoked when a message is received.protected void
preRenderFeatures(KMLTraversalContext tc, DrawContext dc)
PreRenders this KML container's list of KML features, in the order they appear in the list.void
removeFeature(KMLAbstractFeature feature)
protected void
renderFeatures(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:
doAddEventContent
in 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 thisKMLAbstractContainer
is active and should be rendered on the specifiedDrawContext
. This returnstrue
if this container'svisibility
is 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:
isFeatureActive
in classKMLAbstractFeature
- Parameters:
tc
- the current KML traversal context. This parameter is ignored.dc
- the draw context. This parameter is ignored.- Returns:
true
if 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:
doPreRender
in 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:
doRender
in 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:
applyChange
in 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:MessageListener
Invoked when a message is received.- Specified by:
onMessage
in interfaceMessageListener
- Overrides:
onMessage
in classKMLAbstractObject
- Parameters:
msg
- The message that was received.
-
-