Class DeclutteringTextRenderer


  • public class DeclutteringTextRenderer
    extends java.lang.Object
    A simplified version of GeographicTextRenderer that participates in globe text decluttering. See ClutterFilter for more information on decluttering.
    • Field Detail

      • DEFAULT_FONT

        protected static final java.awt.Font DEFAULT_FONT
      • DEFAULT_COLOR

        protected static final java.awt.Color DEFAULT_COLOR
      • glu

        protected final com.jogamp.opengl.glu.GLU glu
      • hasJOGLv111Bug

        protected boolean hasJOGLv111Bug
    • Constructor Detail

      • DeclutteringTextRenderer

        public DeclutteringTextRenderer()
    • 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 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.
      • 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