Package xal.extension.widgets.plot
Class ColorSurfaceData
java.lang.Object
xal.extension.widgets.plot.ColorSurfaceData
- Direct Known Subclasses:
BlackAndWhite3D
,LinearData3D
,PointLike3D
,SmoothData3D
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.
- Version:
- 1.0
- Author:
- A. Shishlo
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected double[][]
The values on the 2D grid.protected int
protected int
protected double
protected double
protected double
protected double
protected double
protected double
protected double
protected double
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ColorSurfaceData
(int nX, int nY) The data set constructor with size of the grid. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
Calculates minimal and maximal Z values.getColor
(double x, double y) Returns the color for (x,y) point.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
Returns the horizontal screen resolution.int
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 xMin, double xMax) Sets the minimal maximal X value of the grid.void
setMinMaxY
(double yMin, double yMax) 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.
-
Field Details
-
gridData
protected double[][] gridDataThe values on the 2D grid. -
nX
protected int nX -
nY
protected int nY -
xStep
protected double xStep -
yStep
protected double yStep -
xMin
protected double xMin -
xMax
protected double xMax -
yMin
protected double yMin -
yMax
protected double yMax -
zMin
protected double zMin -
zMax
protected double zMax
-
-
Constructor Details
-
ColorSurfaceData
protected ColorSurfaceData(int nX, int nY) The data set constructor with size of the grid.
-
-
Method Details
-
setColorGenerator
Sets the color generator. -
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 xMin, double xMax) Sets the minimal maximal X value of the grid. -
setMinMaxY
public void setMinMaxY(double yMin, double yMax) 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 beginning all data = 0., and if you want to get real min and max for Z you should use this method first. -
getColor
Returns the color for (x,y) point.
-