Class AWTColorbarLegend
- java.lang.Object
-
- org.jzy3d.plot3d.rendering.view.AbstractViewportManager
-
- org.jzy3d.plot3d.rendering.view.AWTImageViewport
-
- org.jzy3d.plot3d.rendering.legends.AWTLegend
-
- org.jzy3d.plot3d.rendering.legends.colorbars.AWTColorbarLegend
-
- All Implemented Interfaces:
IDrawableListener
,IColorbarLegend
,ILegend
,IImageViewport
public class AWTColorbarLegend extends AWTLegend implements IColorbarLegend
Handle a colorbar rendered as an AWTBufferedImage
.Content and coloring
A colorbar is configured with- a colormap defined by the input
Drawable
if it isIMultiColorable
and if it has aColorMapper
defined. - a set of axis ticks defined and formated by
IAxisLayout
.
Layout
The size of the colorbar image is driven byAWTLegend.setViewPort(int, int, float, float)
which indicates the canvas dimension on screen and the slice that the colorbar should occupy. The image width will beimageWidth = width * (right - left)
. The viewport is set byViewAndColorbarsLayout
.
ViewAndColorbarsLayout
which render the prepared image at the layout given position for this colorbar (which is defined with left/right parameters). Schema sourcesRendering path
EmulGL and Native have different rendering pathes- Native chart have their colorbar image rendered by
render(IPainter)
. - EmulGL chart have their colorbar image rendered by AWT as bypassed by
EmulGLViewAndColorbarLayout
, which customize the way pixel scale should be handled for rendering such image in a good layoout
-
-
Field Summary
Fields Modifier and Type Field Description protected int
askedHeight
protected int
askedWidth
protected ITickProvider
provider
protected ITickRenderer
renderer
-
Fields inherited from class org.jzy3d.plot3d.rendering.legends.AWTLegend
background, drawable, foreground, imageGenerator, minimumDimension
-
Fields inherited from class org.jzy3d.plot3d.rendering.view.AWTImageViewport
image, IMAGE_Z, imageData, imageHeight, imageWidth, margin, MARGIN_HEIGHT, MARGIN_WIDTH, pixelScale
-
Fields inherited from class org.jzy3d.plot3d.rendering.view.AbstractViewportManager
lastViewPort, mode, ratioHeight, ratioWidth, screenBottom, screenGridDisplayed, screenHeight, screenLeft, screenSquaredDim, screenWidth, screenXOffset, screenYOffset
-
-
Constructor Summary
Constructors Constructor Description AWTColorbarLegend(Drawable parent, Chart chart)
AWTColorbarLegend(Drawable parent, IAxisLayout layout)
AWTColorbarLegend(Drawable parent, IAxisLayout layout, Color foreground)
AWTColorbarLegend(Drawable parent, IAxisLayout layout, Color foreground, Color background)
AWTColorbarLegend(Drawable parent, ITickProvider provider, ITickRenderer renderer)
AWTColorbarLegend(Drawable parent, ITickProvider provider, ITickRenderer renderer, Color foreground, Color background)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Font
getFont()
int
getHeight()
AWTColorbarImageGenerator
getImageGenerator()
Dimension
getMargin()
int
getWidth()
protected void
initImageGenerator(Drawable parent, ITickProvider provider, ITickRenderer renderer)
void
render(IPainter painter)
Renders the picture into the window, according to the viewport settings.void
setFont(Font font)
Update image generator fontvoid
setMargin(Dimension margin)
BufferedImage
toImage(int width, int height)
BufferedImage
toImage(int width, int height, Dimension margin, Coord2d pixelScale)
void
updateImage()
Recompute the picture, using last used dimensions.protected void
updatePixelScale(Coord2d pixelScale)
Update the image with pixel scale if scale changed-
Methods inherited from class org.jzy3d.plot3d.rendering.legends.AWTLegend
dispose, drawableChanged, getBackground, getForeground, getMinimumDimension, getMinimumSize, saveImage, setBackground, setForeground, setGeneratorColors, setMinimumDimension, setMinimumSize, setMinimumWidth, setViewPort
-
Methods inherited from class org.jzy3d.plot3d.rendering.view.AWTImageViewport
getImage, getPreferedSize, renderImage, setImage, setImage, setImage
-
Methods inherited from class org.jzy3d.plot3d.rendering.view.AbstractViewportManager
applyViewport, getLastViewPort, getMode, getRectangle, getScreenBottom, getScreenHeight, getScreenLeft, getScreenWidth, getScreenXOffset, getScreenYOffset, getSliceWidth, isScreenGridDisplayed, renderSubScreenGrid, setScreenGridDisplayed, setViewPort, setViewPort, setViewportMode
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jzy3d.plot3d.rendering.legends.colorbars.IColorbarLegend
drawableChanged, getMinimumSize, setMinimumSize
-
Methods inherited from interface org.jzy3d.plot3d.rendering.view.IImageViewport
getLastViewPort, getMode, getPreferedSize, getSliceWidth, setViewPort, setViewPort, setViewportMode
-
-
-
-
Field Detail
-
provider
protected ITickProvider provider
-
renderer
protected ITickRenderer renderer
-
askedWidth
protected int askedWidth
-
askedHeight
protected int askedHeight
-
-
Constructor Detail
-
AWTColorbarLegend
public AWTColorbarLegend(Drawable parent, IAxisLayout layout)
-
AWTColorbarLegend
public AWTColorbarLegend(Drawable parent, IAxisLayout layout, Color foreground)
-
AWTColorbarLegend
public AWTColorbarLegend(Drawable parent, IAxisLayout layout, Color foreground, Color background)
-
AWTColorbarLegend
public AWTColorbarLegend(Drawable parent, ITickProvider provider, ITickRenderer renderer)
-
AWTColorbarLegend
public AWTColorbarLegend(Drawable parent, ITickProvider provider, ITickRenderer renderer, Color foreground, Color background)
-
-
Method Detail
-
initImageGenerator
protected void initImageGenerator(Drawable parent, ITickProvider provider, ITickRenderer renderer)
-
render
public void render(IPainter painter)
Description copied from interface:IImageViewport
Renders the picture into the window, according to the viewport settings. If the picture is bigger than the viewport, it is simply centered in it, otherwise, it is scaled in order to fit into the viewport.- Specified by:
render
in interfaceIColorbarLegend
- Specified by:
render
in interfaceIImageViewport
- Overrides:
render
in classAWTImageViewport
- Parameters:
painter
- TODO
-
toImage
public BufferedImage toImage(int width, int height)
-
toImage
public BufferedImage toImage(int width, int height, Dimension margin, Coord2d pixelScale)
-
updateImage
public void updateImage()
Description copied from interface:ILegend
Recompute the picture, using last used dimensions.- Specified by:
updateImage
in interfaceILegend
- Overrides:
updateImage
in classAWTLegend
-
getMargin
public Dimension getMargin()
-
setMargin
public void setMargin(Dimension margin)
-
updatePixelScale
protected void updatePixelScale(Coord2d pixelScale)
Update the image with pixel scale if scale changed- Overrides:
updatePixelScale
in classAWTImageViewport
-
setFont
public void setFont(Font font)
Update image generator font
-
getImageGenerator
public AWTColorbarImageGenerator getImageGenerator()
-
-