Class AWTColorbarImageGenerator

java.lang.Object
org.jzy3d.plot2d.primitive.AWTAbstractImageGenerator
org.jzy3d.plot2d.primitive.AWTColorbarImageGenerator
All Implemented Interfaces:
AWTImageGenerator

public class AWTColorbarImageGenerator extends AWTAbstractImageGenerator implements AWTImageGenerator
Author:
Martin Pernollet
  • Field Details

    • MIN_BAR_WIDTH

      public static final int MIN_BAR_WIDTH
      See Also:
    • MIN_BAR_HEIGHT

      public static final int MIN_BAR_HEIGHT
      See Also:
    • mapper

      protected ColorMapper mapper
    • tickProvider

      protected ITickProvider tickProvider
    • tickRenderer

      protected ITickRenderer tickRenderer
    • min

      protected double min
    • max

      protected double max
    • BAR_WIDTH_DEFAULT

      public static int BAR_WIDTH_DEFAULT
    • TEXT_TO_BAR_DEFAULT

      public static int TEXT_TO_BAR_DEFAULT
    • barWidth

      protected int barWidth
    • textToBarHorizontalMargin

      protected int textToBarHorizontalMargin
    • maxTextWidth

      protected int maxTextWidth
    • addTextHeightToVerticalMargin

      protected boolean addTextHeightToVerticalMargin
    • pixelScale

      protected Coord2d pixelScale
  • Constructor Details

  • Method Details

    • toImage

      public BufferedImage toImage(int width, int height)
      Specified by:
      toImage in interface AWTImageGenerator
    • toImage

      public BufferedImage toImage(int width, int height, int barWidth)
      Renders the colorbar to an image.
    • drawBarContour

      protected void drawBarContour(int height, int barWidth, Graphics2D graphic)
      Draw a bar border. Keep a space of half text height between the top of image and top of colorbar (same for bottom) to ensure a tick label at max or min position would not be cut at image border. The text size is given by AWTAbstractImageGenerator.setFont(org.jzy3d.painters.Font)
      Parameters:
      height -
      barWidth -
      graphic -
    • drawBarColors

      protected void drawBarColors(int height, int barWidth, Graphics2D graphic)
      Draw a bar content using the provided color mapper.
      Parameters:
      height -
      barWidth -
      graphic -
    • drawTextAnnotations

      protected void drawTextAnnotations(int height, int barWidth, Graphics2D graphic)
    • getPixelScale

      public Coord2d getPixelScale()
    • setPixelScale

      public void setPixelScale(Coord2d pixelScale)
    • getScaledBarWidth

      public int getScaledBarWidth()
    • getBarWidth

      public int getBarWidth()
    • getTextToBarHorizontalMargin

      public int getTextToBarHorizontalMargin()
    • setTextToBarHorizontalMargin

      public void setTextToBarHorizontalMargin(int textToBarHorizontalMargin)
    • getPreferredWidth

      public int getPreferredWidth(IPainter painter)
      Compute the optimal image width to contain the text as defined by the tick provided and renderer.
    • getPreferredWidth

      protected int getPreferredWidth(int maxTextWidth)
    • getMaxTextWidth

      public int getMaxTextWidth()
      Only valid after a call to getPreferredWidth(IPainter)
      Returns:
    • getMaxTickLabelWidth

      public int getMaxTickLabelWidth(IPainter painter)
    • getTickProvider

      public ITickProvider getTickProvider()
    • setTickProvider

      public void setTickProvider(ITickProvider tickProvider)
    • getTickRenderer

      public ITickRenderer getTickRenderer()
    • setTickRenderer

      public void setTickRenderer(ITickRenderer tickRenderer)