visad
Class BaseColorControl
- java.lang.Object
-
- visad.Control
-
- visad.BaseColorControl
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
- Direct Known Subclasses:
- ColorAlphaControl, ColorControl
public class BaseColorControl extends Control
BaseColorControl is the VisAD class for controlling N-component Color DisplayRealType-s.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static intALPHAThe index of the alpha channel.static intBLUEThe index of the color bluestatic intDEFAULT_NUMBER_OF_COLORSThe default number of colorsstatic intGREENThe index of the color greenstatic intREDThe index of the color red
-
Constructor Summary
Constructors Constructor and Description BaseColorControl(DisplayImpl d, int components)Create a basic color control.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.Objectclone()booleanequals(java.lang.Object o)Returntrueif this object is "equal" to the parameter.FunctiongetFunction()Return the color lookupFunction.intgetNumberOfColors()Get the number of colors in the table.intgetNumberOfComponents()Get the number of components of the range.java.lang.StringgetSaveString()If the colors are defined using a color table, get aStringthat can be used to reconstruct this object later.float[][]getTable()Get the table of colors.voidinitGreyWedge()Initialize the colormap to a grey wedgevoidinitGreyWedge(boolean invert)voidinitHSV()Initialize the colormap to Hue-Saturation-Valuestatic float[][]initTableGreyWedge(float[][] table)Initialize table to a grey wedge.static float[][]initTableGreyWedge(float[][] table, boolean invert)static float[][]initTableHSV(float[][] table)Initialize table to the Hue-Saturation-Value colormap.static float[][]initTableVis5D(float[][] table)Initialize table to the Vis5D colormap (opaque blue-green-red rainbow).voidinitVis5D()Initialize the colormap to the VisAD sine wavesfloat[][]lookupRange(int left, int right)Return a list of colors for the specified range.float[][]lookupValues(float[] values)Return a list of colors for specified values.voidsetFunction(Function func)Define the color lookup by aFunction, whoseMathTypemust have a 1-D domain and a 3-D or 4-DRealTupleTyperange; the domain and rangeReals must vary over the range (0.0, 1.0)voidsetRange(int left, int right, float[][] colors)Set the specified range to the specified colors.voidsetSaveString(java.lang.String save)Reconstruct this control using the specified save string.voidsetTable(float[][] t)Define the color lookup by an array offloats which must have the formfloat[components][table_length]; values should be in the range (0.0, 1.0)voidsyncControl(Control rmt)Copy the state of a remote control to this control.java.lang.StringtoString()-
Methods inherited from class visad.Control
addControlListener, animation_string, changeControl, checkTicks, getDisplay, getDisplayRenderer, getInstanceNumber, incTick, nullControl, peekTicks, removeControlListener, resetTicks, setTicks, subCheckTicks, subPeekTicks, subResetTicks, subSetTicks
-
-
-
-
Field Detail
-
RED
public static final int RED
The index of the color red- See Also:
- Constant Field Values
-
GREEN
public static final int GREEN
The index of the color green- See Also:
- Constant Field Values
-
BLUE
public static final int BLUE
The index of the color blue- See Also:
- Constant Field Values
-
ALPHA
public static final int ALPHA
The index of the alpha channel.NOTE: ALPHA will always be the last index.
- See Also:
- Constant Field Values
-
DEFAULT_NUMBER_OF_COLORS
public static final int DEFAULT_NUMBER_OF_COLORS
The default number of colors- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BaseColorControl
public BaseColorControl(DisplayImpl d, int components)
Create a basic color control.- Parameters:
d- The display with which this control is associated.components- Either 3 (if this is a red/green/blue control) or 4 (if there is also an alpha component).
-
-
Method Detail
-
initTableGreyWedge
public static float[][] initTableGreyWedge(float[][] table)
Initialize table to a grey wedge.- Parameters:
table- Table to be initialized.- Returns:
- the initialized table.
-
initTableGreyWedge
public static float[][] initTableGreyWedge(float[][] table, boolean invert)
-
initGreyWedge
public void initGreyWedge()
Initialize the colormap to a grey wedge
-
initGreyWedge
public void initGreyWedge(boolean invert)
-
initTableVis5D
public static float[][] initTableVis5D(float[][] table)
Initialize table to the Vis5D colormap (opaque blue-green-red rainbow).- Parameters:
table- Table to be initialized.- Returns:
- the initialized table.
-
initVis5D
public void initVis5D()
Initialize the colormap to the VisAD sine waves
-
initTableHSV
public static float[][] initTableHSV(float[][] table)
Initialize table to the Hue-Saturation-Value colormap.- Parameters:
table- Table to be initialized.- Returns:
- the initialized table.
-
initHSV
public void initHSV()
Initialize the colormap to Hue-Saturation-Value
-
getNumberOfComponents
public int getNumberOfComponents()
Get the number of components of the range.- Returns:
- Either 3 or 4
-
getNumberOfColors
public int getNumberOfColors()
Get the number of colors in the table.- Returns:
- The number of colors in the colormap.
-
setFunction
public void setFunction(Function func) throws java.rmi.RemoteException, VisADException
Define the color lookup by aFunction, whoseMathTypemust have a 1-D domain and a 3-D or 4-DRealTupleTyperange; the domain and rangeReals must vary over the range (0.0, 1.0)- Parameters:
func- The newFunction.- Throws:
java.rmi.RemoteException- If there was an RMI-related problem.VisADException- If there was a problem with the function.
-
getFunction
public Function getFunction()
Return the color lookupFunction.- Returns:
- The function which defines this object's colors.
-
setTable
public void setTable(float[][] t) throws java.rmi.RemoteException, VisADExceptionDefine the color lookup by an array offloats which must have the formfloat[components][table_length]; values should be in the range (0.0, 1.0)- Parameters:
t- The new table of colors.- Throws:
java.rmi.RemoteException- If there was a problem changing the control.VisADException- If there is a problem with the table.
-
getTable
public float[][] getTable()
Get the table of colors.- Returns:
- The color table.
-
getSaveString
public java.lang.String getSaveString()
If the colors are defined using a color table, get aStringthat can be used to reconstruct this object later. If the colors are defined using aFunction, return null.- Specified by:
getSaveStringin classControl- Returns:
- The save string describing this object.
-
setSaveString
public void setSaveString(java.lang.String save) throws java.rmi.RemoteException, VisADExceptionReconstruct this control using the specified save string.- Specified by:
setSaveStringin classControl- Parameters:
save- The save string.- Throws:
VisADException- If the save string is not valid.java.rmi.RemoteException- If there was a problem setting the table.
-
lookupValues
public float[][] lookupValues(float[] values) throws java.rmi.RemoteException, VisADExceptionReturn a list of colors for specified values.- Parameters:
values- The values to look up. It is expected that they nominally lie in the range of 0 through 1. Values outside this range will be assigned the color of the nearest end. NaN values will be assigned NaN colors.- Returns:
- The list of colors. Element
[i][j]is the value of thei-th color component forvalues[j], whereiisRED,GREEN,BLUE, orALPHA. A component value is in the range from 0 through 1, or is NaN. - Throws:
java.rmi.RemoteException- If there was an RMI-related problem.VisADException- If the function encountered a problem.
-
lookupRange
public float[][] lookupRange(int left, int right) throws VisADException, java.rmi.RemoteExceptionReturn a list of colors for the specified range.- Throws:
VisADExceptionjava.rmi.RemoteException
-
setRange
public void setRange(int left, int right, float[][] colors) throws VisADException, java.rmi.RemoteExceptionSet the specified range to the specified colors.- Throws:
VisADExceptionjava.rmi.RemoteException
-
syncControl
public void syncControl(Control rmt) throws VisADException
Copy the state of a remote control to this control.- Specified by:
syncControlin classControl- Parameters:
rmt- The control to be copied.- Throws:
VisADException- If the remote control cannot be copied.
-
equals
public boolean equals(java.lang.Object o)
Returntrueif this object is "equal" to the parameter.
-
clone
public java.lang.Object clone()
-
-
DMelt 3.0 © DataMelt by jWork.ORG