org.opensourcephysics.display2d
Interface Plot2D

All Superinterfaces:
Drawable, Measurable
All Known Implementing Classes:
Carpet, ComplexCarpet, ComplexContourPlot, ComplexGridPlot, ComplexInterpolatedPlot, ComplexSurfacePlot, ContourPlot, GrayscalePlot, GridPlot, InterpolatedPlot, SurfacePlot, VectorPlot

public interface Plot2D
extends Measurable

The Plot2D interface defines common methods for 2d-plotting such as a GridPlot, a VectorPlot, or a ContourPlot. Data must be stored in a GridData object.

Version:
1.0
Author:
Wolfgang Christian

Field Summary
static int CONTOUR_PLOT
           
static int GRID_PLOT
           
static int INTERPOLATED_PLOT
           
static int SURFACE_PLOT
           
 
Method Summary
 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 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.
 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 expansionFactor)
          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 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 interface org.opensourcephysics.display.Measurable
getXMax, getXMin, getYMax, getYMin, isMeasured
 
Methods inherited from interface org.opensourcephysics.display.Drawable
draw
 

Field Detail

GRID_PLOT

static final int GRID_PLOT
See Also:
Constant Field Values

INTERPOLATED_PLOT

static final int INTERPOLATED_PLOT
See Also:
Constant Field Values

CONTOUR_PLOT

static final int CONTOUR_PLOT
See Also:
Constant Field Values

SURFACE_PLOT

static final int SURFACE_PLOT
See Also:
Constant Field Values
Method Detail

setAll

void setAll(java.lang.Object val)
Sets the data to new values. The grid is resized to fit the new data if needed.

Parameters:
val - an array of new values

setAll

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

Parameters:
obj - array of new values
xmin - double
xmax - double
ymin - double
ymax - double

setGridData

void setGridData(GridData _griddata)
Sets the data storage to the given value.

Parameters:
_griddata -

getGridData

GridData getGridData()
Gets the GridData object.

Returns:
GridData

indexToX

double indexToX(int i)
Gets the x coordinate for the given index.

Parameters:
i - int
Returns:
double the x coordinate

indexToY

double indexToY(int i)
Gets the y coordinate for the given index.

Parameters:
i - int
Returns:
double the y coordinate

xToIndex

int xToIndex(double x)
Gets closest index from the given x world coordinate.

Parameters:
x - double the coordinate
Returns:
int the index

yToIndex

int yToIndex(double y)
Gets closest index from the given y world coordinate.

Parameters:
y - double the coordinate
Returns:
int the index

isAutoscaleZ

boolean isAutoscaleZ()
Gets the autoscale flag for z.

Returns:
boolean

getFloor

double getFloor()
Gets the floor for scaling the z data.

Returns:
double

getCeiling

double getCeiling()
Gets the ceiling for scaling the z data.

Returns:
double

setAutoscaleZ

void setAutoscaleZ(boolean isAutoscale,
                   double floor,
                   double ceil)
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.

Parameters:
isAutoscale -
floor -
ceil -

setFloorCeilColor

void setFloorCeilColor(java.awt.Color floorColor,
                       java.awt.Color ceilColor)
Sets the floor and ceiling colors.

Parameters:
floorColor -
ceilColor -

setColorPalette

void setColorPalette(java.awt.Color[] colors)
Sets the colors that will be used between the floor and ceiling values.

Parameters:
colors -

setPaletteType

void setPaletteType(int type)
Determines the palette type that will be used.

Parameters:
type -

setGridLineColor

void setGridLineColor(java.awt.Color c)
Sets the color for grid line boundaries

Parameters:
c -

setShowGridLines

void setShowGridLines(boolean showGrid)
Outlines the data grid's boundaries.

Parameters:
showGrid -

showLegend

javax.swing.JFrame showLegend()
Shows how values map to colors.


setVisible

void setVisible(boolean isVisible)
Sets the visibility of the plot. Drawing will be disabled if visible is false.

Parameters:
isVisible -

setIndexes

void setIndexes(int[] indexes)
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.

Parameters:
indexes - the sample-component indexes

update

void update()
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.


setExpandedZ

void setExpandedZ(boolean expanded,
                  double expansionFactor)
Expands the z scale so as to enhance values close to zero.

Parameters:
expanded - boolean
expansionFactor - double