|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.nasa.worldwind.symbology.TacticalGraphicLabel
public class TacticalGraphicLabel
A label drawn as part of a tactical graphic. The label is drawn at constant screen size. The label can include
multiple lines of text, and can optionally be kept aligned with features on the globe. To align a label with the
globe specify an orientationPosition for the label.
The label will be drawn along a line connecting the label's position to the orientation position.
| Field Summary | |
|---|---|
protected OGLStackHandler |
BEogsh
Stack handler used for beginDrawing/endDrawing state. |
protected Rectangle2D |
bounds
Size of the label. |
static Font |
DEFAULT_FONT
Default font. |
static Insets |
DEFAULT_INSETS
Default insets around the label. |
static double |
DEFAULT_INTERIOR_OPACITY
Default interior opacity. |
static Offset |
DEFAULT_OFFSET
Default offset. |
static String |
DEFAULT_TEXT_EFFECT
Default text effect (shadow). |
protected Object |
delegateOwner
Indicates an object that represents the label during picking. |
protected boolean |
drawInterior
Indicates whether or not to draw the label interior. |
protected String |
effect
Effect applied to the text. |
protected boolean |
enableBatchPicking
Indicates whether or not batch picking is enabled. |
protected boolean |
enableBatchRendering
Indicates whether or not batch rendering is enabled. |
protected double |
eyeDistance
Distance from the eye point to the label's geographic location. |
protected Font |
font
Font used to draw the label. |
protected long |
frameTimeStamp
|
protected Insets |
insets
Insets that separate the text from its frame. |
protected double |
interiorOpacity
|
protected Rectangle2D[] |
lineBounds
Cached bounds for each line of text. |
protected int |
lineHeight
Height of a line of text, computed in computeBoundsIfNeeded(gov.nasa.worldwind.render.DrawContext). |
protected String[] |
lines
Text split into separate lines. |
protected int |
lineSpacing
Space (in pixels) between lines in a multi-line label. |
protected Material |
material
Material used to draw the label. |
protected Offset |
offset
Offset from the geographic position at which to draw the label. |
protected double |
opacity
Opacity of the text, as a value between 0 and 1. |
protected Position |
orientationPosition
The label is drawn along a line from the label position to the orientation position. |
protected Layer |
pickLayer
Active layer. |
protected PickSupport |
pickSupport
Support object used during picking. |
protected Vec4 |
placePoint
Geographic position in cartesian coordinates. |
protected Position |
position
The label's geographic position. |
protected Angle |
rotation
Rotation applied to the label. |
protected Rectangle |
screenExtent
Extent of the label on the screen. |
protected Vec4 |
screenPlacePoint
Location of the place point projected onto the screen. |
protected Point |
screenPoint
Location of the upper left corner of the text measured from the lower left corner of the viewport. |
protected String |
textAlign
Text alignment for multi-line labels. |
| Constructor Summary | |
|---|---|
TacticalGraphicLabel()
Create a new empty label. |
|
TacticalGraphicLabel(String text)
Create a new label. |
|
| Method Summary | |
|---|---|
protected void |
beginDrawing(DrawContext dc)
Establish the OpenGL state needed to draw text. |
protected Color |
computeBackgroundColor(Color color)
Compute a contrasting background color to draw the label's outline. |
protected void |
computeBoundsIfNeeded(DrawContext dc)
Compute the bounds of the text, if necessary. |
protected void |
computeGeometry(DrawContext dc)
Compute the label's screen position from its geographic position. |
protected void |
computeGeometryIfNeeded(DrawContext dc)
Compute label geometry, if it has not already been computed this frame, or if the label position has changed since the extent was last computed. |
protected Rectangle |
computeRotatedScreenExtent(Rectangle rect,
int x,
int y,
Angle rotation)
Compute the bounding screen extent of a rotated rectangle. |
protected Angle |
computeRotation(Vec4 screenPoint,
Vec4 orientationScreenPoint)
Compute the amount of rotation to apply to a label in order to keep it oriented toward its orientation position. |
protected Rectangle |
computeTextExtent(int x,
int y,
Angle rotation)
Determine the screen rectangle covered by a label. |
protected void |
doDrawOrderedRenderable(DrawContext dc,
PickSupport pickSupport)
Draw this label during ordered rendering. |
protected void |
doDrawText(TextRenderer textRenderer)
Draw the label's text. |
protected void |
doPick(DrawContext dc,
PickSupport pickSupport)
Draw labels for picking. |
protected void |
drawBatched(DrawContext dc)
Draws this ordered renderable and all subsequent Label ordered renderables in the ordered renderable list. |
protected void |
drawBatchedText(DrawContext dc,
TextRenderer textRenderer)
Draws text for subsequent Label ordered renderables in the ordered renderable list. |
protected void |
drawInterior(DrawContext dc)
Render the label interior as a filled rectangle. |
protected void |
drawMultiLineText(TextRenderer textRenderer,
int x,
int y)
|
protected void |
drawOrderedRenderable(DrawContext dc)
Draws the graphic as an ordered renderable. |
protected void |
drawText(DrawContext dc,
TextRenderer textRenderer)
Draw the label's text. |
protected void |
endDrawing(DrawContext dc)
Pop the state set in beginDrawing. |
Rectangle |
getBounds(DrawContext dc)
Get the label bounding Rectangle using OGL coordinates - bottom-left corner x and y relative to
the WorldWindow bottom-left corner. |
Object |
getDelegateOwner()
Returns the delegate owner of this label. |
double |
getDistanceFromEye()
Returns the ordered renderable's distance from the current view's eye point. |
String |
getEffect()
Indicates an effect used to decorate the text. |
Font |
getFont()
Indicates the font used to draw the label. |
Insets |
getInsets()
Indicates the amount of space between the label's content and its frame, in pixels. |
double |
getInteriorOpacity()
Indicates the opacity of label's interior as a floating-point value in the range 0.0 to 1.0. |
int |
getLineSpacing()
Indicates the line spacing applied to multi-line labels. |
Material |
getMaterial()
Indicates the material used to draw the label. |
Offset |
getOffset()
Indicates the offset from the geographic position at which to draw the label. |
double |
getOpacity()
Indicates the opacity of the text as a floating-point value in the range 0.0 to 1.0. |
Position |
getOrientationPosition()
Indicates the orientation position. |
protected Object |
getPickedObject()
Indicates the object that represents this label during picking. |
Position |
getPosition()
Indicates the label's position. |
String |
getText()
Indicates the text of this label. |
String |
getTextAlign()
Indicates the current text alignment. |
protected boolean |
intersectsFrustum(DrawContext dc)
Determine if this label intersects the view or pick frustum. |
boolean |
isDrawInterior()
Indicates whether or not to draw a colored frame behind the label. |
boolean |
isEnableBatchPicking()
Indicates whether batch picking is enabled. |
boolean |
isEnableBatchRendering()
Indicates whether batch rendering is enabled. |
protected void |
makeOrderedRenderable(DrawContext dc)
Draws the graphic as an ordered renderable. |
void |
pick(DrawContext dc,
Point pickPoint)
Executes a pick of the ordered renderable. |
void |
render(DrawContext dc)
Causes this Renderable to render itself using the provided draw context. |
void |
setDelegateOwner(Object owner)
Specifies the delegate owner of this label. |
void |
setDrawInterior(boolean drawInterior)
Specifies whether or not to draw a colored frame behind the label. |
void |
setEffect(String effect)
Specifies an effect used to decorate the text. |
void |
setEnableBatchPicking(boolean enableBatchPicking)
Specifies whether adjacent Labels in the ordered renderable list may be pick-tested together if they are contained in the same layer. |
void |
setEnableBatchRendering(boolean enableBatchRendering)
Specifies whether adjacent Labels in the ordered renderable list may be rendered together if they are contained in the same layer. |
void |
setFont(Font font)
Specifies the font used to draw the label. |
void |
setInsets(Insets insets)
Specifies the amount of space (in pixels) between the label's content and the edges of the label's frame. |
void |
setInteriorOpacity(double interiorOpacity)
Specifies the opacity of the label's interior as a floating-point value in the range 0.0 to 1.0. |
void |
setLineSpacing(int lineSpacing)
Specifies the line spacing applied to multi-line labels. |
void |
setMaterial(Material material)
Specifies the material used to draw the label. |
void |
setOffset(Offset offset)
Specifies the offset from the geographic position at which to draw the label. |
void |
setOpacity(double opacity)
Specifies the opacity of the text as a floating-point value in the range 0.0 to 1.0. |
void |
setOrientationPosition(Position orientationPosition)
Specifies the orientation position. |
void |
setPosition(Position position)
Indicates the label's geographic position. |
void |
setText(String text)
Specifies the text of this label. |
void |
setTextAlign(String textAlign)
Specifies the text alignment. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected OGLStackHandler BEogsh
protected Rectangle2D bounds
public static final Font DEFAULT_FONT
public static final Insets DEFAULT_INSETS
public static final double DEFAULT_INTERIOR_OPACITY
public static final Offset DEFAULT_OFFSET
AVKey.LEFT, then the left edge of the text
will be aligned with the geographic position, and the label will be centered vertically.
public static final String DEFAULT_TEXT_EFFECT
protected Object delegateOwner
protected boolean drawInterior
protected String effect
AVKey.TEXT_EFFECT_SHADOW or AVKey.TEXT_EFFECT_NONE.
protected boolean enableBatchPicking
protected boolean enableBatchRendering
protected double eyeDistance
protected Font font
protected long frameTimeStamp
protected Insets insets
protected double interiorOpacity
protected Rectangle2D[] lineBounds
protected int lineHeight
computeBoundsIfNeeded(gov.nasa.worldwind.render.DrawContext).
protected String[] lines
protected int lineSpacing
protected Material material
protected Offset offset
protected double opacity
protected Position orientationPosition
protected Layer pickLayer
protected PickSupport pickSupport
protected Vec4 placePoint
protected Position position
protected Angle rotation
protected Rectangle screenExtent
protected Vec4 screenPlacePoint
protected Point screenPoint
protected String textAlign
| Constructor Detail |
|---|
public TacticalGraphicLabel()
public TacticalGraphicLabel(String text)
text - Label text.| Method Detail |
|---|
protected void beginDrawing(DrawContext dc)
dc - the current draw context.protected Color computeBackgroundColor(Color color)
color - Label color.
color.protected void computeBoundsIfNeeded(DrawContext dc)
dc - the current DrawContext.protected void computeGeometry(DrawContext dc)
dc - Current draw context.protected void computeGeometryIfNeeded(DrawContext dc)
dc - Current geometry.
protected Rectangle computeRotatedScreenExtent(Rectangle rect,
int x,
int y,
Angle rotation)
rect - Rectangle to rotate.x - X coordinate of the rotation point.y - Y coordinate of the rotation point.rotation - Rotation angle.
rect when rotated by the specified angle.
protected Angle computeRotation(Vec4 screenPoint,
Vec4 orientationScreenPoint)
screenPoint - Geographic position of the text, projected onto the screen.orientationScreenPoint - Orientation position, projected onto the screen.
protected Rectangle computeTextExtent(int x,
int y,
Angle rotation)
x - X coordinate at which to draw the label.y - Y coordinate at which to draw the label.rotation - Label rotation.
protected void doDrawOrderedRenderable(DrawContext dc,
PickSupport pickSupport)
dc - Current draw context.pickSupport - Support object used during picking.protected void doDrawText(TextRenderer textRenderer)
textRenderer - renderer to use.
protected void doPick(DrawContext dc,
PickSupport pickSupport)
dc - Current draw context.pickSupport - the PickSupport instance to be used.protected void drawBatched(DrawContext dc)
drawBatchedText
in that this method re-initializes the text renderer to draw the next label, while drawBatchedText
re-uses the active text renderer context. That is, drawBatchedText attempts to draw as many labels as
possible that share same text renderer configuration as this label, and this method attempts to draw as many
labels as possible regardless of the text renderer configuration of the subsequent labels.
dc - the current draw context.
protected void drawBatchedText(DrawContext dc,
TextRenderer textRenderer)
drawBatched in that this method reuses the active text
renderer context to draw as many labels as possible without switching text renderer state.
dc - the current draw context.textRenderer - Text renderer used to draw the label.protected void drawInterior(DrawContext dc)
dc - Current draw context.
protected void drawMultiLineText(TextRenderer textRenderer,
int x,
int y)
protected void drawOrderedRenderable(DrawContext dc)
dc - the current draw context.
protected void drawText(DrawContext dc,
TextRenderer textRenderer)
doDrawText to actually draw the text.
dc - Current draw context.textRenderer - Text renderer.protected void endDrawing(DrawContext dc)
dc - the current draw context.public Rectangle getBounds(DrawContext dc)
Rectangle using OGL coordinates - bottom-left corner x and y relative to
the WorldWindow bottom-left corner. If the label is rotated then the returned
rectangle is the bounding rectangle of the rotated label.
dc - the current DrawContext.
Rectangle using OGL viewport coordinates.
IllegalArgumentException - if dc is null.public Object getDelegateOwner()
public double getDistanceFromEye()
getDistanceFromEye in interface OrderedRenderablepublic String getEffect()
AVKey.TEXT_EFFECT_SHADOW (default), or
AVKey.TEXT_EFFECT_NONE.
public Font getFont()
public Insets getInsets()
setInsets(java.awt.Insets)public double getInteriorOpacity()
public int getLineSpacing()
public Material getMaterial()
public Offset getOffset()
setOffset for more information on how the offset is interpreted.
public double getOpacity()
public Position getOrientationPosition()
protected Object getPickedObject()
public Position getPosition()
getOffset()public String getText()
public String getTextAlign()
AVKey.LEFT (default), AVKey.CENTER or AVKey.RIGHT.
protected boolean intersectsFrustum(DrawContext dc)
dc - Current draw context.
public boolean isDrawInterior()
true if the label's interior is drawn, otherwise false.setDrawInterior(boolean)public boolean isEnableBatchPicking()
setEnableBatchPicking(boolean).public boolean isEnableBatchRendering()
setEnableBatchRendering(boolean).protected void makeOrderedRenderable(DrawContext dc)
dc - the current draw context.
public void pick(DrawContext dc,
Point pickPoint)
pick in interface OrderedRenderabledc - the current draw context.pickPoint - the pick point.public void render(DrawContext dc)
Renderable to render itself using the provided draw context.
render in interface Renderabledc - the DrawContext to be usedDrawContextpublic void setDelegateOwner(Object owner)
owner - the object to use as the pickable object returned during picking, or null to return the label.public void setDrawInterior(boolean drawInterior)
drawInterior - true if the label's interior is drawn, otherwise false.isDrawInterior()public void setEffect(String effect)
AVKey.TEXT_EFFECT_SHADOW (default), or
AVKey.TEXT_EFFECT_NONE.
effect - the effect to use for text renderingpublic void setEnableBatchPicking(boolean enableBatchPicking)
SelectEvent even if several of the labels are at the pick position.
Batch rendering (setEnableBatchRendering(boolean)) must be enabled in order for batch picking to occur.
enableBatchPicking - true to enable batch rendering, otherwise false.public void setEnableBatchRendering(boolean enableBatchRendering)
enableBatchRendering - true to enable batch rendering, otherwise false.public void setFont(Font font)
font - New font.public void setInsets(Insets insets)
insets - the desired padding between the label's content and its frame, in pixels.
IllegalArgumentException - if insets is null.getInsets()public void setInteriorOpacity(double interiorOpacity)
interiorOpacity - the opacity of label's interior as a floating-point value from 0.0 to 1.0.
IllegalArgumentException - if opacity is less than 0.0 or greater than 1.0.public void setLineSpacing(int lineSpacing)
lineSpacing - New line spacing.public void setMaterial(Material material)
material - New material.public void setOffset(Offset offset)
AVKey.LEFT., then the left edge of the text will be aligned with the geographic position, and the
label will be centered vertically.
When the text is rotated a horizontal offset moves the text along the orientation line, and a vertical offset
moves the text perpendicular to the orientation line.
offset - The offset at which to draw the label.public void setOpacity(double opacity)
opacity - the opacity of text as a floating-point value from 0.0 to 1.0.
IllegalArgumentException - if opacity is less than 0.0 or greater than 1.0.public void setOrientationPosition(Position orientationPosition)
orientationPosition - Draw label oriented toward this position.public void setPosition(Position position)
position - New position.getOffset()public void setText(String text)
text - New text.public void setTextAlign(String textAlign)
AVKey.LEFT (default), AVKey.CENTER, or AVKey.RIGHT.
textAlign - New text alignment.
|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||