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 intprotected intprotected doubleprotected doubleprotected doubleprotected doubleprotected doubleprotected doubleprotected doubleprotected double -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedColorSurfaceData(int nX, int nY) The data set constructor with size of the grid. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddValue(double x, double y) Bins value into the 2D array for x and y with weight = 1.abstract voidaddValue(double x, double y, double value) Bins value into the 2D array for x and y with weight = value.voidCalculates minimal and maximal Z values.getColor(double x, double y) Returns the color for (x,y) point.Returns the color generator instance.doublegetMaxX()Returns the maximal X value of the grid.doublegetMaxY()Returns the maximal Y value of the grid.doublegetMaxZ()Returns the maximal Z value.doublegetMinX()Returns the minimal X value of the grid.doublegetMinY()Returns the minimal Y value of the grid.doublegetMinZ()Returns the minimal Z value.intReturns the horizontal screen resolution.intReturns the vertical screen resolution.intgetSizeX()Returns the X size of the 2D array.intgetSizeY()Returns the Y size of the 2D array.abstract doublegetValue(double x, double y) Returns the interpolated value of the 2D array for x and y.doublegetValue(int i, int j) Returns the value of the 2D array with indexes i and j.doublegetX(int i) Returns the X value of the grid for the index i.doublegetY(int j) Returns the Y value of the grid for the index j.voidmultiplyBy(double value) Multiplies all values of the 2D array by constant factor = value.voidsetColorGenerator(ColorGenerator colorGen) Sets the color generator.voidsetMinMaxX(double xMin, double xMax) Sets the minimal maximal X value of the grid.voidsetMinMaxY(double yMin, double yMax) Sets the minimal maximal Y value of the grid.voidsetScreenResolution(int nScreenX, int nScreenY) Sets the screen resolution.voidsetSize(int nX, int nY) Sets data size.voidsetValue(int i, int j, double value) Sets value of the 2D array with indexes i and j.voidsetZero()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.
-