NASA World Wind

gov.nasa.worldwind.render
Class GlobeAnnotation

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.render.AbstractAnnotation
          extended by gov.nasa.worldwind.render.GlobeAnnotation
All Implemented Interfaces:
AVList, Disposable, Locatable, Movable, Pickable, Annotation, Renderable, Restorable
Direct Known Subclasses:
DialogAnnotation, MeasureTool.ControlPoint, SARAnnotation

public class GlobeAnnotation
extends AbstractAnnotation
implements Locatable, Movable

Represent a text label attached to a Position on the globe and its rendering attributes.

See Also:
AbstractAnnotation, AnnotationAttributes

Nested Class Summary
 
Nested classes/interfaces inherited from class gov.nasa.worldwind.render.AbstractAnnotation
AbstractAnnotation.TextCacheKey
 
Field Summary
 
Fields inherited from class gov.nasa.worldwind.render.AbstractAnnotation
attributes, childList, delegateOwner, layoutManager, text, textBoundsMap, wrappedTextMap
 
Fields inherited from class gov.nasa.worldwind.avlist.AVListImpl
changeSupport
 
Fields inherited from interface gov.nasa.worldwind.render.Annotation
ANTIALIAS_DONT_CARE, ANTIALIAS_FASTEST, ANTIALIAS_NICEST, IMAGE_REPEAT_NONE, IMAGE_REPEAT_X, IMAGE_REPEAT_XY, IMAGE_REPEAT_Y, SIZE_FIT_TEXT, SIZE_FIXED
 
Constructor Summary
GlobeAnnotation(java.lang.String text, Position position)
          Creates a GlobeAnnotation with the given text, at the given globe Position.
GlobeAnnotation(java.lang.String text, Position position, AnnotationAttributes defaults)
          Creates a GlobeAnnotation with the given text, at the given globe Position.
GlobeAnnotation(java.lang.String text, Position position, java.awt.Font font)
          Creates a GlobeAnnotation with the given text, at the given globe Position.
GlobeAnnotation(java.lang.String text, Position position, java.awt.Font font, java.awt.Color textColor)
          Creates a GlobeAnnotation with the given text, at the given globe Position.
 
Method Summary
protected  java.awt.Rectangle computeBounds(DrawContext dc)
           
protected  double[] computeDistanceScaleAndOpacity(DrawContext dc, Vec4 point, java.awt.Dimension size)
           
protected  double computeLookAtDistance(DrawContext dc)
           
protected  void doRenderNow(DrawContext dc)
           
 Vec4 getAnnotationDrawPoint(DrawContext dc)
          Get the final Vec4 point at which an annotation will be drawn.
 double getHeightInMeter()
          Returns the real world height of the annotation frame in meter.
 Position getPosition()
           
 Position getReferencePosition()
           
 java.lang.String getRestorableState()
          Returns an XML state document String describing the public attributes of this GlobeAnnotation.
 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.
protected  void setDepthFunc(DrawContext dc, Vec4 screenPoint)
           
 void setHeightInMeter(double meters)
          Set the real world height of the annotation frame in meter.
 void setPosition(Position position)
           
 
Methods inherited from class gov.nasa.worldwind.render.AbstractAnnotation
addChild, adjustSizeToChildren, adjustSizeToText, applyBackgroundTextureState, applyScreenTransform, beginDraw, beginDrawChildren, bindPickableObject, computeBoundingRectangle, computeFreeBounds, computeInsetBounds, computeOpacity, computeScale, computeTextBounds, dispose, doDraw, doDrawBackgroundTexture, doDrawChildren, draw, drawBackground, drawBackgroundImage, drawBorder, drawCallout, drawChildren, drawContent, drawHTML, drawPlainText, drawText, drawText, drawTopLevelAnnotation, endDraw, endDrawChildren, getAttributes, getBounds, getChildren, getDelegateOwner, getLayout, getMultiLineTextRenderer, getPickSupport, getPreferredSize, getText, getTextBounds, getTextRenderer, getWrappedText, glPointFromAWTPoint, isAlwaysOnTop, isPickEnabled, modulateColorOpacity, pick, removeAllChildren, removeChild, render, renderNow, setAlwaysOnTop, setAttributes, setDelegateOwner, setDrawColor, setLayout, setPickEnabled, setPickSupport, setText, transformBackgroundImageCoordsToAnnotationCoords, transformByModelview, transformImageCoordsToBackgroundImageCoords, wrapText
 
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, 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
 

