Package gov.nasa.worldwind.render
Class UserFacingIcon
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.render.UserFacingIcon
-
- All Implemented Interfaces:
AVList
,Draggable
,Movable
,WWIcon
,Restorable
- Direct Known Subclasses:
Pedestal
public class UserFacingIcon extends AVListImpl implements WWIcon, Movable, Draggable
-
-
Field Summary
Fields Modifier and Type Field Description protected BasicWWTexture
backgroundTexture
protected boolean
dragEnabled
protected DraggableSupport
draggableSupport
protected BasicWWTexture
imageTexture
-
Constructor Summary
Constructors Constructor Description UserFacingIcon()
UserFacingIcon(java.lang.Object imageSource, Position iconPosition)
UserFacingIcon(java.lang.String iconPath, Position iconPosition)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doDrag(DragContext dragContext)
void
drag(DragContext dragContext)
Drag the object given the providedDragContext
.java.lang.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 theWWTexture
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.java.lang.Object
getImageSource()
Returns the icon's image source.BasicWWTexture
getImageTexture()
Returns theWWTexture
used to represent the icon.java.lang.String
getPath()
Position
getPosition()
Returns the icon's geographic position.Position
getReferencePosition()
A position associated with the object that indicates its aggregate geographic position.java.lang.String
getRestorableState()
Returns an XML state document String describing the public attributes of this UserFacingIcon.java.awt.Dimension
getSize()
Returns the icon's specified screen size.java.awt.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.java.lang.String
getToolTipText()
Returns the icon's current tool tip text.java.awt.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
isDragEnabled()
Indicates whether the object is enabled for dragging.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(java.lang.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(java.lang.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
setDragEnabled(boolean enabled)
Controls whether the object is enabled for dragging.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(java.lang.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(java.awt.Dimension size)
Sets the desired screen size of the icon.void
setToolTipFont(java.awt.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(java.lang.String toolTipText)
Specifies the text string to display as the icon's tool tip.void
setToolTipTextColor(java.awt.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.java.lang.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, 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
-
imageTexture
protected BasicWWTexture imageTexture
-
backgroundTexture
protected BasicWWTexture backgroundTexture
-
dragEnabled
protected boolean dragEnabled
-
draggableSupport
protected DraggableSupport draggableSupport
-
-
Method Detail
-
getImageTexture
public BasicWWTexture getImageTexture()
Description copied from interface:WWIcon
Returns theWWTexture
used to represent the icon.- Specified by:
getImageTexture
in interfaceWWIcon
- Returns:
- the icon's texture.
-
getBackgroundTexture
public BasicWWTexture getBackgroundTexture()
Description copied from interface:WWIcon
Returns theWWTexture
used to represent the icon's background texture.- Specified by:
getBackgroundTexture
in interfaceWWIcon
- Returns:
- the icon's background texture.
-
getImageSource
public java.lang.Object getImageSource()
Description copied from interface:WWIcon
Returns the icon's image source.- Specified by:
getImageSource
in interfaceWWIcon
- Returns:
- the icon's image source.
-
setImageSource
public void setImageSource(java.lang.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 aString
file path and aBufferedImage
.- Specified by:
setImageSource
in interfaceWWIcon
- Parameters:
imageSource
- the image source.
-
getPath
public java.lang.String getPath()
-
getPosition
public Position getPosition()
Description copied from interface:WWIcon
Returns the icon's geographic position.- Specified by:
getPosition
in interfaceWWIcon
- Returns:
- the icon's geographic position.
-
setPosition
public void setPosition(Position iconPosition)
Description copied from interface:WWIcon
Sets the icon's geographic position.- Specified by:
setPosition
in interfaceWWIcon
- 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.
-
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 interfaceWWIcon
- Returns:
- true if the icon should be rendered as highlighted, otherwise false.
-
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 interfaceWWIcon
- Parameters:
highlighted
- true if the icon should be rendered as highlighted, otherwise false.
-
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 interfaceWWIcon
- Returns:
- the icon's highlight scale. The default scale is 1.2.
-
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 interfaceWWIcon
- Parameters:
highlightScale
- the highlight scale.
-
getSize
public java.awt.Dimension getSize()
Description copied from interface:WWIcon
Returns the icon's specified screen size.- Specified by:
getSize
in interfaceWWIcon
- Returns:
- the icon's specified screen size. The default value is false.
- See Also:
WWIcon.setSize(java.awt.Dimension)
-
setSize
public void setSize(java.awt.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.
-
isVisible
public boolean isVisible()
Description copied from interface:WWIcon
Returns the state of the visibility flag.
-
setVisible
public void setVisible(boolean visible)
Description copied from interface:WWIcon
Specifies whether the icon is drawn.- Specified by:
setVisible
in interfaceWWIcon
- Parameters:
visible
- true if the icon is drawn, otherwise false. The default is true.
-
getToolTipText
public java.lang.String getToolTipText()
Description copied from interface:WWIcon
Returns the icon's current tool tip text.- Specified by:
getToolTipText
in interfaceWWIcon
- Returns:
- the current tool tip text.
-
setToolTipText
public void setToolTipText(java.lang.String toolTipText)
Description copied from interface:WWIcon
Specifies the text string to display as the icon's tool tip.- Specified by:
setToolTipText
in interfaceWWIcon
- Parameters:
toolTipText
- the tool tip text. May be null, the default, to indicate no tool tip is displaye.
-
getToolTipFont
public java.awt.Font getToolTipFont()
Description copied from interface:WWIcon
Returns the font used to render an icon's tool tip, if any.- Specified by:
getToolTipFont
in interfaceWWIcon
- Returns:
- the tool tip font. The default is null.
-
setToolTipFont
public void setToolTipFont(java.awt.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 interfaceWWIcon
- Parameters:
toolTipFont
- the tool tip font. If null, an implementation dependent font is used.
-
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 interfaceWWIcon
- Returns:
- the tool tip offset. The default is null.
-
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 interfaceWWIcon
- Parameters:
toolTipOffset
- the tool tip offset. The default is null.
-
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 interfaceWWIcon
- Returns:
- true if the tool tip is displayed when the icon is rendered, otherwise false, the default.
-
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 interfaceWWIcon
- Parameters:
showToolTip
- true if the tool tip is displayed when the icon is rendered, otherwise false, the default.
-
getToolTipTextColor
public java.awt.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 interfaceWWIcon
- Returns:
- the tool tip's text color. The default value is null, in which case an implementation dependent color is used.
-
setToolTipTextColor
public void setToolTipTextColor(java.awt.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 interfaceWWIcon
- Parameters:
textColor
- the tool tip text color. The default 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 interfaceWWIcon
- Returns:
- true if the icon has visual priority, otherwise false, the default.
-
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 interfaceWWIcon
- Parameters:
alwaysOnTop
- true if the icon has visual priority, otherwise false, the default.
-
getBackgroundImage
public java.lang.Object getBackgroundImage()
Description copied from interface:WWIcon
Returns the icon's background image source, if any.- Specified by:
getBackgroundImage
in interfaceWWIcon
- Returns:
- the icon's background image source. The default is null.
-
setBackgroundImage
public void setBackgroundImage(java.lang.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 interfaceWWIcon
- Parameters:
background
- the 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 interfaceWWIcon
- Returns:
- the background image scale.
-
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 interfaceWWIcon
- Parameters:
backgroundScale
- the background image scale.
-
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.
-
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.
-
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 interfaceMovable
- Returns:
- the object's reference position, or null if no reference position is available.
-
isDragEnabled
public boolean isDragEnabled()
Description copied from interface:Draggable
Indicates whether the object is enabled for dragging.- Specified by:
isDragEnabled
in interfaceDraggable
- Returns:
- true if the object is enabled, else false.
-
setDragEnabled
public void setDragEnabled(boolean enabled)
Description copied from interface:Draggable
Controls whether the object is enabled for dragging.- Specified by:
setDragEnabled
in interfaceDraggable
- Parameters:
enabled
-true
if the object is enabled, elsefalse
.
-
drag
public void drag(DragContext dragContext)
Description copied from interface:Draggable
Drag the object given the providedDragContext
.- Specified by:
drag
in interfaceDraggable
- Parameters:
dragContext
- theDragContext
of this dragging event.
-
doDrag
protected void doDrag(DragContext dragContext)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getRestorableState
public java.lang.String getRestorableState()
Returns an XML state document String describing the public attributes of this UserFacingIcon.- Specified by:
getRestorableState
in interfaceRestorable
- Returns:
- XML state document string describing this UserFacingIcon.
-
restoreState
public void restoreState(java.lang.String stateInXml)
Restores publicly settable attribute values found in the specified XML state document String. The document specified bystateInXml
must be a well formed XML document String, or this will throw an IllegalArgumentException. Unknown structures instateInXml
are benign, because they will simply be ignored.- Specified by:
restoreState
in interfaceRestorable
- Parameters:
stateInXml
- an XML document String describing a UserFacingIcon.- Throws:
java.lang.IllegalArgumentException
- IfstateInXml
is null, or ifstateInXml
is not a well formed XML document String.
-
-