Package gov.nasa.worldwind.render
Class AbstractBalloon
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.render.AbstractBalloon
-
- All Implemented Interfaces:
AVList
,MessageListener
,Balloon
,Highlightable
,Renderable
,WWObject
,java.beans.PropertyChangeListener
,java.util.EventListener
- Direct Known Subclasses:
AbstractAnnotationBalloon
public abstract class AbstractBalloon extends WWObjectImpl implements Balloon
Abstract implementation ofBalloon
.
-
-
Field Summary
Fields Modifier and Type Field Description protected BalloonAttributes
activeAttributes
protected boolean
alwaysOnTop
protected BalloonAttributes
attributes
protected static BalloonAttributes
defaultAttributes
The attributes used if attributes are not specified.protected java.lang.Object
delegateOwner
protected BalloonAttributes
highlightAttributes
protected boolean
highlighted
protected double
maxActiveAltitude
protected double
minActiveAltitude
protected boolean
pickEnabled
protected java.lang.String
text
protected TextDecoder
textDecoder
protected boolean
visible
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractBalloon()
Create a balloon.protected
AbstractBalloon(java.lang.String text)
Create a balloon with text.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
determineActiveAttributes()
Determines which attributes -- normal, highlight or default -- to use each frame.protected BalloonAttributes
getActiveAttributes()
Get the active attributes, based on the highlight state.BalloonAttributes
getAttributes()
Get the "normal" balloon attributes.protected java.lang.String
getDecodedText()
Get text after it has been processed by the text decoder.java.lang.Object
getDelegateOwner()
Returns the delegate owner of the balloon.BalloonAttributes
getHighlightAttributes()
Get the highlight attributes.double
getMaxActiveAltitude()
Returns the maximum eye altitude, in meters, for which the balloon is displayed.double
getMinActiveAltitude()
Returns the minimum eye altitude, in meters, for which the balloon is displayed.java.lang.String
getText()
Get the balloon text.TextDecoder
getTextDecoder()
Get the text decoder that will process the balloon text.boolean
isAlwaysOnTop()
Is the balloon always on top?boolean
isHighlighted()
Indicates whether to highlight the shape.boolean
isPickEnabled()
Is the balloon enabled for picking?boolean
isVisible()
Get whether the annotation is visible and should be rendered.void
setAlwaysOnTop(boolean alwaysOnTop)
Set the balloon to always on top or not.void
setAttributes(BalloonAttributes attributes)
Set the "normal" balloon attributes.void
setDelegateOwner(java.lang.Object delegateOwner)
Specifies the delegate owner of the balloon.void
setHighlightAttributes(BalloonAttributes highlightAttributes)
Set the highlight attributes.void
setHighlighted(boolean highlighted)
Specifies whether to highlight the shape.void
setMaxActiveAltitude(double maxActiveAltitude)
Specifies the maximum eye altitude, in meters, for which the balloon is displayed.void
setMinActiveAltitude(double minActiveAltitude)
Specifies the minimum eye altitude, in meters, for which the balloon is displayed.void
setPickEnabled(boolean enable)
Set the balloon to be pick enabled or not.void
setText(java.lang.String text)
Set the balloon text.void
setTextDecoder(TextDecoder decoder)
Set a text decoder to process the balloon text.void
setVisible(boolean visible)
Set whether the balloon is visible and should be rendered.-
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage, propertyChange
-
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, toString, 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
-
Methods inherited from interface gov.nasa.worldwind.render.Renderable
render
-
-
-
-
Field Detail
-
alwaysOnTop
protected boolean alwaysOnTop
-
pickEnabled
protected boolean pickEnabled
-
delegateOwner
protected java.lang.Object delegateOwner
-
attributes
protected BalloonAttributes attributes
-
highlightAttributes
protected BalloonAttributes highlightAttributes
-
activeAttributes
protected BalloonAttributes activeAttributes
-
text
protected java.lang.String text
-
textDecoder
protected TextDecoder textDecoder
-
visible
protected boolean visible
-
highlighted
protected boolean highlighted
-
minActiveAltitude
protected double minActiveAltitude
-
maxActiveAltitude
protected double maxActiveAltitude
-
defaultAttributes
protected static final BalloonAttributes defaultAttributes
The attributes used if attributes are not specified.
-
-
Method Detail
-
isAlwaysOnTop
public boolean isAlwaysOnTop()
Is the balloon always on top?- Specified by:
isAlwaysOnTop
in interfaceBalloon
- Returns:
- True if the balloon will always render above other items.
-
setAlwaysOnTop
public void setAlwaysOnTop(boolean alwaysOnTop)
Set the balloon to always on top or not.- Specified by:
setAlwaysOnTop
in interfaceBalloon
- Parameters:
alwaysOnTop
- True if the balloon should always render above other objects.
-
isPickEnabled
public boolean isPickEnabled()
Is the balloon enabled for picking?- Specified by:
isPickEnabled
in interfaceBalloon
- Returns:
- True if the balloon can be picked, false if not.
-
setPickEnabled
public void setPickEnabled(boolean enable)
Set the balloon to be pick enabled or not.- Specified by:
setPickEnabled
in interfaceBalloon
- Parameters:
enable
- True if the balloon can be picked, false if not.
-
getText
public java.lang.String getText()
Get the balloon text. The method returns the raw text, before decoding.- Specified by:
getText
in interfaceBalloon
- Returns:
- The balloon text.
- See Also:
Balloon.getTextDecoder()
,Balloon.setTextDecoder(gov.nasa.worldwind.util.TextDecoder)
-
getDecodedText
protected java.lang.String getDecodedText()
Get text after it has been processed by the text decoder. Returns the original text if there is noTextDecoder
.- Returns:
- Decoded text.
- See Also:
TextDecoder
,setTextDecoder(gov.nasa.worldwind.util.TextDecoder)
,getTextDecoder()
-
setText
public void setText(java.lang.String text)
Set the balloon text.
-
getDelegateOwner
public java.lang.Object getDelegateOwner()
Returns the delegate owner of the balloon. If non-null, the returned object replaces the balloon as the pickable object returned during picking. If null, the balloon itself is the pickable object returned during picking.- Specified by:
getDelegateOwner
in interfaceBalloon
- Returns:
- the object used as the pickable object returned during picking, or null to indicate the the balloon is returned during picking.
-
setDelegateOwner
public void setDelegateOwner(java.lang.Object delegateOwner)
Specifies the delegate owner of the balloon. If non-null, the delegate owner replaces the balloon as the pickable object returned during picking. If null, the balloon itself is the pickable object returned during picking.- Specified by:
setDelegateOwner
in interfaceBalloon
- Parameters:
delegateOwner
- the object to use as the pickable object returned during picking, or null to return the balloon.
-
getAttributes
public BalloonAttributes getAttributes()
Get the "normal" balloon attributes.- Specified by:
getAttributes
in interfaceBalloon
- Returns:
- Balloon attributes.
-
setAttributes
public void setAttributes(BalloonAttributes attributes)
Set the "normal" balloon attributes.- Specified by:
setAttributes
in interfaceBalloon
- Parameters:
attributes
- New attributes
-
getHighlightAttributes
public BalloonAttributes getHighlightAttributes()
Get the highlight attributes.- Specified by:
getHighlightAttributes
in interfaceBalloon
- Returns:
- Balloon's highlight attributes.
-
setHighlightAttributes
public void setHighlightAttributes(BalloonAttributes highlightAttributes)
Set the highlight attributes.- Specified by:
setHighlightAttributes
in interfaceBalloon
- Parameters:
highlightAttributes
- Attributes to use when the balloon is highlighted.
-
determineActiveAttributes
protected void determineActiveAttributes()
Determines which attributes -- normal, highlight or default -- to use each frame.
-
getActiveAttributes
protected BalloonAttributes getActiveAttributes()
Get the active attributes, based on the highlight state.- Returns:
- Highlight attributes if the balloon is highlighted, or normal attributes otherwise.
-
getTextDecoder
public TextDecoder getTextDecoder()
Get the text decoder that will process the balloon text.- Specified by:
getTextDecoder
in interfaceBalloon
- Returns:
- Active text decoder.
-
setTextDecoder
public void setTextDecoder(TextDecoder decoder)
Set a text decoder to process the balloon text.- Specified by:
setTextDecoder
in interfaceBalloon
- Parameters:
decoder
- New decoder.
-
isHighlighted
public boolean isHighlighted()
Indicates whether to highlight the shape.- Specified by:
isHighlighted
in interfaceHighlightable
- Returns:
- true to highlight the shape, otherwise false.
-
setHighlighted
public void setHighlighted(boolean highlighted)
Specifies whether to highlight the shape.- Specified by:
setHighlighted
in interfaceHighlightable
- Parameters:
highlighted
- true to highlight the shape, otherwise false.
-
isVisible
public boolean isVisible()
Get whether the annotation is visible and should be rendered.
-
setVisible
public void setVisible(boolean visible)
Set whether the balloon is visible and should be rendered.- Specified by:
setVisible
in interfaceBalloon
- Parameters:
visible
- true if the balloon is visible and should be rendered.
-
getMinActiveAltitude
public double getMinActiveAltitude()
Returns the minimum eye altitude, in meters, for which the balloon is displayed.- Specified by:
getMinActiveAltitude
in interfaceBalloon
- Returns:
- the minimum altitude, in meters, for which the balloon is displayed.
- See Also:
Balloon.setMinActiveAltitude(double)
,Balloon.getMaxActiveAltitude()
-
setMinActiveAltitude
public void setMinActiveAltitude(double minActiveAltitude)
Specifies the minimum eye altitude, in meters, for which the balloon is displayed.- Specified by:
setMinActiveAltitude
in interfaceBalloon
- Parameters:
minActiveAltitude
- the minimum altitude, in meters, for which the balloon is displayed.- See Also:
Balloon.getMinActiveAltitude()
,Balloon.setMaxActiveAltitude(double)
-
getMaxActiveAltitude
public double getMaxActiveAltitude()
Returns the maximum eye altitude, in meters, for which the balloon is displayed.- Specified by:
getMaxActiveAltitude
in interfaceBalloon
- Returns:
- the maximum altitude, in meters, for which the balloon is displayed.
- See Also:
Balloon.setMaxActiveAltitude(double)
,Balloon.getMinActiveAltitude()
-
setMaxActiveAltitude
public void setMaxActiveAltitude(double maxActiveAltitude)
Specifies the maximum eye altitude, in meters, for which the balloon is displayed.- Specified by:
setMaxActiveAltitude
in interfaceBalloon
- Parameters:
maxActiveAltitude
- the maximum altitude, in meters, for which the balloon is displayed.- See Also:
Balloon.getMaxActiveAltitude()
,Balloon.setMinActiveAltitude(double)
-
-