gov.sns.tools.plot
Class ColorSurfaceData

java.lang.Object
  |
  +--gov.sns.tools.plot.ColorSurfaceData
Direct Known Subclasses:
BlackAndWhite3D, LinearData3D, PointLike3D, SmoothData3D

public abstract class ColorSurfaceData
extends java.lang.Object

This class is a base abstract class for data used in the FunctionGraphsJPanel class. This class contains 2D grid with values at the grid points. These values will be presented as colored rectangles in the plot.


Field Summary
protected  double[][] gridData
          The values on the 2D grid.
protected  int nX
           
protected  int nY
           
protected  double x_max
           
protected  double x_min
           
protected  double x_step
           
protected  double y_max
           
protected  double y_min
           
protected  double y_step
           
protected  double z_max
           
protected  double z_min
           
 
Constructor Summary
ColorSurfaceData(int nX, int nY)
          The data set constructor with size of the grid.
 
Method Summary
 void addValue(double x, double y)
          Bins value into the 2D array for x and y with weight = 1.
abstract  void addValue(double x, double y, double value)
          Bins value into the 2D array for x and y with weight = value.
 void calcMaxMinZ()
          Calculates minimal and maximal Z values.
 java.awt.Color getColor(double x, double y)
          Returns the color for (x,y) point.
 ColorGenerator getColorGenerator()
          Returns the color generator instance.
 double getMaxX()
          Returns the maximal X value of the grid.
 double getMaxY()
          Returns the maximal Y value of the grid.
 double getMaxZ()
          Returns the maximal Z value.
 double getMinX()
          Returns the minimal X value of the grid.
 double getMinY()
          Returns the minimal Y value of the grid.
 double getMinZ()
          Returns the minimal Z value.
 int getScreenSizeX()
          Returns the horizontal screen resolution.
 int getScreenSizeY()
          Returns the vertical screen resolution.
 int getSizeX()
          Returns the X size of the 2D array.
 int getSizeY()
          Returns the Y size of the 2D array.
abstract  double getValue(double x, double y)
          Returns the interpolated value of the 2D array for x and y.
 double getValue(int i, int j)
          Returns the value of the 2D array with indexes i and j.
 double getX(int i)
          Returns the X value of the grid for the index i.
 double getY(int j)
          Returns the Y value of the grid for the index j.
 void multiplyBy(double value)
          Multiplies all values of the 2D array by constant factor = value.
 void setColorGenerator(ColorGenerator colorGen)
          Sets the color generator.
 void setMinMaxX(double x_min, double x_max)
          Sets the minimal maximal X value of the grid.
 void setMinMaxY(double y_min, double y_max)
          Sets the minimal maximal Y value of the grid.
 void setScreenResolution(int nScreenX, int nScreenY)
          Sets the screen resolution.
 void setSize(int nX, int nY)
          Sets data size.
 void setValue(int i, int j, double value)
          Sets value of the 2D array with indexes i and j.
 void setZero()
          Sets all values of the 2D array to 0.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gridData

protected double[][] gridData
The values on the 2D grid.


nX

protected int nX

nY

protected int nY

x_step

protected double x_step

y_step

protected double y_step

x_min

protected double x_min

x_max

protected double x_max

y_min

protected double y_min

y_max

protected double y_max

z_min

protected double z_min

z_max

protected double z_max
Constructor Detail

ColorSurfaceData

public ColorSurfaceData(int nX,
                        int nY)
The data set constructor with size of the grid.

Method Detail

setColorGenerator

public void setColorGenerator(ColorGenerator colorGen)
Sets the color generator.


getColorGenerator

public ColorGenerator getColorGenerator()
Returns the color generator instance.


setSize

public void setSize(int nX,
                    int nY)
Sets data size. It will clean the data inside.


setScreenResolution

public void setScreenResolution(int nScreenX,
                                int nScreenY)
Sets the screen resolution.


getScreenSizeX

public int getScreenSizeX()
Returns the horizontal screen resolution.


getScreenSizeY

public int getScreenSizeY()
Returns the vertical screen resolution.


getSizeX

public int getSizeX()
Returns the X size of the 2D array.


getSizeY

public int getSizeY()
Returns the Y size of the 2D array.


getX

public double getX(int i)
Returns the X value of the grid for the index i.


getY

public double getY(int j)
Returns the Y value of the grid for the index j.


getMinX

public double getMinX()
Returns the minimal X value of the grid.


getMaxX

public double getMaxX()
Returns the maximal X value of the grid.


getMinY

public double getMinY()
Returns the minimal Y value of the grid.


getMaxY

public double getMaxY()
Returns the maximal Y value of the grid.


getMinZ

public double getMinZ()
Returns the minimal Z value.


getMaxZ

public double getMaxZ()
Returns the maximal Z value.


setMinMaxX

public void setMinMaxX(double x_min,
                       double x_max)
Sets the minimal maximal X value of the grid.


setMinMaxY

public void setMinMaxY(double y_min,
                       double y_max)
Sets the minimal maximal Y value of the grid.


setZero

public void setZero()
Sets all values of the 2D array to 0.


setValue

public void setValue(int i,
                     int j,
                     double value)
Sets value of the 2D array with indexes i and j.


getValue

public double getValue(int i,
                       int j)
Returns the value of the 2D array with indexes i and j.


getValue

public abstract double getValue(double x,
                                double y)
Returns the interpolated value of the 2D array for x and y. The subclasses should implement this method to provide specific interpolation scheme.


addValue

public abstract void addValue(double x,
                              double y,
                              double value)
Bins value into the 2D array for x and y with weight = value. The subclasses should implement this method to provide specific interpolation scheme.


addValue

public void addValue(double x,
                     double y)
Bins value into the 2D array for x and y with weight = 1.


multiplyBy

public void multiplyBy(double value)
Multiplies all values of the 2D array by constant factor = value.


calcMaxMinZ

public void calcMaxMinZ()
Calculates minimal and maximal Z values. In the begining all data = 0., and if you want to get real min and max for Z you should use this method first.


getColor

public java.awt.Color getColor(double x,
                               double y)
Returns the color for (x,y) point.