Package gov.nasa.worldwind.render
Class ScreenAnnotation
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.render.AbstractAnnotation
-
- gov.nasa.worldwind.render.ScreenAnnotation
-
- All Implemented Interfaces:
AVList
,Disposable
,Annotation
,Renderable
,Restorable
- Direct Known Subclasses:
EditorAnnotation
,ImageAnnotation
,ProgressAnnotation
,ScreenRelativeAnnotation
,ToolTipAnnotation
,ToolTipAnnotation
public class ScreenAnnotation extends AbstractAnnotation
Represent a text label attached to a Point on the viewport 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 Modifier and Type Field Description protected Position
position
protected java.awt.Point
screenPoint
-
Fields inherited from class gov.nasa.worldwind.render.AbstractAnnotation
alwaysOnTop, attributes, childList, delegateOwner, layoutManager, maxActiveAltitude, minActiveAltitude, pickEnabled, pickSupport, text, textBoundsMap, vertexBuffer, wrappedTextMap
-
Fields inherited from interface gov.nasa.worldwind.render.Annotation
ANTIALIAS_DONT_CARE, ANTIALIAS_FASTEST, ANTIALIAS_NICEST
-
-
Constructor Summary
Constructors Constructor Description ScreenAnnotation(java.lang.String text, java.awt.Point position)
Creates aScreenAnnotation
with the given text, at the given viewport position.ScreenAnnotation(java.lang.String text, java.awt.Point position, AnnotationAttributes defaults)
Creates aScreenAnnotation
with the given text, at the given viewport position.ScreenAnnotation(java.lang.String text, java.awt.Point position, java.awt.Font font)
Creates aScreenAnnotation
with the given text, at the given viewport position.ScreenAnnotation(java.lang.String text, java.awt.Point position, java.awt.Font font, java.awt.Color textColor)
Creates aScreenAnnotation
with the given text, at the given viewport position.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.awt.Point
computeAnnotationPosition(DrawContext dc, Position pos)
protected java.awt.Rectangle
computeBounds(DrawContext dc)
protected double[]
computeOffset(DrawContext dc)
protected java.awt.Point
computeSize(DrawContext dc)
protected void
doRenderNow(DrawContext dc)
Position
getPosition()
Returns the position set viasetPosition(gov.nasa.worldwind.geom.Position)
.java.lang.String
getRestorableState()
Returns an XML state document String describing the public attributes of this ScreenAnnotation.java.awt.Point
getScreenPoint()
Get thePoint
where the annotation is drawn in the viewport.protected java.awt.Point
getScreenPoint(DrawContext dc)
Get thePoint
where the annotation is drawn in the viewport.void
restoreState(java.lang.String stateInXml)
Restores publicly settable attribute values found in the specified XML state document String.void
setPosition(Position position)
Specifies an optional geographic position that is mapped to a screen position during rendering.void
setScreenPoint(java.awt.Point position)
Set thePoint
where the annotation will be drawn in the viewport.-
Methods inherited from class gov.nasa.worldwind.render.AbstractAnnotation
addChild, adjustSizeToChildren, adjustSizeToText, applyBackgroundTextureState, applyColor, 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, getMaxActiveAltitude, getMinActiveAltitude, getMultiLineTextRenderer, getPickSupport, getPreferredSize, getText, getTextBounds, getTextRenderer, getWrappedText, glPointFromAWTPoint, isAlwaysOnTop, isPickEnabled, modulateColorOpacity, pick, removeAllChildren, removeChild, render, renderNow, setAlwaysOnTop, setAttributes, setDelegateOwner, setLayout, setMaxActiveAltitude, setMinActiveAltitude, setPickEnabled, setPickSupport, setText, transformBackgroundImageCoordsToAnnotationCoords, transformByModelview, transformImageCoordsToBackgroundImageCoords, wrapText
-
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
-
-
-
-
Field Detail
-
screenPoint
protected java.awt.Point screenPoint
-
position
protected Position position
-
-
Constructor Detail
-
ScreenAnnotation
public ScreenAnnotation(java.lang.String text, java.awt.Point position)
Creates aScreenAnnotation
with the given text, at the given viewport position.- Parameters:
text
- the annotation text.position
- the annotation viewport position.
-
ScreenAnnotation
public ScreenAnnotation(java.lang.String text, java.awt.Point position, java.awt.Font font)
Creates aScreenAnnotation
with the given text, at the given viewport position. Specifiy theFont
to be used.- Parameters:
text
- the annotation text.position
- the annotation viewport position.font
- theFont
to use.
-
ScreenAnnotation
public ScreenAnnotation(java.lang.String text, java.awt.Point position, java.awt.Font font, java.awt.Color textColor)
Creates aScreenAnnotation
with the given text, at the given viewport position. Specifiy theFont
and textColor
to be used.- Parameters:
text
- the annotation text.position
- the annotation viewport position.font
- theFont
to use.textColor
- the textColor
.
-
ScreenAnnotation
public ScreenAnnotation(java.lang.String text, java.awt.Point position, AnnotationAttributes defaults)
Creates aScreenAnnotation
with the given text, at the given viewport position. Specify the defaultAnnotationAttributes
set.- Parameters:
text
- the annotation text.position
- the annotation viewport position.defaults
- the defaultAnnotationAttributes
set.
-
-
Method Detail
-
getScreenPoint
public java.awt.Point getScreenPoint()
Get thePoint
where the annotation is drawn in the viewport.- Returns:
- the
Point
where the annotation is drawn in the viewport.
-
getScreenPoint
protected java.awt.Point getScreenPoint(DrawContext dc)
Get thePoint
where the annotation is drawn in the viewport.- Parameters:
dc
- the current draw context.- Returns:
- the
Point
where the annotation is drawn in the viewport.
-
computeAnnotationPosition
protected java.awt.Point computeAnnotationPosition(DrawContext dc, Position pos)
-
setScreenPoint
public void setScreenPoint(java.awt.Point position)
Set thePoint
where the annotation will be drawn in the viewport.- Parameters:
position
- thePoint
where the annotation will be drawn in the viewport.
-
getPosition
public Position getPosition()
Returns the position set viasetPosition(gov.nasa.worldwind.geom.Position)
.- Returns:
- The position previously set.
-
setPosition
public void setPosition(Position position)
Specifies an optional geographic position that is mapped to a screen position during rendering. This value overrides this object's screen point and computes it anew each time this annotation is drawn.- Parameters:
position
- This annotation's geographic position. May be null, in which case this annotation's screen point is used directly.- See Also:
setScreenPoint(java.awt.Point)
-
computeBounds
protected java.awt.Rectangle computeBounds(DrawContext dc)
- Specified by:
computeBounds
in classAbstractAnnotation
-
computeSize
protected java.awt.Point computeSize(DrawContext dc)
-
computeOffset
protected double[] computeOffset(DrawContext dc)
-
doRenderNow
protected void doRenderNow(DrawContext dc)
- Specified by:
doRenderNow
in classAbstractAnnotation
-
getRestorableState
public java.lang.String getRestorableState()
Returns an XML state document String describing the public attributes of this ScreenAnnotation.- Specified by:
getRestorableState
in interfaceRestorable
- Overrides:
getRestorableState
in classAbstractAnnotation
- Returns:
- XML state document string describing this ScreenAnnotation.
-
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
- Overrides:
restoreState
in classAbstractAnnotation
- Parameters:
stateInXml
- an XML document String describing a ScreenAnnotation.- Throws:
java.lang.IllegalArgumentException
- IfstateInXml
is null, or ifstateInXml
is not a well formed XML document String.
-
-