Package gov.nasa.worldwind.ogc.kml
Class KMLAbstractStyleSelector
- java.lang.Object
-
- gov.nasa.worldwind.util.xml.AbstractXMLEventParser
-
- gov.nasa.worldwind.ogc.kml.KMLAbstractObject
-
- 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
Constructors Modifier Constructor Description protected
KMLAbstractStyleSelector(java.lang.String namespaceURI)
Construct an instance.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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, java.lang.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, java.util.List<KMLAbstractStyleSelector> styleSelectors, java.lang.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, setNamespaceURI, setParent
-
-
-
-
Method Detail
-
mergeSubStyles
public static KMLAbstractSubStyle mergeSubStyles(KMLStyleUrl styleUrl, java.util.List<KMLAbstractStyleSelector> styleSelectors, java.lang.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 ofKMLAbstractStyleSelector
s to consider when determining the effective attributes. May be null, in which case only the specifiedstyleUrl
is considered.styleState
- the style mode, either \"normal\" or \"highlight\".subStyle
- an instance of theKMLAbstractSubStyle
class desired, such asKMLIconStyle
. 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:
java.lang.IllegalArgumentException
- if the sub-style parameter is null.
-
mergeSubStyles
public static KMLAbstractSubStyle mergeSubStyles(KMLStyleUrl styleUrl, KMLAbstractStyleSelector styleSelector, java.lang.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
- theKMLAbstractStyleSelector
to consider when determining the effective attributes. May be null, in which case only the specifiedstyleUrl
is considered.styleState
- the style mode, either \"normal\" or \"highlight\".subStyle
- an instance of theKMLAbstractSubStyle
class desired, such asKMLIconStyle
. 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:
java.lang.IllegalArgumentException
- if the sub-style parameter is null.
-
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.
-
-