NASA World Wind

gov.nasa.worldwind.ogc.kml
Class KMLStyleMap

java.lang.Object
  extended by gov.nasa.worldwind.util.xml.AbstractXMLEventParser
      extended by gov.nasa.worldwind.ogc.kml.KMLAbstractObject
          extended by gov.nasa.worldwind.ogc.kml.KMLAbstractStyleSelector
              extended by gov.nasa.worldwind.ogc.kml.KMLStyleMap
All Implemented Interfaces:
MessageListener, XMLEventParser

public class KMLStyleMap
extends KMLAbstractStyleSelector

Represents the KML StyleMap element and provides access to its contents.


Field Summary
protected  List<KMLPair> pairs
           
 
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
KMLStyleMap(String namespaceURI)
          Construct an instance.
 
Method Summary
protected  void addPair(KMLPair pair)
           
 void applyChange(KMLAbstractObject sourceValues)
           
protected  void doAddEventContent(Object o, XMLEventParserContext ctx, XMLEvent event, Object... args)
           
 List<KMLPair> getPairs()
           
 KMLAbstractStyleSelector getStyleFromMap(String styleState)
          Returns a specified style from the style map.
 KMLStyleUrl getStyleUrlFromMap(String styleState)
          Returns a specified style URL from the style map.
protected  void mergePairs(KMLStyleMap sourceMap)
          Merge a list of incoming pairs with the current list.
 KMLAbstractSubStyle mergeSubStyles(KMLAbstractSubStyle subStyle, String styleState)
          Obtains the map's effective style for a specified style type (IconStyle, ListStyle, etc.) and state (normal or highlight).
 
Methods inherited from class gov.nasa.worldwind.ogc.kml.KMLAbstractStyleSelector
markUnresolved, mergeSubStyles, mergeSubStyles
 
Methods inherited from class gov.nasa.worldwind.ogc.kml.KMLAbstractObject
getId, getRoot, getTargetId, onChange, onMessage
 
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, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pairs

protected List<KMLPair> pairs
Constructor Detail

KMLStyleMap

public KMLStyleMap(String namespaceURI)
Construct an instance.

Parameters:
namespaceURI - the qualifying namespace URI. May be null to indicate no namespace qualification.
Method Detail

addPair

protected void addPair(KMLPair pair)

applyChange

public void applyChange(KMLAbstractObject sourceValues)
Overrides:
applyChange in class KMLAbstractObject

doAddEventContent

protected void doAddEventContent(Object o,
                                 XMLEventParserContext ctx,
                                 XMLEvent event,
                                 Object... args)
                          throws XMLStreamException
Overrides:
doAddEventContent in class AbstractXMLEventParser
Throws:
XMLStreamException

getPairs

public List<KMLPair> getPairs()

getStyleFromMap

public KMLAbstractStyleSelector getStyleFromMap(String styleState)
Returns a specified style from the style map.

Parameters:
styleState - the style key, either KMLConstants.NORMAL or KMLConstants.HIGHLIGHT. If null, KMLConstants.NORMAL is used.
Returns:
the requested style, or null if it does not exist in the map.

getStyleUrlFromMap

public KMLStyleUrl getStyleUrlFromMap(String styleState)
Returns a specified style URL from the style map.

Parameters:
styleState - the style key, either KMLConstants.NORMAL or KMLConstants.HIGHLIGHT. If null, KMLConstants.NORMAL is used.
Returns:
the requested style URL, or null if it does not exist in the map.

mergePairs

protected void mergePairs(KMLStyleMap sourceMap)
Merge a list of incoming pairs with the current list. If an incoming pair has the same ID as an existing one, replace the existing one, otherwise just add the incoming one.

Parameters:
sourceMap - the incoming pairs.

mergeSubStyles

public KMLAbstractSubStyle mergeSubStyles(KMLAbstractSubStyle subStyle,
                                          String styleState)
Obtains the map's effective style for a specified style type (IconStyle, ListStyle, etc.) and state (normal or highlight). The returned style is the result of merging values from the map's style selectors and style URL for the indicated sub-style type, with precedence given to style selectors.

Remote styleUrls that have not yet been resolved are not included in the result. In this case the returned sub-style is marked with the value AVKey.UNRESOLVED.

Parameters:
styleState - the style mode, either \"normal\" or \"highlight\".
subStyle - an instance of the KMLAbstractSubStyle class desired, such as KMLIconStyle. The effective style values are accumulated and merged into this instance. The instance should not be one from within the KML document because its values may be overridden and augmented. The instance specified is the return value of this method.
Returns:
the sub-style values for the specified type and state. The reference returned is the same one passed in as the subStyle argument.

NASA World Wind