|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.nasa.worldwind.avlist.AVListImpl
gov.nasa.worldwind.render.AbstractAnnotation
gov.nasa.worldwind.render.ScreenAnnotation
gov.nasa.worldwind.render.ScreenRelativeAnnotation
public class ScreenRelativeAnnotation
Provides a screen annotation positioned relatively to the window rather than absolutely. The annotation's position is specified as fractional locations along the window's X and Y axes. When the window is resized the annotation is repositioned according to its relative coordinates.
The annotation can be forced to remain fully visible even if its relative position would place a portion of it outside the window. X and Y margins can be specified to ensure distance between the annotation's edges and the window edges.
| 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 |
|---|
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 | |
|---|---|
ScreenRelativeAnnotation(String text,
double xFraction,
double yFraction)
Create an annotation with spedified text and relative position. |
|
| Method Summary | |
|---|---|
String |
getRestorableState()
Returns an XML state document String describing the public attributes of this ScreenAnnotation. |
protected Point |
getScreenPoint(DrawContext dc)
Computes and returns the screen point in pixels corresponding to the annotation's relative position coordinates and the current window size. |
double |
getXFraction()
Returns the annotation's relative X position. |
int |
getXMargin()
Returns the annotation's X margin. |
double |
getYFraction()
Returns the annotation's relative Y position. |
int |
getYMargin()
Returns the annotation's Y margin. |
boolean |
isKeepFullyVisible()
Indicates whether the annotation is kept fully visible in the window. |
void |
restoreState(String stateInXml)
Restores publicly settable attribute values found in the specified XML state document String. |
void |
setKeepFullyVisible(boolean keepFullyVisible)
Specifies whether to adjust the annotation's position so that it is always fully visible when the window has sufficient area to display it, even if it would be fully or partially obscured when placed according to its relative coordinates. |
void |
setXFraction(double xFraction)
Specifies the annotation's relative X position. |
void |
setXMargin(int xMargin)
Specifies the annotation's X margin, the minimum distance to maintain between the annotation's leading and trailing edges and the respective window edge. |
void |
setYFraction(double yFraction)
Specifies the annotation's relative Y position. |
void |
setYMargin(int yMargin)
Specifies the annotation's Y margin, the minimum distance to maintain between the annotation's top and bottom edges and the respective window edge. |
| Methods inherited from class gov.nasa.worldwind.render.ScreenAnnotation |
|---|
computeBounds, computeOffset, computeSize, doRenderNow, getScreenPoint, setScreenPoint |
| 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 |
| Constructor Detail |
|---|
public ScreenRelativeAnnotation(String text,
double xFraction,
double yFraction)
text - the text to display in the annotation.xFraction - the relative X position of the annotation. A value of 0 indicates the window's left edge, a
value of 1 indicates its right edge. The annotation is centered horizontally on this position
prior to applying any X offest specified in the annotation's attributes.yFraction - the relative Y position of the annotation. A value of 0 indicates the window's bottom edge, a
value of 1 indicates the window's top edge. The annotation's lower edge is justified to this
position prior to applying any Y offset specified in the annotation's attributes.
IllegalArgumentException - if the text string is null.| Method Detail |
|---|
public String getRestorableState()
getRestorableState in interface RestorablegetRestorableState in class ScreenAnnotationprotected Point getScreenPoint(DrawContext dc)
getScreenPoint in class ScreenAnnotationdc - the current draw context.
public double getXFraction()
setXFraction(double).public int getXMargin()
public double getYFraction()
setYFraction(double).public int getYMargin()
public boolean isKeepFullyVisible()
public void restoreState(String stateInXml)
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.
restoreState in interface RestorablerestoreState in class ScreenAnnotationstateInXml - an XML document String describing a ScreenAnnotation.
IllegalArgumentException - If stateInXml is null, or if stateInXml is not a well
formed XML document String.public void setKeepFullyVisible(boolean keepFullyVisible)
keepFullyVisible - true to keep the annotation fully visible, otherwise false.public void setXFraction(double xFraction)
xFraction - the annotation's relative X position.public void setXMargin(int xMargin)
keepFullyVisible flag is true.
xMargin - the X margin, in pixels.public void setYFraction(double yFraction)
yFraction - the annotation's relative Y position.public void setYMargin(int yMargin)
keepFullyVisible flag is true.
yMargin - the Y margin, in pixels.
|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||