Class StyledShapePainter


  • public class StyledShapePainter
    extends Object
    A simple class that knows how to paint a Shape object onto a Graphic given a Style2D. It's the last step of the rendering engine, and has been factored out since both renderers do use the same painting logic.
    Author:
    Andrea Aime
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static boolean OPTIMIZE_VECTOR_HATCH_FILLS
      Whether to apply the new vector hatch fill optimization, or not (on by default, this is just a safeguard)
      static boolean ROUND_ICON_COORDS
      Whether icon centers should be matched to a pixel center, or not
      static RenderingHints.Key TEXTURE_ANCHOR_HINT_KEY  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void paint​(Graphics2D graphics, LiteShape2 shape, GraphicLegend legend, double symbolScale, boolean isLabelObstacle)
      Paints a GraphicLegend in the supplied graphics
      void paint​(Graphics2D graphics, LiteShape2 shape, Style2D style, double scale)  
      void paint​(Graphics2D graphics, LiteShape2 shape, Style2D style, double scale, boolean isLabelObstacle)
      Invoked automatically when a polyline is about to be draw.
      protected void paintGraphicFill​(Graphics2D graphics, Shape shape, Style2D graphicFill, double scale)
      Paints a graphic fill for a given shape.
      • Methods inherited from class Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • TEXTURE_ANCHOR_HINT_KEY

        public static final RenderingHints.Key TEXTURE_ANCHOR_HINT_KEY
      • ROUND_ICON_COORDS

        public static boolean ROUND_ICON_COORDS
        Whether icon centers should be matched to a pixel center, or not
      • OPTIMIZE_VECTOR_HATCH_FILLS

        public static boolean OPTIMIZE_VECTOR_HATCH_FILLS
        Whether to apply the new vector hatch fill optimization, or not (on by default, this is just a safeguard)
    • Constructor Detail

      • StyledShapePainter

        public StyledShapePainter()
      • StyledShapePainter

        public StyledShapePainter​(LabelCache cache)
    • Method Detail

      • paint

        public void paint​(Graphics2D graphics,
                          LiteShape2 shape,
                          Style2D style,
                          double scale)
      • paint

        public void paint​(Graphics2D graphics,
                          LiteShape2 shape,
                          Style2D style,
                          double scale,
                          boolean isLabelObstacle)
        Invoked automatically when a polyline is about to be draw. This implementation paints the polyline according to the rendered style
        Parameters:
        graphics - The graphics in which to draw.
        shape - The polygon to draw.
        style - The style to apply, or null if none.
        scale - The scale denominator for the current zoom level
      • paint

        public void paint​(Graphics2D graphics,
                          LiteShape2 shape,
                          GraphicLegend legend,
                          double symbolScale,
                          boolean isLabelObstacle)
        Paints a GraphicLegend in the supplied graphics
        Parameters:
        graphics - The graphics in which to draw.
        shape - The shape to draw.
        legend - The legend to apply.
        symbolScale - The scale of the symbol, if the legend graphic has to be rescaled
      • paintGraphicFill

        protected void paintGraphicFill​(Graphics2D graphics,
                                        Shape shape,
                                        Style2D graphicFill,
                                        double scale)
        Paints a graphic fill for a given shape.
        Parameters:
        graphics - Graphics2D on which to paint.
        shape - Shape whose fill is to be painted.
        graphicFill - a Style2D that specified the graphic fill.
        scale - the scale of the current render.