Package org.jzy3d.plot2d.primitive
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 Summary
Modifier and TypeFieldDescriptionprotected boolean
static int
protected int
protected ColorMapper
protected double
protected int
protected double
static final int
static final int
protected Coord2d
static int
protected int
protected ITickProvider
protected ITickRenderer
Fields inherited from class org.jzy3d.plot2d.primitive.AWTAbstractImageGenerator
awtFont, backgroundColor, font, foregroundColor, hasBackground, textSize
-
Constructor Summary
ConstructorDescriptionAWTColorbarImageGenerator
(ColorMapper mapper, ITickProvider provider, ITickRenderer renderer) AWTColorbarImageGenerator
(IColorMap map, float min, float max, ITickProvider provider, ITickRenderer renderer) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
drawBarColors
(int height, int barWidth, Graphics2D graphic) Draw a bar content using the provided color mapper.protected void
drawBarContour
(int height, int barWidth, Graphics2D graphic) Draw a bar border.protected void
drawTextAnnotations
(int height, int barWidth, Graphics2D graphic) int
int
Only valid after a call togetPreferredWidth(IPainter)
int
getMaxTickLabelWidth
(IPainter painter) protected int
getPreferredWidth
(int maxTextWidth) int
getPreferredWidth
(IPainter painter) Compute the optimal image width to contain the text as defined by the tick provided and renderer.int
int
void
setPixelScale
(Coord2d pixelScale) void
setTextToBarHorizontalMargin
(int textToBarHorizontalMargin) void
setTickProvider
(ITickProvider tickProvider) void
setTickRenderer
(ITickRenderer tickRenderer) toImage
(int width, int height) toImage
(int width, int height, int barWidth) Renders the colorbar to an image.Methods inherited from class org.jzy3d.plot2d.primitive.AWTAbstractImageGenerator
configureText, drawBackground, drawBorder, getAWTFont, getBackgroundColor, getFont, getForegroundColor, hasBackground, setAWTFont, setBackgroundColor, setFont, setForegroundColor, setHasBackground
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jzy3d.plot2d.primitive.AWTImageGenerator
getAWTFont, getBackgroundColor, getFont, getForegroundColor, hasBackground, setAWTFont, setBackgroundColor, setFont, setForegroundColor, setHasBackground
-
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
-
tickProvider
-
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
-
-
Constructor Details
-
AWTColorbarImageGenerator
public AWTColorbarImageGenerator(IColorMap map, float min, float max, ITickProvider provider, ITickRenderer renderer) -
AWTColorbarImageGenerator
public AWTColorbarImageGenerator(ColorMapper mapper, ITickProvider provider, ITickRenderer renderer)
-
-
Method Details
-
toImage
- Specified by:
toImage
in interfaceAWTImageGenerator
-
toImage
Renders the colorbar to an image. -
drawBarContour
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 byAWTAbstractImageGenerator.setFont(org.jzy3d.painters.Font)
- Parameters:
height
-barWidth
-graphic
-
-
drawBarColors
Draw a bar content using the provided color mapper.- Parameters:
height
-barWidth
-graphic
-
-
drawTextAnnotations
-
getPixelScale
-
setPixelScale
-
getScaledBarWidth
public int getScaledBarWidth() -
getBarWidth
public int getBarWidth() -
getTextToBarHorizontalMargin
public int getTextToBarHorizontalMargin() -
setTextToBarHorizontalMargin
public void setTextToBarHorizontalMargin(int textToBarHorizontalMargin) -
getPreferredWidth
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 togetPreferredWidth(IPainter)
- Returns:
-
getMaxTickLabelWidth
-
getTickProvider
-
setTickProvider
-
getTickRenderer
-
setTickRenderer
-