Class AWTLegend
- java.lang.Object
-
- org.jzy3d.plot3d.rendering.view.AbstractViewportManager
-
- org.jzy3d.plot3d.rendering.view.AWTImageViewport
-
- org.jzy3d.plot3d.rendering.legends.AWTLegend
-
- All Implemented Interfaces:
IDrawableListener
,ILegend
,IImageViewport
- Direct Known Subclasses:
AWTColorbarLegend
,AWTSerieLegend
,AWTSeriesLegend
public abstract class AWTLegend extends AWTImageViewport implements IDrawableListener, ILegend
AAWTLegend
represent information concerning aDrawable
that may be displayed as a metadata in theChartView
.ChartView
renders legend on the right side of the chart, hence avoiding superposition of legend and chart. The constructor of aAWTLegend
registers itself as listener of its parentDrawable
, and unregister itself when it is disposed. When defining a concreteAWTLegend
, one should:- override the
toImage(int,int)
method, that defines the picture representation. - override the
drawableChanged(org.jzy3d.events.DrawableChangedEvent)
method, that must select events that actually triggers an image update.
AWTLegend
optimizes rendering by :- storing current image dimension,
- computing a new image only if the required
AWTLegend
dimensions changed.
- Author:
- Martin Pernollet
-
-
Field Summary
Fields Modifier and Type Field Description protected Color
background
protected Drawable
drawable
protected Color
foreground
protected AWTImageGenerator
imageGenerator
protected Dimension
minimumDimension
-
Fields inherited from class org.jzy3d.plot3d.rendering.view.AWTImageViewport
image, IMAGE_Z, imageData, imageHeight, imageWidth, margin, pixelScale
-
Fields inherited from class org.jzy3d.plot3d.rendering.view.AbstractViewportManager
apply_WindowsHiDPI_Workaround, lastViewPort, mode, ratioHeight, ratioWidth, screenBottom, screenGridDisplayed, screenHeight, screenLeft, screenSquaredDim, screenWidth, screenXOffset, screenYOffset
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
dispose()
void
drawableChanged(DrawableChangedEvent e)
Color
getBackground()
Color
getForeground()
Dimension
getMinimumDimension()
Return the minimum size for this graphic.void
saveImage(String filename)
void
setBackground(Color background)
void
setForeground(Color foreground)
void
setGeneratorColors()
void
setMinimumDimension(Dimension dimension)
void
setMinimumWidth(int minimumWidth)
void
setViewPort(int width, int height, float left, float right)
Defines viewport dimensions, and precompute an image if required (i.e. if the viewport dimension have changedabstract BufferedImage
toImage(int width, int height)
void
updateImage()
Recompute the picture, using last used dimensions.-
Methods inherited from class org.jzy3d.plot3d.rendering.view.AWTImageViewport
getImage, getMargin, render, renderImage, setImage, setImage, setImage, setMargin, updatePixelScale
-
Methods inherited from class org.jzy3d.plot3d.rendering.view.AbstractViewportManager
applyViewport, getLastViewPort, getRectangle, getScreenBottom, getScreenHeight, getScreenLeft, getScreenWidth, getScreenXOffset, getScreenYOffset, getSliceWidth, getViewportMode, 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.view.IImageViewport
getLastViewPort, getSliceWidth, getViewportMode, render, setViewPort, setViewPort, setViewportMode
-
-
-
-
Field Detail
-
drawable
protected Drawable drawable
-
foreground
protected Color foreground
-
background
protected Color background
-
minimumDimension
protected Dimension minimumDimension
-
imageGenerator
protected AWTImageGenerator imageGenerator
-
-
Method Detail
-
dispose
public void dispose()
-
toImage
public abstract BufferedImage toImage(int width, int height)
-
setViewPort
public void setViewPort(int width, int height, float left, float right)
Defines viewport dimensions, and precompute an image if required (i.e. if the viewport dimension have changed- Specified by:
setViewPort
in interfaceIImageViewport
- Overrides:
setViewPort
in classAbstractViewportManager
- Parameters:
width
- the width of the target window.height
- the height of the target window.left
- the width's ratio where this subscreen starts in the target window.right
- the width's ratio where this subscreen stops in the target window.
-
drawableChanged
public void drawableChanged(DrawableChangedEvent e)
- Specified by:
drawableChanged
in interfaceIDrawableListener
- Specified by:
drawableChanged
in interfaceILegend
-
updateImage
public void updateImage()
Description copied from interface:ILegend
Recompute the picture, using last used dimensions.- Specified by:
updateImage
in interfaceILegend
-
saveImage
public void saveImage(String filename) throws IOException
- Throws:
IOException
-
getMinimumDimension
public Dimension getMinimumDimension()
Description copied from class:AWTImageViewport
Return the minimum size for this graphic.- Specified by:
getMinimumDimension
in interfaceIImageViewport
- Overrides:
getMinimumDimension
in classAWTImageViewport
-
setMinimumDimension
public void setMinimumDimension(Dimension dimension)
-
setMinimumWidth
public void setMinimumWidth(int minimumWidth)
-
setGeneratorColors
public void setGeneratorColors()
-
getForeground
public Color getForeground()
-
setForeground
public void setForeground(Color foreground)
-
getBackground
public Color getBackground()
-
setBackground
public void setBackground(Color background)
-
-