org.colos.ejs.library.control.drawables
Class Plot2DWrapper

java.lang.Object
  extended by org.colos.ejs.library.control.drawables.Plot2DWrapper
All Implemented Interfaces:
Drawable, Measurable, Plot2D

public class Plot2DWrapper
extends java.lang.Object
implements Plot2D

A wrapper for a plot2D that changes in run-time


Field Summary
 
Fields inherited from interface org.opensourcephysics.display2d.Plot2D
CONTOUR_PLOT, GRID_PLOT, INTERPOLATED_PLOT, SURFACE_PLOT
 
Constructor Summary
Plot2DWrapper()
           
 
Method Summary
 void draw(DrawingPanel panel, java.awt.Graphics g)
          Draws a representation of an object in a drawing panel.
 double getCeiling()
          Gets the ceiling for scaling the z data.
 double getFloor()
          Gets the floor for scaling the z data.
 GridData getGridData()
          Gets the GridData object.
 double getXMax()
          Gets the maximum x needed to draw this object.
 double getXMin()
          Gets the minimum x needed to draw this object.
 double getYMax()
          Gets the maximum y needed to draw this object.
 double getYMin()
          Gets the minimum y needed to draw this object.
 double indexToX(int i)
          Gets the x coordinate for the given index.
 double indexToY(int i)
          Gets the y coordinate for the given index.
 boolean isAutoscaleZ()
          Gets the autoscale flag for z.
 boolean isMeasured()
          Determines if information is available to set min/max values.
 boolean isSymmetricZ()
          Gets the symmetric z flag.
 void setAll(java.lang.Object val)
          Sets the data to new values.
 void setAll(java.lang.Object obj, double xmin, double xmax, double ymin, double ymax)
          Sets the values and the scale.
 void setAutoscaleZ(boolean isAutoscale, double floor, double ceil)
          Sets the autoscale flag and the floor and ceiling values for the colors.
 void setColorPalette(java.awt.Color[] colors)
          Sets the colors that will be used between the floor and ceiling values.
 void setExpandedZ(boolean expanded, double factor)
          Expands the z scale so as to enhance values close to zero.
 void setFloorCeilColor(java.awt.Color floorColor, java.awt.Color ceilColor)
          Sets the floor and ceiling colors.
 void setGridData(GridData _griddata)
          Sets the data storage to the given value.
 void setGridLineColor(java.awt.Color c)
          Sets the color for grid line boundaries
 void setIndexes(int[] indexes)
          Sets the indexes for the data components that will be plotted.
 void setPaletteType(int type)
          Determines the palette type that will be used.
 void setShowGridLines(boolean showGrid)
          Outlines the data grid's boundaries.
 void setSymmetricZ(boolean symmetric)
          Forces the z-scale to be symmetric about zero.
 void setVisible(boolean isVisible)
          Sets the visibility of the plot.
 javax.swing.JFrame showLegend()
          Shows how values map to colors.
 void update()
          Updates this object's state using new data values.
 int xToIndex(double x)
          Gets closest index from the given x world coordinate.
 int yToIndex(double y)
          Gets closest index from the given y world coordinate.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Plot2DWrapper

public Plot2DWrapper()
Method Detail

setAll

public void setAll(java.lang.Object val)
Description copied from interface: Plot2D
Sets the data to new values. The grid is resized to fit the new data if needed.

Specified by:
setAll in interface Plot2D
Parameters:
val - an array of new values

setAll

public void setAll(java.lang.Object obj,
                   double xmin,
                   double xmax,
                   double ymin,
                   double ymax)
Description copied from interface: Plot2D
Sets the values and the scale. The grid is resized to fit the new data if needed.

Specified by:
setAll in interface Plot2D
Parameters:
obj - array of new values
xmin - double
xmax - double
ymin - double
ymax - double

setGridData

public void setGridData(GridData _griddata)
Description copied from interface: Plot2D
Sets the data storage to the given value.

Specified by:
setGridData in interface Plot2D

getGridData

public GridData getGridData()
Description copied from interface: Plot2D
Gets the GridData object.

Specified by:
getGridData in interface Plot2D
Returns:
GridData

indexToX

public double indexToX(int i)
Description copied from interface: Plot2D
Gets the x coordinate for the given index.

Specified by:
indexToX in interface Plot2D
Parameters:
i - int
Returns:
double the x coordinate

indexToY

public double indexToY(int i)
Description copied from interface: Plot2D
Gets the y coordinate for the given index.

Specified by:
indexToY in interface Plot2D
Parameters:
i - int
Returns:
double the y coordinate

xToIndex

public int xToIndex(double x)
Description copied from interface: Plot2D
Gets closest index from the given x world coordinate.

Specified by:
xToIndex in interface Plot2D
Parameters:
x - double the coordinate
Returns:
int the index

yToIndex

public int yToIndex(double y)
Description copied from interface: Plot2D
Gets closest index from the given y world coordinate.

