NASA World Wind

gov.nasa.worldwind.render
Class UserFacingIcon

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.render.UserFacingIcon
All Implemented Interfaces:
AVList, Movable, WWIcon, Restorable
Direct Known Subclasses:
Pedestal

public class UserFacingIcon
extends AVListImpl
implements WWIcon, Movable


Field Summary
protected  BasicWWTexture backgroundTexture
           
protected  BasicWWTexture imageTexture
           
 
Constructor Summary
UserFacingIcon()
           
UserFacingIcon(Object imageSource, Position iconPosition)
           
UserFacingIcon(String iconPath, Position iconPosition)
           
 
Method Summary
 Object getBackgroundImage()
          Returns the icon's background image source, if any.
 double getBackgroundScale()
          Indicates the relative screen size of the background image, if specified.
 BasicWWTexture getBackgroundTexture()
          Returns the WWTexture used to represent the icon's background texture.
 double getHighlightScale()
          Returns the icon's highlight scale, which indicates the degree of expansion or shrinkage applied to the icon when it's drawn in its highlighted state.
 Object getImageSource()
          Returns the icon's image source.
 BasicWWTexture getImageTexture()
          Returns the WWTexture used to represent the icon.
 String getPath()
           
 Position getPosition()
          Returns the icon's geographic position.
 Position getReferencePosition()
          A position associated with the object that indicates its aggregate geographic position.
 String getRestorableState()
          Returns an XML state document String describing the public attributes of this UserFacingIcon.
 Dimension getSize()
          Returns the icon's specified screen size.
 Font getToolTipFont()
          Returns the font used to render an icon's tool tip, if any.
 Vec4 getToolTipOffset()
          Indicates the offset in screen coordinates at which to place the lower left corner of the icon tool tip's text box.
 String getToolTipText()
          Returns the icon's current tool tip text.
 Color getToolTipTextColor()
          Indicates the color in which the icon's tool tip, if any, is drawn.
 boolean isAlwaysOnTop()
          Indicates whether the icon is always to be displayed "on top" of all other ordered renderables.
 boolean isHighlighted()
          Indicates whether the icon should be drawn in its highlighted state.
 boolean isShowToolTip()
          Indicates whether the icon's tool tip, if any, is displayed with the icon.
 boolean isVisible()
          Returns the state of the visibility flag.
 void move(Position position)
          Shift the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.
 void moveTo(Position position)
          Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.
 void restoreState(String stateInXml)
          Restores publicly settable attribute values found in the specified XML state document String.
 void setAlwaysOnTop(boolean alwaysOnTop)
          Indicates whether the icon is always to be displayed "on top" of all other ordered renderables.
 void setBackgroundImage(Object background)
          Specifies the icon's background image source.
 void setBackgroundScale(double backgroundScale)
          Indicates the relative screen size of the background image, if specified.
 void setHighlighted(boolean highlighted)
          Specifies whether the icon should be drawn in its highlighted state.
 void setHighlightScale(double highlightScale)
          Specifies the relative screen size of the icon when it's highlighted.
 void setImageSource(Object imageSource)
          Specifies the source image for the icon.
 void setPosition(Position iconPosition)
          Sets the icon's geographic position.
 void setShowToolTip(boolean showToolTip)
          Indicates whether the icon's tool tip, if any, is displayed with the icon.
 void setSize(Dimension size)
          Sets the desired screen size of the icon.
 void setToolTipFont(Font toolTipFont)
          Specifies the font to use when displaying the icon's tool tip, if any.
 void setToolTipOffset(Vec4 toolTipOffset)
          Indicates the offset in screen coordinates at which to place the lower left corner of the icon tool tip's text box.
 void setToolTipText(String toolTipText)
          Specifies the text string to display as the icon's tool tip.
 void setToolTipTextColor(Color textColor)
          Specifies the color in which to display the icon's tool tip text, if any.
 void setVisible(boolean visible)
          Specifies whether the icon is drawn.
 String toString()
           
 
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 

Field Detail

backgroundTexture

protected BasicWWTexture backgroundTexture

imageTexture

protected BasicWWTexture imageTexture
Constructor Detail

UserFacingIcon

public UserFacingIcon()

UserFacingIcon

public UserFacingIcon(Object imageSource,
                      Position iconPosition)

UserFacingIcon

public UserFacingIcon(String iconPath,
                      Position iconPosition)
Method Detail

getBackgroundImage

public Object getBackgroundImage()
Description copied from interface: WWIcon
Returns the icon's background image source, if any.

Specified by:
getBackgroundImage in interface WWIcon
Returns:
the icon's background image source. The default is null.

getBackgroundScale

public double getBackgroundScale()
Description copied from interface: WWIcon
Indicates the relative screen size of the background image, if specified. The scale indicates the degree of expansion or shrinkage from the image's source size.

Specified by:
getBackgroundScale in interface WWIcon
Returns:
the background image scale.

getBackgroundTexture

