gov.noaa.pmel.sgt
Class IndexedColorMap

java.lang.Object
  extended by gov.noaa.pmel.sgt.ColorMap
      extended by gov.noaa.pmel.sgt.IndexedColorMap
All Implemented Interfaces:
IndexedColor, TransformAccess, java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener

public class IndexedColorMap
extends ColorMap
implements java.lang.Cloneable, java.beans.PropertyChangeListener, IndexedColor, TransformAccess

IndexedColorMap provides a mapping from a value to a Color.

Since:
2.0
Version:
$Revision$, $Date$
Author:
Donald Denbo
See Also:
Serialized Form

Field Summary
protected  java.awt.Color[] colors_
           
 
Fields inherited from class gov.noaa.pmel.sgt.ColorMap
batch_, local_, modified_
 
Constructor Summary
IndexedColorMap(java.awt.Color[] colors)
          Initialize the color map with an array of Color objects.
IndexedColorMap(float[] red, float[] green, float[] blue)
          Initialize the color map with float arrays of red, green, and blue.
IndexedColorMap(int[] red, int[] green, int[] blue)
          Initialize the color map with int arrays of red, green, and blue.
 
Method Summary
 ColorMap copy()
          Create a copy of the ColorMap
 boolean equals(ColorMap cm)
          Test for equality of color maps.
 java.awt.Color getColor(double val)
          Get a Color.
 java.awt.Color getColorByIndex(int indx)
          Get a Color.
 int getMaximumIndex()
          Get the maximum color index.
 Range2D getRange()
          Get the current user range for the Transform.
 Transform getTransform()
          Get the transform for the color mapping.
 void setColor(int index, java.awt.Color colr)
          Change the Color.
 void setColor(int indx, int red, int green, int blue)
          Change the Color.
 void setRange(Range2D range)
          Set the user range for the Transform.
 void setTransform(Transform trans)
          Set the transform for the color mapping.
 
Methods inherited from class gov.noaa.pmel.sgt.ColorMap
addPropertyChangeListener, firePropertyChange, isBatch, propertyChange, removePropertyChangeListener, setBatch, setBatch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
 

Field Detail

colors_

protected java.awt.Color[] colors_
Constructor Detail

IndexedColorMap

public IndexedColorMap(int[] red,
                       int[] green,
                       int[] blue)
Initialize the color map with int arrays of red, green, and blue. The arrays must be the same length. Sets up ColorMap for INDEXED access.

Parameters:
red - Array of the red component 0 - 255.
green - Array of the green component 0 - 255.
blue - Array of the blue component 0 - 255.
See Also:
Color

IndexedColorMap

public IndexedColorMap(float[] red,
                       float[] green,
                       float[] blue)
Initialize the color map with float arrays of red, green, and blue. The arrays must be the same length. Sets up ColorMap for INDEXED access.

Parameters:
red - Array of the red component 0.0 - 1.0.
green - Array of the green component 0.0 - 1.0.
blue - Array of the blue component 0.0 - 1.0.
See Also:
Color

IndexedColorMap

public IndexedColorMap(java.awt.Color[] colors)
Initialize the color map with an array of Color objects. Sets up ColorMap for INDEXED access.

Parameters:
colors - Array of the Color objects.
See Also:
Color
Method Detail

copy

public ColorMap copy()
Create a copy of the ColorMap

Specified by:
copy in class ColorMap

getColorByIndex

public java.awt.Color getColorByIndex(int indx)
Get a Color.

Specified by:
getColorByIndex in interface IndexedColor
Returns:
color
Since:
3.0

getColor

public java.awt.Color getColor(double val)
Get a Color.

Specified by:
getColor in class ColorMap
Parameters:
val - Value
Returns:
Color

setRange

public void setRange(Range2D range)
Set the user range for the Transform.

Specified by:
setRange in interface TransformAccess

getRange

public Range2D getRange()
Get the current user range for the Transform.

Specified by:
getRange in class ColorMap
Returns:
user range

setColor

public void setColor(int index,
                     java.awt.Color colr)
Change the Color.

Specified by:
setColor in interface IndexedColor
Parameters:
colr - new Color
indx - index of color

setColor

public void setColor(int indx,
                     int red,
                     int green,
                     int blue)
Change the Color.
Property Change: color.

Specified by:
setColor in interface IndexedColor
Parameters:
red - red component
green - green component
blue - blue component
indx - index of color

getMaximumIndex

public int getMaximumIndex()
Get the maximum color index.

Specified by:
getMaximumIndex in interface IndexedColor
Returns:
maximum legal color index

setTransform

public void setTransform(Transform trans)
Set the transform for the color mapping.
Property Change: transform.

Parameters:
trans - index color Transform

getTransform

public Transform getTransform()
Get the transform for the color mapping.

Returns:
index color Transform

equals

public boolean equals(ColorMap cm)
Description copied from class: ColorMap
Test for equality of color maps.

Specified by:
equals in class ColorMap