Specified by:
yToIndex in interface Plot2D
Parameters:
y - double the coordinate
Returns:
int the index

isAutoscaleZ

public boolean isAutoscaleZ()
Description copied from interface: Plot2D
Gets the autoscale flag for z.

Specified by:
isAutoscaleZ in interface Plot2D
Returns:
boolean

getFloor

public double getFloor()
Description copied from interface: Plot2D
Gets the floor for scaling the z data.

Specified by:
getFloor in interface Plot2D
Returns:
double

getCeiling

public double getCeiling()
Description copied from interface: Plot2D
Gets the ceiling for scaling the z data.

Specified by:
getCeiling in interface Plot2D
Returns:
double

setAutoscaleZ

public void setAutoscaleZ(boolean isAutoscale,
                          double floor,
                          double ceil)
Description copied from interface: Plot2D
Sets the autoscale flag and the floor and ceiling values for the colors. If autoscaling is true, then the min and max values of z are span the colors. If autoscaling is false, then floor and ceiling values limit the colors. Values below min map to the first color; values above max map to the last color.

Specified by:
setAutoscaleZ in interface Plot2D

setFloorCeilColor

public void setFloorCeilColor(java.awt.Color floorColor,
                              java.awt.Color ceilColor)
Description copied from interface: Plot2D
Sets the floor and ceiling colors.

Specified by:
setFloorCeilColor in interface Plot2D

setColorPalette

public void setColorPalette(java.awt.Color[] colors)
Description copied from interface: Plot2D
Sets the colors that will be used between the floor and ceiling values.

Specified by:
setColorPalette in interface Plot2D

setPaletteType

public void setPaletteType(int type)
Description copied from interface: Plot2D
Determines the palette type that will be used.

Specified by:
setPaletteType in interface Plot2D

setGridLineColor

public void setGridLineColor(java.awt.Color c)
Description copied from interface: Plot2D
Sets the color for grid line boundaries

Specified by:
setGridLineColor in interface Plot2D

setShowGridLines

public void setShowGridLines(boolean showGrid)
Description copied from interface: Plot2D
Outlines the data grid's boundaries.

Specified by:
setShowGridLines in interface Plot2D

showLegend

public javax.swing.JFrame showLegend()
Description copied from interface: Plot2D
Shows how values map to colors.

Specified by:
showLegend in interface Plot2D

setVisible

public void setVisible(boolean isVisible)
Description copied from interface: Plot2D
Sets the visibility of the plot. Drawing will be disabled if visible is false.

Specified by:
setVisible in interface Plot2D

setIndexes

public void setIndexes(int[] indexes)
Description copied from interface: Plot2D
Sets the indexes for the data components that will be plotted. Indexes determine the postion of the amplitude, phase, x-component, and y-component data in the data array. The amplitude index is usually the first index.

Specified by:
setIndexes in interface Plot2D
Parameters:
indexes - the sample-component indexes

update

public void update()
Description copied from interface: Plot2D
Updates this object's state using new data values. Update should be invoked if the data in the PointData object changes or if the z scale of the PointData object changes.

Specified by:
update in interface Plot2D

setExpandedZ

public void setExpandedZ(boolean expanded,
                         double factor)
Description copied from interface: Plot2D
Expands the z scale so as to enhance values close to zero.

Specified by:
setExpandedZ in interface Plot2D
Parameters:
expanded - boolean
factor - double

setSymmetricZ

public void setSymmetricZ(boolean symmetric)
Description copied from interface: Plot2D
Forces the z-scale to be symmetric about zero. Forces zmax to be positive and zmin=-zmax when in autoscale mode.

Specified by:
setSymmetricZ in interface Plot2D

isSymmetricZ

public boolean isSymmetricZ()
Description copied from interface: Plot2D
Gets the symmetric z flag.

Specified by:
isSymmetricZ in interface Plot2D

getXMin

public double getXMin()
Description copied from interface: Measurable
Gets the minimum x needed to draw this object.

Specified by:
getXMin in interface Measurable
Returns:
minimum

getXMax

public double getXMax()
Description copied from interface: Measurable
Gets the maximum x needed to draw this object.

Specified by:
getXMax in interface Measurable
Returns:
maximum

getYMin

public double getYMin()
Description copied from interface: Measurable
Gets the minimum y needed to draw this object.

Specified by:
getYMin in interface Measurable
Returns:
minimum

getYMax

public double getYMax()
Description copied from interface: Measurable
Gets the maximum y needed to draw this object.

Specified by:
getYMax in interface Measurable
Returns:
minimum

isMeasured

public boolean isMeasured()
Description copied from interface: Measurable
Determines if information is available to set min/max values. Objects that store data should return false if data is null.

Specified by:
isMeasured in interface Measurable
Returns:
true if min/max values are valid

draw

public void draw(DrawingPanel panel,
                 java.awt.Graphics g)
Description copied from interface: Drawable
Draws a representation of an object in a drawing panel.

Specified by:
draw in interface Drawable