Class GeographicTextRenderer


  • public class GeographicTextRenderer
    extends java.lang.Object
    • Constructor Detail

      • GeographicTextRenderer

        public GeographicTextRenderer()
    • Method Detail

      • isCullTextEnabled

        public boolean isCullTextEnabled()
        Determines whether overlapping text are culled. If true text items are sorted front to back according to their respective priority rather then back to front, and will be drawn only if they do not overlap an already drawn text. If false all text will be drawn back to front whether they overlap or not.
        Returns:
        true if overlapping text are culled.
      • setCullTextEnabled

        public void setCullTextEnabled​(boolean cullText)
        Set whether overlapping text should be culled. If true text items will be sorted front to back according to their respective priority rather then back to front, and will be drawn only if they do not overlap an already drawn text. If false all text will be drawn back to front whether they overlap or not.
        Parameters:
        cullText - true if overlapping text should be culled.
      • getCullTextMargin

        public int getCullTextMargin()
        Get the empty margin that surrounds a text item when considering it's bounding rectangle during text culling - see setCullTextEnabled(boolean). The smaller the margin, the closer text items can get before being considered as overlapping.
        Returns:
        the empty margin that surrounds a text item - in pixels.
      • setCullTextMargin

        public void setCullTextMargin​(int margin)
        Set the empty margin that surrounds a text item when considering it's bounding rectangle during text culling - see setCullTextEnabled(boolean). The smaller the margin, the closer text items can get before being considered as overlapping.
        Parameters:
        margin - the empty margin that surrounds a text item - in pixels.
      • getDistanceMinScale

        public double getDistanceMinScale()
        Get the minimum scale that can be applied to a text item when it gets farther away from the eye than the view lookat point - screen center.
        Returns:
        the minimum scale that can be applied to a text item when it gets away from the eye.
      • setDistanceMinScale

        public void setDistanceMinScale​(double scale)
        Set the minimum scale that can be applied to a text item when it gets farther away from the eye than the view lookat point - screen center. Use a value less then one to have the text 'fade' away. A value of one will have no effect.
        Parameters:
        scale - the minimum scale that can be applied to a text item when it gets away from the eye.
      • getDistanceMaxScale

        public double getDistanceMaxScale()
        Get the maximum scale that can be applied to a text item when it gets closer to the eye than the view lookat point - screen center.
        Returns:
        the maximum scale that can be applied to a text item when it closer to the eye.
      • setDistanceMaxScale

        public void setDistanceMaxScale​(double scale)
        Set the maximum scale that can be applied to a text item when it gets closer to the eye than the view lookat point - screen center. Use a value greater then one to have the text magnified in the foreground. A value of one will have no effect.
        Parameters:
        scale - the maximum scale that can be applied to a text item when it closer to the eye.
      • getDistanceMinOpacity

        public double getDistanceMinOpacity()
        Get the minimum opacity that can be applied to a text item when it gets farther away from the eye than the view lookat point - screen center.
        Returns:
        the minimum opacity that can be applied to a text item when it gets away from the eye.
      • setDistanceMinOpacity

        public void setDistanceMinOpacity​(double opacity)
        Set the minimum opacity that can be applied to a text item when it gets farther away from the eye than the view lookat point - screen center. Use a value less then one to have the text 'fade' away. A value of one will have no effect.
        Parameters:
        opacity - the minimum opacity that can be applied to a text item when it gets away from the eye.
      • isTextValid

        protected static boolean isTextValid​(GeographicText text,
                                             boolean checkPosition)
      • computeScaledBounds

        protected java.awt.geom.Rectangle2D computeScaledBounds​(java.awt.geom.Rectangle2D bounds,
                                                                double scale)
      • computeExpandedBounds

        protected java.awt.geom.Rectangle2D computeExpandedBounds​(java.awt.geom.Rectangle2D bounds,
                                                                  int margin)
      • computeLookAtDistance

        protected double computeLookAtDistance​(DrawContext dc)
      • beginRendering

        protected void beginRendering​(DrawContext dc)
      • endRendering

        protected void endRendering​(DrawContext dc)
      • applyOpacity

        protected java.awt.Color applyOpacity​(java.awt.Color color,
                                              double opacity)
      • computeDrawPoint

        protected java.awt.geom.Point2D.Float computeDrawPoint​(DrawContext dc,
                                                               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:
        dc - the current DrawContext
        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.