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 BasicWWTexturebackgroundTextureprotected booleandragEnabledprotected DraggableSupportdraggableSupportprotected BasicWWTextureimageTexture
-
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 voiddoDrag(DragContext dragContext)voiddrag(DragContext dragContext)Drag the object given the providedDragContext.java.lang.ObjectgetBackgroundImage()Returns the icon's background image source, if any.doublegetBackgroundScale()Indicates the relative screen size of the background image, if specified.BasicWWTexturegetBackgroundTexture()Returns theWWTextureused to represent the icon's background texture.doublegetHighlightScale()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.ObjectgetImageSource()Returns the icon's image source.BasicWWTexturegetImageTexture()Returns theWWTextureused to represent the icon.java.lang.StringgetPath()PositiongetPosition()Returns the icon's geographic position.PositiongetReferencePosition()A position associated with the object that indicates its aggregate geographic position.java.lang.StringgetRestorableState()Returns an XML state document String describing the public attributes of this UserFacingIcon.java.awt.DimensiongetSize()Returns the icon's specified screen size.java.awt.FontgetToolTipFont()Returns the font used to render an icon's tool tip, if any.Vec4getToolTipOffset()Indicates the offset in screen coordinates at which to place the lower left corner of the icon tool tip's text box.java.lang.StringgetToolTipText()Returns the icon's current tool tip text.java.awt.ColorgetToolTipTextColor()Indicates the color in which the icon's tool tip, if any, is drawn.booleanisAlwaysOnTop()Indicates whether the icon is always to be displayed "on top" of all other ordered renderables.booleanisDragEnabled()Indicates whether the object is enabled for dragging.booleanisHighlighted()Indicates whether the icon should be drawn in its highlighted state.booleanisShowToolTip()Indicates whether the icon's tool tip, if any, is displayed with the icon.booleanisVisible()Returns the state of the visibility flag.voidmove(Position position)Shift the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.voidmoveTo(Position position)Move the shape over the globe's surface while maintaining its original azimuth, its orientation relative to North.voidrestoreState(java.lang.String stateInXml)Restores publicly settable attribute values found in the specified XML state document String.voidsetAlwaysOnTop(boolean alwaysOnTop)Indicates whether the icon is always to be displayed "on top" of all other ordered renderables.voidsetBackgroundImage(java.lang.Object background)Specifies the icon's background image source.voidsetBackgroundScale(double backgroundScale)Indicates the relative screen size of the background image, if specified.voidsetDragEnabled(boolean enabled)Controls whether the object is enabled for dragging.voidsetHighlighted(boolean highlighted)Specifies whether the icon should be drawn in its highlighted state.voidsetHighlightScale(double highlightScale)Specifies the relative screen size of the icon when it's highlighted.voidsetImageSource(java.lang.Object imageSource)Specifies the source image for the icon.voidsetPosition(Position iconPosition)Sets the icon's geographic position.voidsetShowToolTip(boolean showToolTip)Indicates whether the icon's tool tip, if any, is displayed with the icon.voidsetSize(java.awt.Dimension size)Sets the desired screen size of the icon.voidsetToolTipFont(java.awt.Font toolTipFont)Specifies the font to use when displaying the icon's tool tip, if any.voidsetToolTipOffset(Vec4 toolTipOffset)Indicates the offset in screen coordinates at which to place the lower left corner of the icon tool tip's text box.voidsetToolTipText(java.lang.String toolTipText)Specifies the text string to display as the icon's tool tip.voidsetToolTipTextColor(java.awt.Color textColor)Specifies the color in which to display the icon's tool tip text, if any.voidsetVisible(boolean visible)Specifies whether the icon is drawn.java.lang.StringtoString()-
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:WWIconReturns theWWTextureused to represent the icon.- Specified by:
getImageTexturein interfaceWWIcon- Returns:
- the icon's texture.
-
getBackgroundTexture
public BasicWWTexture getBackgroundTexture()
Description copied from interface:WWIconReturns theWWTextureused to represent the icon's background texture.- Specified by:
getBackgroundTexturein interfaceWWIcon- Returns:
- the icon's background texture.
-
getImageSource
public java.lang.Object getImageSource()
Description copied from interface:WWIconReturns the icon's image source.- Specified by:
getImageSourcein interfaceWWIcon- Returns:
- the icon's image source.
-
setImageSource
public void setImageSource(java.lang.Object imageSource)
Description copied from interface:WWIconSpecifies the source image for the icon. Implementations of this interface determine the allowed source types, but generally allow at least aStringfile path and aBufferedImage.- Specified by:
setImageSourcein interfaceWWIcon- Parameters:
imageSource- the image source.
-
getPath
public java.lang.String getPath()
-
getPosition
public Position getPosition()
Description copied from interface:WWIconReturns the icon's geographic position.- Specified by:
getPositionin interfaceWWIcon- Returns:
- the icon's geographic position.
-
setPosition
public void setPosition(Position iconPosition)
Description copied from interface:WWIconSets the icon's geographic position.- Specified by:
setPositionin 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:WWIconIndicates whether the icon should be drawn in its highlighted state. The representation of the highlighted state is implementation dependent.- Specified by:
isHighlightedin interfaceWWIcon- Returns:
- true if the icon should be rendered as highlighted, otherwise false.
-
setHighlighted
public void setHighlighted(boolean highlighted)
Description copied from interface:WWIconSpecifies whether the icon should be drawn in its highlighted state. The representation of the highlighted state is implementation dependent.- Specified by:
setHighlightedin 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:
getHighlightScalein interfaceWWIcon- Returns:
- the icon's highlight scale. The default scale is 1.2.
-
setHighlightScale
public void setHighlightScale(double highlightScale)
Description copied from interface:WWIconSpecifies 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:
setHighlightScalein interfaceWWIcon- Parameters:
highlightScale- the highlight scale.
-
getSize
public java.awt.Dimension getSize()
Description copied from interface:WWIconReturns the icon's specified screen size.- Specified by:
getSizein 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:WWIconSets 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:WWIconReturns the state of the visibility flag.
-
setVisible
public void setVisible(boolean visible)
Description copied from interface:WWIconSpecifies whether the icon is drawn.- Specified by:
setVisiblein 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:WWIconReturns the icon's current tool tip text.- Specified by:
getToolTipTextin interfaceWWIcon- Returns:
- the current tool tip text.
-
setToolTipText
public void setToolTipText(java.lang.String toolTipText)
Description copied from interface:WWIconSpecifies the text string to display as the icon's tool tip.- Specified by:
setToolTipTextin 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:WWIconReturns the font used to render an icon's tool tip, if any.- Specified by:
getToolTipFontin interfaceWWIcon- Returns:
- the tool tip font. The default is null.
-
setToolTipFont
public void setToolTipFont(java.awt.Font toolTipFont)
Description copied from interface:WWIconSpecifies the font to use when displaying the icon's tool tip, if any.- Specified by:
setToolTipFontin interfaceWWIcon- Parameters:
toolTipFont- the tool tip font. If null, an implementation dependent font is used.
-
getToolTipOffset
public Vec4 getToolTipOffset()
Description copied from interface:WWIconIndicates 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:
getToolTipOffsetin interfaceWWIcon- Returns:
- the tool tip offset. The default is null.
-
setToolTipOffset
public void setToolTipOffset(Vec4 toolTipOffset)
Description copied from interface:WWIconIndicates 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:
setToolTipOffsetin interfaceWWIcon- Parameters:
toolTipOffset- the tool tip offset. The default is null.
-
isShowToolTip
public boolean isShowToolTip()
Description copied from interface:WWIconIndicates whether the icon's tool tip, if any, is displayed with the icon.- Specified by:
isShowToolTipin 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:WWIconIndicates whether the icon's tool tip, if any, is displayed with the icon.- Specified by:
setShowToolTipin 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:WWIconIndicates the color in which the icon's tool tip, if any, is drawn.- Specified by:
getToolTipTextColorin 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:WWIconSpecifies the color in which to display the icon's tool tip text, if any.- Specified by:
setToolTipTextColorin 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:WWIconIndicates whether the icon is always to be displayed "on top" of all other ordered renderables.- Specified by:
isAlwaysOnTopin interfaceWWIcon- Returns:
- true if the icon has visual priority, otherwise false, the default.
-
setAlwaysOnTop
public void setAlwaysOnTop(boolean alwaysOnTop)
Description copied from interface:WWIconIndicates whether the icon is always to be displayed "on top" of all other ordered renderables.- Specified by:
setAlwaysOnTopin interfaceWWIcon- Parameters:
alwaysOnTop- true if the icon has visual priority, otherwise false, the default.
-
getBackgroundImage
public java.lang.Object getBackgroundImage()
Description copied from interface:WWIconReturns the icon's background image source, if any.- Specified by:
getBackgroundImagein interfaceWWIcon- Returns:
- the icon's background image source. The default is null.
-
setBackgroundImage
public void setBackgroundImage(java.lang.Object background)
Description copied from interface:WWIconSpecifies the icon's background image source. If non-null, the image is displayed centered and behind the icon.- Specified by:
setBackgroundImagein interfaceWWIcon- Parameters:
background- the background image source. The default is null.
-
getBackgroundScale
public double getBackgroundScale()
Description copied from interface:WWIconIndicates 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:
getBackgroundScalein interfaceWWIcon- Returns:
- the background image scale.
-
setBackgroundScale
public void setBackgroundScale(double backgroundScale)
Description copied from interface:WWIconIndicates 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:
setBackgroundScalein interfaceWWIcon- Parameters:
backgroundScale- the background image scale.
-
move
public void move(Position position)
Description copied from interface:MovableShift 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:MovableMove 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:MovableA 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:
getReferencePositionin interfaceMovable- Returns:
- the object's reference position, or null if no reference position is available.
-
isDragEnabled
public boolean isDragEnabled()
Description copied from interface:DraggableIndicates whether the object is enabled for dragging.- Specified by:
isDragEnabledin interfaceDraggable- Returns:
- true if the object is enabled, else false.
-
setDragEnabled
public void setDragEnabled(boolean enabled)
Description copied from interface:DraggableControls whether the object is enabled for dragging.- Specified by:
setDragEnabledin interfaceDraggable- Parameters:
enabled-trueif the object is enabled, elsefalse.
-
drag
public void drag(DragContext dragContext)
Description copied from interface:DraggableDrag the object given the providedDragContext.- Specified by:
dragin interfaceDraggable- Parameters:
dragContext- theDragContextof this dragging event.
-
doDrag
protected void doDrag(DragContext dragContext)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getRestorableState
public java.lang.String getRestorableState()
Returns an XML state document String describing the public attributes of this UserFacingIcon.- Specified by:
getRestorableStatein 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 bystateInXmlmust be a well formed XML document String, or this will throw an IllegalArgumentException. Unknown structures instateInXmlare benign, because they will simply be ignored.- Specified by:
restoreStatein interfaceRestorable- Parameters:
stateInXml- an XML document String describing a UserFacingIcon.- Throws:
java.lang.IllegalArgumentException- IfstateInXmlis null, or ifstateInXmlis not a well formed XML document String.
-
-