public BasicWWTexture getBackgroundTexture()
Description copied from interface: WWIcon
Returns the WWTexture used to represent the icon's background texture.

Specified by:
getBackgroundTexture in interface WWIcon
Returns:
the icon's background texture.

getHighlightScale

public double getHighlightScale()
Returns the icon's highlight scale, which indicates the degree of expansion or shrinkage applied to the icon when it's drawn in its highlighted state.

Specified by:
getHighlightScale in interface WWIcon
Returns:
the icon's highlight scale. The default scale is 1.2.

getImageSource

public Object getImageSource()
Description copied from interface: WWIcon
Returns the icon's image source.

Specified by:
getImageSource in interface WWIcon
Returns:
the icon's image source.

getImageTexture

public BasicWWTexture getImageTexture()
Description copied from interface: WWIcon
Returns the WWTexture used to represent the icon.

Specified by:
getImageTexture in interface WWIcon
Returns:
the icon's texture.

getPath

public String getPath()

getPosition

public Position getPosition()
Description copied from interface: WWIcon
Returns the icon's geographic position.

Specified by:
getPosition in interface WWIcon
Returns:
the icon's geographic position.

getReferencePosition

public Position getReferencePosition()
Description copied from interface: Movable
A position associated with the object that indicates its aggregate geographic position. The chosen position varies among implementers of this interface. For objects defined by a list of positions, the reference position is typically the first position in the list. For symmetric objects the reference position is often the center of the object. In many cases the object's reference position may be explicitly specified by the application.

Specified by:
getReferencePosition in interface Movable
Returns:
the object's reference position, or null if no reference position is available.

getRestorableState

public String getRestorableState()
Returns an XML state document String describing the public attributes of this UserFacingIcon.

Specified by:
getRestorableState in interface Restorable
Returns:
XML state document string describing this UserFacingIcon.

getSize

public Dimension getSize()
Description copied from interface: WWIcon
Returns the icon's specified screen size.

Specified by:
getSize in interface WWIcon
Returns:
the icon's specified screen size. The default value is false.
See Also:
WWIcon.setSize(java.awt.Dimension)

getToolTipFont

public Font getToolTipFont()
Description copied from interface: WWIcon
Returns the font used to render an icon's tool tip, if any.

Specified by:
getToolTipFont in interface WWIcon
Returns:
the tool tip font. The default is null.

getToolTipOffset

public Vec4 getToolTipOffset()
Description copied from interface: WWIcon
Indicates the offset in screen coordinates at which to place the lower left corner of the icon tool tip's text box. If the offset is null, the tool tip is drawn at the icon's position.

Specified by:
getToolTipOffset in interface WWIcon
Returns:
the tool tip offset. The default is null.

getToolTipText

public String getToolTipText()
Description copied from interface: WWIcon
Returns the icon's current tool tip text.

Specified by:
getToolTipText in interface WWIcon
Returns:
the current tool tip text.

getToolTipTextColor

public Color getToolTipTextColor()
Description copied from interface: WWIcon
Indicates the color in which the icon's tool tip, if any, is drawn.

Specified by:
getToolTipTextColor in interface WWIcon
Returns:
the tool tip's text color. The default value is null, in which case an implementation dependent color is used.

isAlwaysOnTop

public boolean isAlwaysOnTop()
Description copied from interface: WWIcon
Indicates whether the icon is always to be displayed "on top" of all other ordered renderables.

Specified by:
isAlwaysOnTop in interface WWIcon
Returns:
true if the icon has visual priority, otherwise false, the default.

isHighlighted

public boolean isHighlighted()
Description copied from interface: WWIcon
Indicates whether the icon should be drawn in its highlighted state. The representation of the highlighted state is implementation dependent.

Specified by:
isHighlighted in interface WWIcon
Returns:
true if the icon should be rendered as highlighted, otherwise false.

isShowToolTip

public boolean isShowToolTip()
Description copied from interface: WWIcon
Indicates whether the icon's tool tip, if any, is displayed with the icon.

Specified by:
isShowToolTip in interface WWIcon
Returns:
true if the tool tip is displayed when the icon is rendered, otherwise false, the default.

isVisible

public boolean isVisible()
Description copied from interface: WWIcon
Returns the state of the visibility flag.

Specified by:
isVisible in interface WWIcon
Returns:
the visibility flag. The default value is true.

move

public void move(Position position)
Description copied from interface: Movable
Shift the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.

Specified by:
move in interface Movable
Parameters:
position - the latitude and longitude to add to the shape's reference position.

moveTo

public void moveTo(Position position)
Description copied from interface: Movable
Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.

Specified by:
moveTo in interface Movable
Parameters:
position - the new position of the shape's reference position.

restoreState

public void restoreState(String stateInXml)
Restores publicly settable attribute values found in the specified XML state document String. The document specified by stateInXml must be a well formed XML document String, or this will throw an IllegalArgumentException. Unknown structures in stateInXml are benign, because they will simply be ignored.

