|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel visad.util.ColorMap visad.util.BaseRGBMap
public class BaseRGBMap
An extensible RGB colormap with no interpolation between the internally stored values. Click and drag with the left mouse button to draw the color curves. Click with the right or middle mouse button to alternate between the color curves.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static int |
DEFAULT_RESOLUTION
default resolution |
static boolean |
USE_COLOR_CURSORS
change this to true to use color cursors |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
BaseRGBMap(BaseColorControl ctl)
Construct a colormap from the specified control. |
|
BaseRGBMap(boolean hasAlpha)
Construct a BaseRGBMap with the default resolution |
|
BaseRGBMap(float[][] vals)
Construct a colormap initialized with the supplied tuples |
|
BaseRGBMap(float[][] vals,
boolean hasAlpha)
Deprecated. hasAlpha isn't really necessary. |
|
BaseRGBMap(int resolution,
boolean hasAlpha)
Construct a colormap with the specified resolution |
Method Summary | |
---|---|
void |
controlChanged(ControlEvent evt)
If the color data in the Control associated with this
widget's Control has changed, update the data in
the ColorMap . |
float[][] |
getColorMap()
Get the color map (as an array of float tuples. |
int |
getMapDimension()
Get the dimension of the map |
int |
getMapResolution()
Get the resolution of the map |
Dimension |
getPreferredSize()
Return the preferred size of this map, taking into account the resolution. |
float[] |
getRGBTuple(float value)
Implementation of the abstract function in ColorMap WARNING: This is a really slow way to get a color, so don't use it inside a loop. |
float[][] |
getRGBTuples(float startVal,
float endVal,
int num)
Implementation of the abstract function in ColorMap WARNING: This is a really slow way to get a color, so don't use it inside a loop. |
float[] |
getTuple(float value)
Returns the tuple at a floating point value val WARNING: This is a really slow way to get a color, so don't use it inside a loop. |
float[][] |
getTuples(float firstVal,
float lastVal,
int num)
Returns the tuple at a floating point value val |
void |
mouseClicked(MouseEvent evt)
Present to implement MouseListener, currently ignored |
void |
mouseDragged(MouseEvent evt)
Updates the associated Control |
void |
mouseEntered(MouseEvent evt)
MouseListener, currently ignored |
void |
mouseExited(MouseEvent evt)
MouseListener method, currently ignored |
void |
mouseMoved(MouseEvent evt)
MouseMovementListener method, currently ignored |
void |
mousePressed(MouseEvent evt)
Updates the associated Control |
void |
mouseReleased(MouseEvent evt)
Listens for releases of the right mouse button, and changes the active color |
void |
paint(Graphics g)
Repaints the entire JPanel |
protected void |
sendUpdate(int left,
int right)
Redraw the between the left and right colors |
void |
setPreferredSize(Dimension pref)
Override the widget's calculation for the preferred size of this map. |
void |
setValues(float[][] newVal)
Sets the values of the internal array after the map has been created. |
void |
update(Graphics g)
Repaints the modified areas of the JPanel |
Methods inherited from class visad.util.ColorMap |
---|
addColorChangeListener, getColor, getColors, notifyListeners, removeColorChangeListener |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static boolean USE_COLOR_CURSORS
public static final int DEFAULT_RESOLUTION
Constructor Detail |
---|
public BaseRGBMap(boolean hasAlpha) throws RemoteException, VisADException
hasAlpha
- set to true is this map has
an alpha component
RemoteException
VisADException
public BaseRGBMap(int resolution, boolean hasAlpha) throws RemoteException, VisADException
resolution
- the length of the arrayhasAlpha
- set to true is this map has
an alpha component
RemoteException
VisADException
public BaseRGBMap(float[][] vals, boolean hasAlpha) throws RemoteException, VisADException
vals
- the tuples used to initialize the colormaphasAlpha
- true if the colormap should
have an ALPHA component.
RemoteException
VisADException
public BaseRGBMap(float[][] vals) throws RemoteException, VisADException
vals
- the tuples used to initialize the colormap
See setValues() for constraints on the vals array.
RemoteException
VisADException
public BaseRGBMap(BaseColorControl ctl)
ctl
- control to use as data sourceMethod Detail |
---|
public void setValues(float[][] newVal) throws RemoteException, VisADException
newVal
- the color tuples used to initialize the map.
RemoteException
VisADException
public int getMapResolution()
getMapResolution
in class ColorMap
public int getMapDimension()
getMapDimension
in class ColorMap
public float[][] getColorMap()
getColorMap
in class ColorMap
public float[][] getTuples(float firstVal, float lastVal, int num)
getTuples
in class ColorMap
firstVal
- the location to start.lastVal
- the location to finish.num
- the number of tuples to return.
public float[] getTuple(float value)
getTuple
in class ColorMap
value
- the location to return.
public float[][] getRGBTuples(float startVal, float endVal, int num)
getRGBTuples
in class ColorMap
startVal
- the first value to translateendVal
- the last value to translatenum
- the number of values (including the two endpoints)
to be returned.public float[] getRGBTuple(float value)
getRGBTuple
in class ColorMap
value
- a floating point number between 0 and 1
protected void sendUpdate(int left, int right)
left
- the left edge of the changed area (in the range 0.0-1.0)right
- the right edge of the changed areapublic void mouseClicked(MouseEvent evt)
mouseClicked
in interface MouseListener
evt
- ignoredpublic void mouseEntered(MouseEvent evt)
mouseEntered
in interface MouseListener
evt
- ignoredpublic void mouseExited(MouseEvent evt)
mouseExited
in interface MouseListener
evt
- ignoredpublic void mousePressed(MouseEvent evt)
mousePressed
in interface MouseListener
evt
- the mouse press eventpublic void mouseReleased(MouseEvent evt)
mouseReleased
in interface MouseListener
evt
- the release eventpublic void mouseDragged(MouseEvent evt)
mouseDragged
in interface MouseMotionListener
evt
- the drag eventpublic void mouseMoved(MouseEvent evt)
mouseMoved
in interface MouseMotionListener
evt
- ignoredpublic void paint(Graphics g)
paint
in class JComponent
g
- The Graphics to update.public void update(Graphics g)
update
in class JComponent
g
- The Graphics to update.public Dimension getPreferredSize()
getPreferredSize
in class JComponent
public void setPreferredSize(Dimension pref)
setPreferredSize
in class JComponent
pref
- preferred size.public void controlChanged(ControlEvent evt) throws RemoteException, VisADException
Control
associated with this
widget's Control
has changed, update the data in
the ColorMap
.
controlChanged
in interface ControlListener
evt
- Data from the changed Control
.
RemoteException
VisADException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |