Package gov.nasa.worldwind.render
Class DeclutteringTextRenderer
- java.lang.Object
-
- gov.nasa.worldwind.render.DeclutteringTextRenderer
-
public class DeclutteringTextRenderer extends java.lang.Object
A simplified version ofGeographicTextRenderer
that participates in globe text decluttering. SeeClutterFilter
for more information on decluttering.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.awt.Color
DEFAULT_COLOR
protected static java.awt.Font
DEFAULT_FONT
protected com.jogamp.opengl.glu.GLU
glu
protected boolean
hasJOGLv111Bug
-
Constructor Summary
Constructors Constructor Description DeclutteringTextRenderer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.awt.Color
applyOpacity(java.awt.Color color, double opacity)
protected void
beginRendering(DrawContext dc)
protected java.awt.geom.Point2D.Float
computeDrawPoint(java.awt.geom.Rectangle2D rect, Vec4 screenPoint)
Computes the final draw point for the given rectangle lower left corner and target screen point.protected java.awt.geom.Rectangle2D
computeTextBounds(DrawContext dc, DeclutterableText text)
protected Vec4
drawText(DrawContext dc, DeclutterableText uText, double scale, double opacity)
protected void
endRendering(DrawContext dc)
java.awt.Font
getDefaultFont()
TextRenderer
getTextRenderer(DrawContext dc, java.awt.Font font)
Returns either a cached or new text renderer for a specified font.protected void
handleTextRendererExceptions(java.lang.Exception e)
protected static boolean
isTextValid(GeographicText text, boolean checkPosition)
void
render(DrawContext dc, java.lang.Iterable<? extends GeographicText> textIterable)
Adds ordered renderables to the ordered renderable list.protected void
setDepthFunc(DrawContext dc, Vec4 screenPoint)
-
-
-
Method Detail
-
getDefaultFont
public java.awt.Font getDefaultFont()
-
getTextRenderer
public TextRenderer getTextRenderer(DrawContext dc, java.awt.Font font)
Returns either a cached or new text renderer for a specified font.- Parameters:
dc
- the current draw context.font
- the text font.- Returns:
- a text renderer.
-
render
public void render(DrawContext dc, java.lang.Iterable<? extends GeographicText> textIterable)
Adds ordered renderables to the ordered renderable list.- Parameters:
dc
- the current draw context.textIterable
- a collection of text shapes to add to the ordered-renderable list.
-
beginRendering
protected void beginRendering(DrawContext dc)
-
endRendering
protected void endRendering(DrawContext dc)
-
drawText
protected Vec4 drawText(DrawContext dc, DeclutterableText uText, double scale, double opacity) throws java.lang.Exception
- Throws:
java.lang.Exception
-
setDepthFunc
protected void setDepthFunc(DrawContext dc, Vec4 screenPoint)
-
computeDrawPoint
protected java.awt.geom.Point2D.Float computeDrawPoint(java.awt.geom.Rectangle2D rect, Vec4 screenPoint)
Computes the final draw point for the given rectangle lower left corner and target screen point. If the returned point isnull
the text will not be drawn.- Parameters:
rect
- the text rectangle to draw.screenPoint
- the projected screen point the text relates to.- Returns:
- the final draw point for the given rectangle lower left corner or
null
.
-
isTextValid
protected static boolean isTextValid(GeographicText text, boolean checkPosition)
-
applyOpacity
protected java.awt.Color applyOpacity(java.awt.Color color, double opacity)
-
computeTextBounds
protected java.awt.geom.Rectangle2D computeTextBounds(DrawContext dc, DeclutterableText text) throws java.lang.Exception
- Throws:
java.lang.Exception
-
handleTextRendererExceptions
protected void handleTextRendererExceptions(java.lang.Exception e) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-