|
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.WWObjectImpl
gov.nasa.worldwind.render.AbstractSurfaceObject
gov.nasa.worldwind.render.SurfaceText
public class SurfaceText
Renders a string of text on the surface of the globe. The text will appear draped over terrain. Surface text is drawn at a constant geographic size: it will appear larger when the view zooms in on the text and smaller when the view zooms out.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class gov.nasa.worldwind.render.AbstractSurfaceObject |
|---|
AbstractSurfaceObject.CacheEntry, AbstractSurfaceObject.SurfaceObjectStateKey |
| Field Summary | |
|---|---|
protected Color |
bgColor
Background color for the text. |
protected Color |
color
Color to use to draw the text. |
static Color |
DEFAULT_COLOR
Default text color. |
static Font |
DEFAULT_FONT
Default font. |
static Offset |
DEFAULT_OFFSET
Default offset. |
static double |
DEFAULT_TEXT_SIZE_IN_METERS
Default text size. |
protected Font |
font
Font to use to draw the text. |
protected Position |
location
Location at which to draw the text. |
protected Offset |
offset
Offset that specifies where to place the text in relation to it's geographic position. |
protected double |
pixelSizeInMeters
Geographic size of a pixel. |
protected double |
priority
Text priority. |
protected double |
scale
Scaling factor applied to the text to maintain a constant geographic size. |
protected CharSequence |
text
The text to draw. |
protected Rectangle2D |
textBounds
Bounds of the text in pixels. |
protected double |
textSizeInMeters
The height of the text in meters. |
| Fields inherited from class gov.nasa.worldwind.render.AbstractSurfaceObject |
|---|
delegateOwner, drawBoundingSectors, enableBatchPicking, extentCache, lastModifiedTime, nextUniqueId, pickLayer, pickSupport, pickTileBuilder, pickTiles, uniqueId, visible |
| Constructor Summary | |
|---|---|
SurfaceText(String text,
Position position)
Create a new surface text object. |
|
SurfaceText(String text,
Position position,
Font font,
Color color)
Create a new surface text object. |
|
| Method Summary | |
|---|---|
protected void |
applyDrawTransform(DrawContext dc,
SurfaceTileDrawContext sdc)
Apply a transform to the GL state to draw the text at the proper location and scale. |
protected Color |
computeBackgroundColor(Color color)
Compute a background color that contrasts with the text color. |
protected void |
computeGeometry(DrawContext dc,
SurfaceTileDrawContext sdc)
Compute the text size and position. |
protected double |
computePixelSize(DrawContext dc,
SurfaceTileDrawContext sdc)
Compute the size of a pixel in the surface tile. |
protected Sector |
computeSector(DrawContext dc)
Compute the sector covered by this surface text. |
protected Color |
determineBackgroundColor(Color color)
Determine the text background color. |
protected void |
drawGeographic(DrawContext dc,
SurfaceTileDrawContext sdc)
Causes the SurfaceObject to render itself to the specified region in geographic coordinates. |
protected void |
drawText(DrawContext dc)
Draw the text. |
Color |
getBackgroundColor()
Indicates the background color used to draw the text. |
Color |
getColor()
Indicates the color used to draw the text. |
Font |
getFont()
Indicates the font used to draw the text. |
Offset |
getOffset()
Returns the text offset. |
Position |
getPosition()
Indicates the geographic position of the text. |
double |
getPriority()
Indicates the text priority. |
Position |
getReferencePosition()
A position associated with the object that indicates its aggregate geographic position. |
List<Sector> |
getSectors(DrawContext dc)
Returns a List of Sector instances that bound the surface
object on the specified DrawContext. |
CharSequence |
getText()
Indicates the text contained in this object. |
protected TextRenderer |
getTextRenderer(DrawContext dc)
Get the text renderer to use to draw text. |
double |
getTextSize()
|
protected boolean |
isSmall()
Determine if the text is too small to draw. |
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 |
preRender(DrawContext dc)
Causes the surface object to prepare a representation of itself which can be drawn on the surface terrain, using the provided draw context. |
void |
setBackgroundColor(Color background)
Specifies the background color used to draw the text. |
void |
setColor(Color color)
Specifies the color used to draw the text. |
void |
setFont(Font font)
Specifies the font used to draw the text. |
void |
setOffset(Offset offset)
Specifies a location relative to the label position at which to align the label. |
void |
setPosition(Position position)
Specifies the geographic position of the text. |
void |
setPriority(double priority)
Specifies the text priority. |
void |
setText(CharSequence text)
Specifies the text. |
void |
setTextSize(double meters)
|
protected void |
updateTextBounds(DrawContext dc)
Determine the text bounds. |
| Methods inherited from class gov.nasa.worldwind.WWObjectImpl |
|---|
onMessage, propertyChange |
| 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 |
| Methods inherited from interface gov.nasa.worldwind.render.GeographicText |
|---|
isVisible, setVisible |
| Methods inherited from interface gov.nasa.worldwind.avlist.AVList |
|---|
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues |
| Field Detail |
|---|
protected Color bgColor
protected Color color
DEFAULT_COLOR.
public static final Color DEFAULT_COLOR
public static final Font DEFAULT_FONT
public static final Offset DEFAULT_OFFSET
public static final double DEFAULT_TEXT_SIZE_IN_METERS
protected Font font
DEFAULT_FONT.
protected Position location
protected Offset offset
protected double pixelSizeInMeters
protected double priority
protected double scale
protected CharSequence text
protected Rectangle2D textBounds
protected double textSizeInMeters
| Constructor Detail |
|---|
public SurfaceText(String text,
Position position)
text - Text to draw.position - Geographic location at which to draw the text.
public SurfaceText(String text,
Position position,
Font font,
Color color)
text - Text to draw.position - Geographic location at which to draw the text.font - Font to use when drawing text.color - Color to use when drawing text.| Method Detail |
|---|
protected void applyDrawTransform(DrawContext dc,
SurfaceTileDrawContext sdc)
dc - Current draw context.sdc - Current surface tile draw context.protected Color computeBackgroundColor(Color color)
color - text color.
protected void computeGeometry(DrawContext dc,
SurfaceTileDrawContext sdc)
dc - Current draw context.sdc - Current surface tile draw context.
protected double computePixelSize(DrawContext dc,
SurfaceTileDrawContext sdc)
dc - Current draw context.sdc - Current surface tile draw context.
protected Sector computeSector(DrawContext dc)
dc - Current draw context.
protected Color determineBackgroundColor(Color color)
color - text color.
protected void drawGeographic(DrawContext dc,
SurfaceTileDrawContext sdc)
drawGeographic in class AbstractSurfaceObjectdc - the current draw context.sdc - the context containing a geographic region and screen viewport corresponding to a surface tile.protected void drawText(DrawContext dc)
dc - Current draw context.public Color getBackgroundColor()
getBackgroundColor in interface GeographicTextpublic Color getColor()
getColor in interface GeographicTextpublic Font getFont()
getFont in interface GeographicTextpublic Offset getOffset()
setOffset(Offset)public Position getPosition()
getPosition in interface GeographicTextpublic double getPriority()
getPriority in interface GeographicTextpublic Position getReferencePosition()
getReferencePosition in interface Movablepublic List<Sector> getSectors(DrawContext dc)
List of Sector instances that bound the surface
object on the specified DrawContext.
getSectors in interface SurfaceObjectdc - the DrawContext the surface object is related to.
public CharSequence getText()
getText in interface GeographicTextprotected TextRenderer getTextRenderer(DrawContext dc)
dc - Current draw context.
public double getTextSize()
protected boolean isSmall()
true if the height of the text is less than one pixel.public void move(Position position)
move in interface Movableposition - the latitude and longitude to add to the shape's reference position.public void moveTo(Position position)
moveTo in interface Movableposition - the new position of the shape's reference position.public void preRender(DrawContext dc)
preRender in interface PreRenderablepreRender in interface SurfaceObjectpreRender in class AbstractSurfaceObjectdc - the current draw context.public void setBackgroundColor(Color background)
setBackgroundColor in interface GeographicTextbackground - New background color.public void setColor(Color color)
setColor in interface GeographicTextcolor - New color.public void setFont(Font font)
setFont in interface GeographicTextfont - New font.public void setOffset(Offset offset)
offset - Offset that controls where to position the label relative to its geographic location.public void setPosition(Position position)
setPosition in interface GeographicTextposition - New text position.setOffset(Offset)public void setPriority(double priority)
setPriority in interface GeographicTextpriority - New priority.public void setText(CharSequence text)
setText in interface GeographicTexttext - New text.public void setTextSize(double meters)
protected void updateTextBounds(DrawContext dc)
dc - Current draw context.
|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||