NASA World Wind

gov.nasa.worldwind.render
Class AbstractBalloon

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.render.AbstractBalloon
All Implemented Interfaces:
AVList, MessageListener, Balloon, Highlightable, Renderable, WWObject, PropertyChangeListener, EventListener
Direct Known Subclasses:
AbstractAnnotationBalloon, AbstractBrowserBalloon

public abstract class AbstractBalloon
extends WWObjectImpl
implements Balloon

Abstract implementation of Balloon.


Field Summary
protected  BalloonAttributes activeAttributes
           
protected  boolean alwaysOnTop
           
protected  BalloonAttributes attributes
           
protected static BalloonAttributes defaultAttributes
          The attributes used if attributes are not specified.
protected  Object delegateOwner
           
protected  BalloonAttributes highlightAttributes
           
protected  boolean highlighted
           
protected  double maxActiveAltitude
           
protected  double minActiveAltitude
           
protected  boolean pickEnabled
           
protected  String text
           
protected  TextDecoder textDecoder
           
protected  boolean visible
           
 
Constructor Summary
protected AbstractBalloon()
          Create a balloon.
protected AbstractBalloon(String text)
          Create a balloon with text.
 
Method Summary
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  String getDecodedText()
          Get text after it has been processed by the text decoder.
 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.
 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(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(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, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.nasa.worldwind.render.Balloon
getBounds
 
Methods inherited from interface gov.nasa.worldwind.render.Renderable
render
 
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

activeAttributes

protected BalloonAttributes activeAttributes

alwaysOnTop

protected boolean alwaysOnTop

attributes

protected BalloonAttributes attributes

defaultAttributes

protected static final BalloonAttributes defaultAttributes
The attributes used if attributes are not specified.


delegateOwner

protected Object delegateOwner

highlightAttributes

protected BalloonAttributes highlightAttributes

highlighted

protected boolean highlighted

maxActiveAltitude

protected double maxActiveAltitude

minActiveAltitude

protected double minActiveAltitude

pickEnabled

protected boolean pickEnabled

text

protected String text

textDecoder

protected TextDecoder textDecoder

visible

protected boolean visible
Constructor Detail

AbstractBalloon

protected AbstractBalloon()
Create a balloon.


AbstractBalloon

protected AbstractBalloon(String text)
Create a balloon with text.

Parameters:
text - The balloon text.
Method Detail

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.

getAttributes

public BalloonAttributes getAttributes()
Get the "normal" balloon attributes.

Specified by:
getAttributes in interface Balloon
Returns:
Balloon attributes.

getDecodedText

protected String getDecodedText()
Get text after it has been processed by the text decoder. Returns the original text if there is no TextDecoder.

Returns:
Decoded text.
See Also:
TextDecoder, setTextDecoder(gov.nasa.worldwind.util.TextDecoder), getTextDecoder()

getDelegateOwner

public 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 interface Balloon
Returns:
the object used as the pickable object returned during picking, or null to indicate the the balloon is returned during picking.

getHighlightAttributes

public BalloonAttributes getHighlightAttributes()
Get the highlight attributes.

Specified by:
getHighlightAttributes in interface Balloon
Returns:
Balloon's highlight attributes.

getMaxActiveAltitude

public double getMaxActiveAltitude()
Returns the maximum eye altitude, in meters, for which the balloon is displayed.

Specified by:
getMaxActiveAltitude in interface Balloon
Returns:
the maximum altitude, in meters, for which the balloon is displayed.
See Also:
Balloon.setMaxActiveAltitude(double), Balloon.getMinActiveAltitude()

getMinActiveAltitude

public double getMinActiveAltitude()
Returns the minimum eye altitude, in meters, for which the balloon is displayed.

Specified by:
getMinActiveAltitude in interface Balloon
Returns:
the minimum altitude, in meters, for which the balloon is displayed.
See Also:
Balloon.setMinActiveAltitude(double), Balloon.getMaxActiveAltitude()

getText

public String getText()
Get the balloon text. The method returns the raw text, before decoding.

Specified by:
getText in interface Balloon
Returns:
The balloon text.
See Also:
Balloon.getTextDecoder(), Balloon.setTextDecoder(gov.nasa.worldwind.util.TextDecoder)

getTextDecoder

public TextDecoder getTextDecoder()
Get the text decoder that will process the balloon text.

Specified by:
getTextDecoder in interface Balloon
Returns:
Active text decoder.

isAlwaysOnTop

public boolean isAlwaysOnTop()
Is the balloon always on top?

Specified by:
isAlwaysOnTop in interface Balloon
Returns:
True if the balloon will always render above other items.

isHighlighted

public boolean isHighlighted()
Indicates whether to highlight the shape.

Specified by:
isHighlighted in interface Highlightable
Returns:
true to highlight the shape, otherwise false.

isPickEnabled

public boolean isPickEnabled()
Is the balloon enabled for picking?

Specified by:
isPickEnabled in interface Balloon
Returns:
True if the balloon can be picked, false if not.

isVisible

public boolean isVisible()
Get whether the annotation is visible and should be rendered.

Specified by:
isVisible in interface Balloon
Returns:
true if the annotation is visible and should be rendered.

setAlwaysOnTop

public void setAlwaysOnTop(boolean alwaysOnTop)
Set the balloon to always on top or not.

Specified by:
setAlwaysOnTop in interface Balloon
Parameters:
alwaysOnTop - True if the balloon should always render above other objects.

setAttributes

public void setAttributes(BalloonAttributes attributes)
Set the "normal" balloon attributes.

Specified by:
setAttributes in interface Balloon
Parameters:
attributes - New attributes

setDelegateOwner

public void setDelegateOwner(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 interface Balloon
Parameters:
delegateOwner - the object to use as the pickable object returned during picking, or null to return the balloon.

setHighlightAttributes

public void setHighlightAttributes(BalloonAttributes highlightAttributes)
Set the highlight attributes.

Specified by:
setHighlightAttributes in interface Balloon
Parameters:
highlightAttributes - Attributes to use when the balloon is highlighted.

setHighlighted

public void setHighlighted(boolean highlighted)
Specifies whether to highlight the shape.

Specified by:
setHighlighted in interface Highlightable
Parameters:
highlighted - true to highlight the shape, otherwise false.

setMaxActiveAltitude

public void setMaxActiveAltitude(double maxActiveAltitude)
Specifies the maximum eye altitude, in meters, for which the balloon is displayed.

Specified by:
setMaxActiveAltitude in interface Balloon
Parameters:
maxActiveAltitude - the maximum altitude, in meters, for which the balloon is displayed.
See Also:
Balloon.getMaxActiveAltitude(), Balloon.setMinActiveAltitude(double)

setMinActiveAltitude

public void setMinActiveAltitude(double minActiveAltitude)
Specifies the minimum eye altitude, in meters, for which the balloon is displayed.

Specified by:
setMinActiveAltitude in interface Balloon
Parameters:
minActiveAltitude - the minimum altitude, in meters, for which the balloon is displayed.
See Also:
Balloon.getMinActiveAltitude(), Balloon.setMaxActiveAltitude(double)

setPickEnabled

public void setPickEnabled(boolean enable)
Set the balloon to be pick enabled or not.

Specified by:
setPickEnabled in interface Balloon
Parameters:
enable - True if the balloon can be picked, false if not.

setText

public void setText(String text)
Set the balloon text.

Specified by:
setText in interface Balloon
Parameters:
text - New balloon text.

setTextDecoder

public void setTextDecoder(TextDecoder decoder)
Set a text decoder to process the balloon text.

Specified by:
setTextDecoder in interface Balloon
Parameters:
decoder - New decoder.

setVisible

public void setVisible(boolean visible)
Set whether the balloon is visible and should be rendered.

Specified by:
setVisible in interface Balloon
Parameters:
visible - true if the balloon is visible and should be rendered.

NASA World Wind