All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class crw.data.PlotCanvas

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----crw.data.PlotCanvas

public class PlotCanvas
extends Canvas
Drawing canvas of data plot. Client codes add one or more Data object (whether Functiondata or ArrayData) to this drawing area. The rest is handled by the system. Namely, PlotCanvas puts the Data object within a DataWrapper object which stores and prepares all Data objects to plot. One and only one DataWrapper object is associated with this PlotCanvas and holds (contains) all data objects to plot in this drawing area. To plot an arbitrary data the client code only needs to specifiy the Data (function or array) to plot and add the instance objects into a PlotCanvas object using the addData() method. All methods except for the addData() and the setChanged() methods are for use by the system, not by the client. JDK1.0-compatible. To make it compatible with JDK1.1, replace size() by getSize().

Version:
1.0 4/1/1998
Author:
C.R.Wie

Constructor Index

 o PlotCanvas()

Method Index

 o addData(Data)
Adds the Data object to plot.
 o addNotify()
After calling super.addNotify(), it calls the Axis.init().
 o getAxis()
Used by the system.
 o getConversion()
Used by the system.
 o getData()
Returns the DataWrapper object which holds and prepares all physical Data objects for plot.
 o paint(Graphics)
Plots the data on this canvas.
 o removeAllData()
Removes all data previously added.
 o removeData(Data)
Removes a particular Data object.
 o setBkgd(boolean)
Sets the background image either as a Full Data Plot or as a naked Axis.
 o setChanged(boolean)
When the physical data parameters change the data arrays need to be recalculated and the background image need to be replotted.
 o update(Graphics)
Only calls paint(g).

Constructors

 o PlotCanvas
 public PlotCanvas()

Methods

 o addNotify
 public void addNotify()
After calling super.addNotify(), it calls the Axis.init().

Overrides:
addNotify in class Canvas
 o addData
 public void addData(Data d)
Adds the Data object to plot. Each curve (or curve family) corresponds to a Data object. Only one axis is plotted. Make sure that it makes sense to plot them together.

Parameters:
d - the Data object to plot.
 o removeAllData
 public void removeAllData()
Removes all data previously added. This empties the Vector in the DataWrapper object.

 o removeData
 public void removeData(Data d)
Removes a particular Data object.

Parameters:
d - the Data object to remove.
 o update
 public void update(Graphics g)
Only calls paint(g). No background erasing.

Overrides:
update in class Component
 o paint
 public void paint(Graphics g)
Plots the data on this canvas. Uses double buffering. The constant image is saved in an Image object. This contant image is first drawn, as a background, onto image object in background memory for double buffering and then the data are plotted such as current curve and current spot. The completed image object is drawn by drawImage().

Parameters:
g - the graphics context of this Canvas.
Overrides:
paint in class Canvas
 o setBkgd
 public void setBkgd(boolean isFullData)
Sets the background image either as a Full Data Plot or as a naked Axis.

Parameters:
isFullData - set to true if a full data plot is bkgrd.
 o getData
 public DataWrapper getData()
Returns the DataWrapper object which holds and prepares all physical Data objects for plot. Used by the system.

Returns:
the DataWrapper object of this plot area.
 o getAxis
 public Axis getAxis()
Used by the system.

Returns:
the Axis object of this plot.
 o getConversion
 public Conversion getConversion()
Used by the system.

Returns:
the Conversion factor object.
 o setChanged
 public void setChanged(boolean data)
When the physical data parameters change the data arrays need to be recalculated and the background image need to be replotted. This PlotCanvas object is notified of the changes through this method.

Parameters:
data - set to true if physical data has changed.

All Packages  Class Hierarchy  This Package  Previous  Next  Index