Constructor Detail

GlobeAnnotation

public GlobeAnnotation(java.lang.String text,
                       Position position)
Creates a GlobeAnnotation with the given text, at the given globe Position.

Parameters:
text - the annotation text.
position - the annotation Position.

GlobeAnnotation

public GlobeAnnotation(java.lang.String text,
                       Position position,
                       AnnotationAttributes defaults)
Creates a GlobeAnnotation with the given text, at the given globe Position. Specify the default AnnotationAttributes set.

Parameters:
text - the annotation text.
position - the annotation Position.
defaults - the default AnnotationAttributes set.

GlobeAnnotation

public GlobeAnnotation(java.lang.String text,
                       Position position,
                       java.awt.Font font)
Creates a GlobeAnnotation with the given text, at the given globe Position. Specifiy the Font to be used.

Parameters:
text - the annotation text.
position - the annotation Position.
font - the Font to use.

GlobeAnnotation

public GlobeAnnotation(java.lang.String text,
                       Position position,
                       java.awt.Font font,
                       java.awt.Color textColor)
Creates a GlobeAnnotation with the given text, at the given globe Position. Specifiy the Font and text Color to be used.

Parameters:
text - the annotation text.
position - the annotation Position.
font - the Font to use.
textColor - the text Color.
Method Detail

computeBounds

protected java.awt.Rectangle computeBounds(DrawContext dc)
Specified by:
computeBounds in class AbstractAnnotation

computeDistanceScaleAndOpacity

protected double[] computeDistanceScaleAndOpacity(DrawContext dc,
                                                  Vec4 point,
                                                  java.awt.Dimension size)

computeLookAtDistance

protected double computeLookAtDistance(DrawContext dc)

doRenderNow

protected void doRenderNow(DrawContext dc)
Specified by:
doRenderNow in class AbstractAnnotation

getAnnotationDrawPoint

public Vec4 getAnnotationDrawPoint(DrawContext dc)
Get the final Vec4 point at which an annotation will be drawn. If the annotation Position elevation is lower then the highest elevation on the globe, it will be drawn above the ground using its elevation as an offset, scaled by the current vertical exaggeration. Otherwise, the original elevation will be used.

Parameters:
dc - the current DrawContext.
Returns:
the annotation draw Cartesian point

getHeightInMeter

public double getHeightInMeter()
Returns the real world height of the annotation frame in meter. If this dimension is greater then zero, the annotation will be scaled so as to maintain this fixed dimension, which makes it appear as part of the surrounding terrain. This overrides min and max distance scaling - however min distance opacity is still acounted for.

If this dimension is zero, the annotation always maintains the same apparent size with possible scaling relative to the viewport center point if min and max distance scale factors are not one.

Returns:
the real world height of the annotation frame in meter.

getPosition

public Position getPosition()
Specified by:
getPosition in interface Locatable

getReferencePosition

public Position getReferencePosition()
Specified by:
getReferencePosition in interface Movable

getRestorableState

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

Specified by:
getRestorableState in interface Restorable
Overrides:
getRestorableState in class AbstractAnnotation
Returns:
XML state document string describing this GlobeAnnotation.

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(java.lang.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
Overrides:
restoreState in class AbstractAnnotation
Parameters:
stateInXml - an XML document String describing a GlobeAnnotation.
Throws:
java.lang.IllegalArgumentException - If stateInXml is null, or if stateInXml is not a well formed XML document String.

setDepthFunc

protected void setDepthFunc(DrawContext dc,
                            Vec4 screenPoint)

setHeightInMeter

public void setHeightInMeter(double meters)
Set the real world height of the annotation frame in meter. If this dimension is greater then zero, the annotation will be scaled so as to maintain this fixed dimension, which makes it appear as part of the surrounding terrain. This overrides min and max distance scaling - however min distance opacity is still acounted for.

If this dimension is zero, the annotation always maintains the same apparent size with possible scaling relative to the viewport center point if min and max distance scale factors are not one.

Parameters:
meters - the real world height of the annotation frame in meter.

setPosition

public void setPosition(Position position)

NASA World Wind