public class SurfaceText extends AbstractSurfaceObject implements GeographicText, Movable, Draggable
AbstractSurfaceObject.CacheEntry, AbstractSurfaceObject.SurfaceObjectStateKey| Modifier and Type | Field and Description | 
|---|---|
| protected Color | bgColorBackground color for the text. | 
| protected Color | colorColor to use to draw the text. | 
| static Color | DEFAULT_COLORDefault text color. | 
| static Font | DEFAULT_FONTDefault font. | 
| static Offset | DEFAULT_OFFSETDefault offset. | 
| static double | DEFAULT_TEXT_SIZE_IN_METERSDefault text size. | 
| protected boolean | dragEnabledDragging Support | 
| protected DraggableSupport | draggableSupport | 
| protected LatLon | drawLocationThe lower-left location of the text box after applying offset. | 
| protected Font | fontFont to use to draw the text. | 
| protected Position | locationLocation at which to draw the text. | 
| protected Offset | offsetOffset that specifies where to place the text in relation to it's geographic position. | 
| protected double | pixelSizeInMetersGeographic size of a pixel. | 
| protected double | priorityText priority. | 
| protected double | scaleScaling factor applied to the text to maintain a constant geographic size. | 
| protected boolean | spansAntimeridianIndicates whether this text spans the dateline. | 
| protected CharSequence | textThe text to draw. | 
| protected Rectangle2D | textBoundsBounds of the text in pixels. | 
| protected double | textSizeInMetersThe height of the text in meters. | 
delegateOwner, drawBoundingSectors, enableBatchPicking, extentCache, lastModifiedTime, nextUniqueId, pickLayer, pickSupport, pickTileBuilder, uniqueId, visible| Constructor and Description | 
|---|
| 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. | 
| Modifier and Type | Method and Description | 
|---|---|
| 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 | doDrag(DragContext dragContext) | 
| void | drag(DragContext dragContext)Drag the object given the provided  DragContext. | 
| 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 sectors indicating the geographic region that bounds this renderable for the specified draw
 context. | 
| 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() | 
| boolean | isDragEnabled()Indicates whether the object is enabled for dragging. | 
| 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 | setDragEnabled(boolean enabled)Controls whether the object is enabled for dragging. | 
| 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. | 
buildPickRepresentation, clearCaches, computeExtent, computeExtent, createPickedObject, createPickTileBuilder, drawBoundingSectors, drawOrderedRenderable, drawPickRepresentation, getDelegateOwner, getDistanceFromEye, getExtent, getStateKey, getUniqueId, intersectsFrustum, intersectsPickFrustum, intersectsVisibleSector, isDrawBoundingSectors, isEnableBatchPicking, isVisible, makeOrderedPreRenderable, makeOrderedRenderable, nextUniqueId, pick, pickBatched, pickOrderedRenderable, render, setDelegateOwner, setDrawBoundingSectors, setEnableBatchPicking, setVisible, updateModifiedTimeonMessage, propertyChangeaddPropertyChangeListener, 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, setValuesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisVisible, setVisibleaddPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValuesprotected 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 boolean dragEnabled
protected DraggableSupport draggableSupport
protected LatLon drawLocation
protected Font font
DEFAULT_FONT.protected Position location
protected Offset offset
protected double pixelSizeInMeters
protected double priority
protected double scale
protected boolean spansAntimeridian
protected CharSequence text
protected Rectangle2D textBounds
protected double textSizeInMeters
public SurfaceText(String text, Position position)
text - Text to draw.position - Geographic location at which to draw the text.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 doDrag(DragContext dragContext)
public void drag(DragContext dragContext)
DraggableDragContext.drag in interface DraggabledragContext - the DragContext of this dragging event.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)
getSectors in interface SurfaceRenderabledc - the draw context for which to determine this renderable's geographic bounds.public CharSequence getText()
getText in interface GeographicTextprotected TextRenderer getTextRenderer(DrawContext dc)
dc - Current draw context.public double getTextSize()
public boolean isDragEnabled()
DraggableisDragEnabled in interface Draggableprotected boolean isSmall()
true if the height of the text is less than one pixel.public void move(Position position)
public void moveTo(Position 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 setDragEnabled(boolean enabled)
DraggablesetDragEnabled in interface Draggableenabled - true if the object is enabled, else false.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.