NASA World Wind

gov.nasa.worldwind.ogc.kml
Class KMLAbstractStyleSelector

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
All Implemented Interfaces:
MessageListener, XMLEventParser
Direct Known Subclasses:
KMLStyle, KMLStyleMap

public abstract class KMLAbstractStyleSelector
extends KMLAbstractObject

Represents the KML StyleSelector element.


Field Summary
 
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
protected KMLAbstractStyleSelector(String namespaceURI)
          Construct an instance.
 
Method Summary
protected static void markUnresolved(boolean tf, KMLAbstractSubStyle subStyle)
          Marks a sub-style to indicate that a style URL associated with it has not yet been resolved, or removes the mark if the style URL has been resolved.
static KMLAbstractSubStyle mergeSubStyles(KMLStyleUrl styleUrl, KMLAbstractStyleSelector styleSelector, String styleState, KMLAbstractSubStyle subStyle)
          Obtains the selector's effective style for a specified style type (IconStyle, ListStyle, etc.) and state (normal or highlight).
static KMLAbstractSubStyle mergeSubStyles(KMLStyleUrl styleUrl, List<KMLAbstractStyleSelector> styleSelectors, String styleState, KMLAbstractSubStyle subStyle)
          Obtains the selector'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.KMLAbstractObject
applyChange, getId, getRoot, getTargetId, onChange, onMessage
 
Methods inherited from class gov.nasa.worldwind.util.xml.AbstractXMLEventParser
allocate, doAddCharacters, doAddEventAttribute, doAddEventContent, 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
 

Constructor Detail

KMLAbstractStyleSelector

protected KMLAbstractStyleSelector(String namespaceURI)
Construct an instance.

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

markUnresolved

protected static void markUnresolved(boolean tf,
                                     KMLAbstractSubStyle subStyle)
Marks a sub-style to indicate that a style URL associated with it has not yet been resolved, or removes the mark if the style URL has been resolved.

Parameters:
tf - true to indicate an unresolved style URL, otherwise false.
subStyle - the sub-style to mark.

mergeSubStyles

public static KMLAbstractSubStyle mergeSubStyles(KMLStyleUrl styleUrl,
                                                 KMLAbstractStyleSelector styleSelector,
                                                 String styleState,
                                                 KMLAbstractSubStyle subStyle)
Obtains the selector'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 specified style selector and style URL, with precedence given to style selector.

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:
styleUrl - an applicable style URL. May be null.
styleSelector - the KMLAbstractStyleSelector to consider when determining the effective attributes. May be null, in which case only the specified styleUrl is considered.
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 parameter.
Throws:
IllegalArgumentException - if the sub-style parameter is null.

mergeSubStyles

public static KMLAbstractSubStyle mergeSubStyles(KMLStyleUrl styleUrl,
                                                 List<KMLAbstractStyleSelector> styleSelectors,
                                                 String styleState,
                                                 KMLAbstractSubStyle subStyle)
Obtains the selector'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 specified style selectors and style URL, 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 a field named AVKey.UNRESOLVED. The same is true when a StyleMap refers to a Style other than one internal to the KML document.

Parameters:
styleUrl - an applicable style URL. May be null.
styleSelectors - a list of KMLAbstractStyleSelectors to consider when determining the effective attributes. May be null, in which case only the specified styleUrl is considered.
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.
Throws:
IllegalArgumentException - if the sub-style parameter is null.

NASA World Wind