NASA World Wind

gov.nasa.worldwind.render
Class DeclutteringTextRenderer

java.lang.Object
  extended by gov.nasa.worldwind.render.DeclutteringTextRenderer

public class DeclutteringTextRenderer
extends Object

A simplified version of GeographicTextRenderer that participates in globe text decluttering. See ClutterFilter for more information on decluttering.


Field Summary
protected static Color DEFAULT_COLOR
           
protected static Font DEFAULT_FONT
           
protected  GLU glu
           
protected  boolean hasJOGLv111Bug
           
 
Constructor Summary
DeclutteringTextRenderer()
           
 
Method Summary
protected  Color applyOpacity(Color color, double opacity)
           
protected  void beginRendering(DrawContext dc)
           
protected  Point2D.Float computeDrawPoint(Rectangle2D rect, Vec4 screenPoint)
          Computes the final draw point for the given rectangle lower left corner and target screen point.
protected  Rectangle2D computeTextBounds(DrawContext dc, DeclutterableText text)
           
protected  Vec4 drawText(DrawContext dc, DeclutterableText uText, double scale, double opacity)
           
protected  void endRendering(DrawContext dc)
           
 Font getDefaultFont()
           
 TextRenderer getTextRenderer(DrawContext dc, Font font)
          Returns either a cached or new text renderer for a specified font.
protected  void handleTextRendererExceptions(Exception e)
           
protected static boolean isTextValid(GeographicText text, boolean checkPosition)
           
 void render(DrawContext dc, Iterable<? extends GeographicText> textIterable)
          Adds ordered renderables to the ordered renderable list.
protected  void setDepthFunc(DrawContext dc, Vec4 screenPoint)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_COLOR

protected static final Color DEFAULT_COLOR

DEFAULT_FONT

protected static final Font DEFAULT_FONT

glu

protected final GLU glu

hasJOGLv111Bug

protected boolean hasJOGLv111Bug
Constructor Detail

DeclutteringTextRenderer

public DeclutteringTextRenderer()
Method Detail

applyOpacity

protected Color applyOpacity(Color color,
                             double opacity)

beginRendering

protected void beginRendering(DrawContext dc)

computeDrawPoint

protected Point2D.Float computeDrawPoint(Rectangle2D rect,
                                         Vec4 screenPoint)
Computes the final draw point for the given rectangle lower left corner and target screen point. If the returned point is null 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.

computeTextBounds

protected Rectangle2D computeTextBounds(DrawContext dc,
                                        DeclutterableText text)
                                 throws Exception
Throws:
Exception

drawText

protected Vec4 drawText(DrawContext dc,
                        DeclutterableText uText,
                        double scale,
                        double opacity)
                 throws Exception
Throws:
Exception

endRendering

protected void endRendering(DrawContext dc)

getDefaultFont

public Font getDefaultFont()

getTextRenderer

public TextRenderer getTextRenderer(DrawContext dc,
                                    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.

handleTextRendererExceptions

protected void handleTextRendererExceptions(Exception e)
                                     throws Exception
Throws:
Exception

isTextValid

protected static boolean isTextValid(GeographicText text,
                                     boolean checkPosition)

render

public void render(DrawContext dc,
                   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.

setDepthFunc

protected void setDepthFunc(DrawContext dc,
                            Vec4 screenPoint)

NASA World Wind