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
FieldsModifier and TypeFieldDescriptionprotected booleanstatic intprotected intprotected ColorMapperprotected doubleprotected intprotected doublestatic final intstatic final intprotected Coord2dstatic intprotected intprotected ITickProviderprotected ITickRendererFields inherited from class org.jzy3d.plot2d.primitive.AWTAbstractImageGenerator
awtFont, backgroundColor, font, foregroundColor, hasBackground, textSize -
Constructor Summary
ConstructorsConstructorDescriptionAWTColorbarImageGenerator(ColorMapper mapper, ITickProvider provider, ITickRenderer renderer) AWTColorbarImageGenerator(IColorMap map, float min, float max, ITickProvider provider, ITickRenderer renderer) -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddrawBarColors(int height, int barWidth, Graphics2D graphic) Draw a bar content using the provided color mapper.protected voiddrawBarContour(int height, int barWidth, Graphics2D graphic) Draw a bar border.protected voiddrawTextAnnotations(int height, int barWidth, Graphics2D graphic) intintOnly valid after a call togetPreferredWidth(IPainter)intgetMaxTickLabelWidth(IPainter painter) protected intgetPreferredWidth(int maxTextWidth) intgetPreferredWidth(IPainter painter) Compute the optimal image width to contain the text as defined by the tick provided and renderer.intintvoidsetPixelScale(Coord2d pixelScale) voidsetTextToBarHorizontalMargin(int textToBarHorizontalMargin) voidsetTickProvider(ITickProvider tickProvider) voidsetTickRenderer(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, setHasBackgroundMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
toImagein 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
-