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 Positionpositionprotected java.awt.PointscreenPoint-
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 aScreenAnnotationwith the given text, at the given viewport position.ScreenAnnotation(java.lang.String text, java.awt.Point position, AnnotationAttributes defaults)Creates aScreenAnnotationwith the given text, at the given viewport position.ScreenAnnotation(java.lang.String text, java.awt.Point position, java.awt.Font font)Creates aScreenAnnotationwith 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 aScreenAnnotationwith the given text, at the given viewport position.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.awt.PointcomputeAnnotationPosition(DrawContext dc, Position pos)protected java.awt.RectanglecomputeBounds(DrawContext dc)protected double[]computeOffset(DrawContext dc)protected java.awt.PointcomputeSize(DrawContext dc)protected voiddoRenderNow(DrawContext dc)PositiongetPosition()Returns the position set viasetPosition(gov.nasa.worldwind.geom.Position).java.lang.StringgetRestorableState()Returns an XML state document String describing the public attributes of this ScreenAnnotation.java.awt.PointgetScreenPoint()Get thePointwhere the annotation is drawn in the viewport.protected java.awt.PointgetScreenPoint(DrawContext dc)Get thePointwhere the annotation is drawn in the viewport.voidrestoreState(java.lang.String stateInXml)Restores publicly settable attribute values found in the specified XML state document String.voidsetPosition(Position position)Specifies an optional geographic position that is mapped to a screen position during rendering.voidsetScreenPoint(java.awt.Point position)Set thePointwhere 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 aScreenAnnotationwith 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 aScreenAnnotationwith the given text, at the given viewport position. Specifiy theFontto be used.- Parameters:
text- the annotation text.position- the annotation viewport position.font- theFontto use.
-
ScreenAnnotation
public ScreenAnnotation(java.lang.String text, java.awt.Point position, java.awt.Font font, java.awt.Color textColor)Creates aScreenAnnotationwith the given text, at the given viewport position. Specifiy theFontand textColorto be used.- Parameters:
text- the annotation text.position- the annotation viewport position.font- theFontto use.textColor- the textColor.
-
ScreenAnnotation
public ScreenAnnotation(java.lang.String text, java.awt.Point position, AnnotationAttributes defaults)Creates aScreenAnnotationwith the given text, at the given viewport position. Specify the defaultAnnotationAttributesset.- Parameters:
text- the annotation text.position- the annotation viewport position.defaults- the defaultAnnotationAttributesset.
-
-
Method Detail
-
getScreenPoint
public java.awt.Point getScreenPoint()
Get thePointwhere the annotation is drawn in the viewport.- Returns:
- the
Pointwhere the annotation is drawn in the viewport.
-
getScreenPoint
protected java.awt.Point getScreenPoint(DrawContext dc)
Get thePointwhere the annotation is drawn in the viewport.- Parameters:
dc- the current draw context.- Returns:
- the
Pointwhere 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 thePointwhere the annotation will be drawn in the viewport.- Parameters:
position- thePointwhere 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:
computeBoundsin classAbstractAnnotation
-
computeSize
protected java.awt.Point computeSize(DrawContext dc)
-
computeOffset
protected double[] computeOffset(DrawContext dc)
-
doRenderNow
protected void doRenderNow(DrawContext dc)
- Specified by:
doRenderNowin classAbstractAnnotation
-
getRestorableState
public java.lang.String getRestorableState()
Returns an XML state document String describing the public attributes of this ScreenAnnotation.- Specified by:
getRestorableStatein interfaceRestorable- Overrides:
getRestorableStatein 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 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- Overrides:
restoreStatein classAbstractAnnotation- Parameters:
stateInXml- an XML document String describing a ScreenAnnotation.- Throws:
java.lang.IllegalArgumentException- IfstateInXmlis null, or ifstateInXmlis not a well formed XML document String.
-
-