Specified by:
restoreState in interface Restorable
Parameters:
stateInXml - an XML document String describing a UserFacingIcon.
Throws:
IllegalArgumentException - If stateInXml is null, or if stateInXml is not a well formed XML document String.

setAlwaysOnTop

public void setAlwaysOnTop(boolean alwaysOnTop)
Description copied from interface: WWIcon
Indicates whether the icon is always to be displayed "on top" of all other ordered renderables.

Specified by:
setAlwaysOnTop in interface WWIcon
Parameters:
alwaysOnTop - true if the icon has visual priority, otherwise false, the default.

setBackgroundImage

public void setBackgroundImage(Object background)
Description copied from interface: WWIcon
Specifies the icon's background image source. If non-null, the image is displayed centered and behind the icon.

Specified by:
setBackgroundImage in interface WWIcon
Parameters:
background - the background image source. The default is null.

setBackgroundScale

public void setBackgroundScale(double backgroundScale)
Description copied from interface: WWIcon
Indicates the relative screen size of the background image, if specified. The scale indicates the degree of expansion or shrinkage from the image's source size.

Specified by:
setBackgroundScale in interface WWIcon
Parameters:
backgroundScale - the background image scale.

setHighlighted

public void setHighlighted(boolean highlighted)
Description copied from interface: WWIcon
Specifies whether the icon should be drawn in its highlighted state. The representation of the highlighted state is implementation dependent.

Specified by:
setHighlighted in interface WWIcon
Parameters:
highlighted - true if the icon should be rendered as highlighted, otherwise false.

setHighlightScale

public void setHighlightScale(double highlightScale)
Description copied from interface: WWIcon
Specifies the relative screen size of the icon when it's highlighted. The scale indicates the degree of expansion or shrinkage from the icon's base size.

Specified by:
setHighlightScale in interface WWIcon
Parameters:
highlightScale - the highlight scale.

setImageSource

public void setImageSource(Object imageSource)
Description copied from interface: WWIcon
Specifies the source image for the icon. Implementations of this interface determine the allowed source types, but generally allow at least a String file path and a BufferedImage.

Specified by:
setImageSource in interface WWIcon
Parameters:
imageSource - the image source.

setPosition

public void setPosition(Position iconPosition)
Description copied from interface: WWIcon
Sets the icon's geographic position.

Specified by:
setPosition in interface WWIcon
Parameters:
iconPosition - the icon's geographic position. May be null to indicate that the icon has no current position and therefore should not be displayed.

setShowToolTip

public void setShowToolTip(boolean showToolTip)
Description copied from interface: WWIcon
Indicates whether the icon's tool tip, if any, is displayed with the icon.

Specified by:
setShowToolTip in interface WWIcon
Parameters:
showToolTip - true if the tool tip is displayed when the icon is rendered, otherwise false, the default.

setSize

public void setSize(Dimension size)
Description copied from interface: WWIcon
Sets the desired screen size of the icon. When rendered, the icon is scaled to this size if it's specified. If a screen size is not specified, the icon is displayed at the size of its source image.

This size is not related to the icon's image source size. Whatever the source size is, it's scaled to display at the specified screen size, if any.

Specified by:
setSize in interface WWIcon
Parameters:
size - the desired screen size, or null if the icon should be displayed at its source image size.

setToolTipFont

public void setToolTipFont(Font toolTipFont)
Description copied from interface: WWIcon
Specifies the font to use when displaying the icon's tool tip, if any.

Specified by:
setToolTipFont in interface WWIcon
Parameters:
toolTipFont - the tool tip font. If null, an implementation dependent font is used.

setToolTipOffset

public void setToolTipOffset(Vec4 toolTipOffset)
Description copied from interface: WWIcon
Indicates the offset in screen coordinates at which to place the lower left corner of the icon tool tip's text box. If the offset is null, the tool tip is drawn at the icon's position.

Specified by:
setToolTipOffset in interface WWIcon
Parameters:
toolTipOffset - the tool tip offset. The default is null.

setToolTipText

public void setToolTipText(String toolTipText)
Description copied from interface: WWIcon
Specifies the text string to display as the icon's tool tip.

Specified by:
setToolTipText in interface WWIcon
Parameters:
toolTipText - the tool tip text. May be null, the default, to indicate no tool tip is displaye.

setToolTipTextColor

public void setToolTipTextColor(Color textColor)
Description copied from interface: WWIcon
Specifies the color in which to display the icon's tool tip text, if any.

Specified by:
setToolTipTextColor in interface WWIcon
Parameters:
textColor - the tool tip text color. The default is null, in which case an implementation dependent color is used.

setVisible

public void setVisible(boolean visible)
Description copied from interface: WWIcon
Specifies whether the icon is drawn.

Specified by:
setVisible in interface WWIcon
Parameters:
visible - true if the icon is drawn, otherwise false. The default is true.

toString

public String toString()
Overrides:
toString in class Object

NASA World Wind