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
AAWTLegendrepresent information concerning aDrawablethat may be displayed as a metadata in theChartView. The constructor of aAWTLegendregisters 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.
AWTLegendoptimizes rendering by :- storing current image dimension,
- computing a new image only if the required
AWTLegenddimensions changed.
- Author:
- Martin Pernollet
-
-
Field Summary
Fields Modifier and Type Field Description protected Colorbackgroundprotected Drawabledrawableprotected Colorforegroundprotected AWTImageGeneratorimageGeneratorprotected DimensionminimumDimension-
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
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voiddispose()voiddrawableChanged(DrawableChangedEvent e)ColorgetBackground()ColorgetForeground()DimensiongetMinimumDimension()DimensiongetMinimumSize()Return the minimum size for this graphic.voidsaveImage(String filename)voidsetBackground(Color background)voidsetForeground(Color foreground)voidsetGeneratorColors()voidsetMinimumDimension(Dimension minimumDimension)voidsetMinimumSize(Dimension dimension)voidsetMinimumWidth(int minimumWidth)voidsetViewPort(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 BufferedImagetoImage(int width, int height)voidupdateImage()Recompute the picture, using last used dimensions.-
Methods inherited from class org.jzy3d.plot3d.rendering.view.AWTImageViewport
getImage, getPreferedSize, render, renderImage, setImage, setImage, setImage, updatePixelScale
-
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.view.IImageViewport
getLastViewPort, getMode, getPreferedSize, getSliceWidth, 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:
setViewPortin interfaceIImageViewport- Overrides:
setViewPortin 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:
drawableChangedin interfaceIDrawableListener- Specified by:
drawableChangedin interfaceILegend
-
updateImage
public void updateImage()
Description copied from interface:ILegendRecompute the picture, using last used dimensions.- Specified by:
updateImagein interfaceILegend
-
saveImage
public void saveImage(String filename) throws IOException
- Throws:
IOException
-
getMinimumSize
public Dimension getMinimumSize()
Description copied from class:AWTImageViewportReturn the minimum size for this graphic.- Specified by:
getMinimumSizein interfaceIImageViewport- Overrides:
getMinimumSizein classAWTImageViewport
-
setMinimumSize
public void setMinimumSize(Dimension dimension)
-
setGeneratorColors
public void setGeneratorColors()
-
getForeground
public Color getForeground()
-
setForeground
public void setForeground(Color foreground)
-
getBackground
public Color getBackground()
-
setBackground
public void setBackground(Color background)
-
getMinimumDimension
public Dimension getMinimumDimension()
-
setMinimumDimension
public void setMinimumDimension(Dimension minimumDimension)
-
setMinimumWidth
public void setMinimumWidth(int minimumWidth)
-
-