org.opensourcephysics.display2d
Class ColorMapper

java.lang.Object
  extended by org.opensourcephysics.display2d.ColorMapper

public class ColorMapper
extends java.lang.Object


Field Summary
static int BLACK
           
static int BLUE
           
static int DUALSHADE
           
static int GRAYSCALE
           
static int GREEN
           
static int NORENDER
           
static int RED
           
static int REDBLUE_SHADE
           
static int SPECTRUM
           
static int WIREFRAME
           
protected  ZExpansion zMap
           
 
Constructor Summary
ColorMapper(int _numColors, double _floor, double _ceil, int palette)
          Constructor ColorMapper
 
Method Summary
 java.awt.Color doubleToColor(double value)
          Converts a double to a color.
 byte[] doubleToComponents(double value, byte[] rgb)
          Converts a double to color components.
 double getCeil()
          Gets the ceiling color.
 java.awt.Color getCeilColor()
          Gets the ceiling color.
static java.awt.Color[] getColorPalette(int numColors, int paletteType)
          Gets a array of colors for use in data visualization.
 double getFloor()
          Gets the floor.
 java.awt.Color getFloorColor()
          Gets the floor color;
 javax.swing.JFrame getLegendFrame()
           
static XML.ObjectLoader getLoader()
          Gets a loader that allows a Circle to be represented as XML data.
 int getNumColors()
          Gets the number of colors between the floor and ceiling values.
 int getPaletteType()
          Returns the color palette.
 void setColorPalette(java.awt.Color[] _colors)
          Sets the color palette.
 void setFloorCeilColor(java.awt.Color _floorColor, java.awt.Color _ceilColor)
          Sets the floor and ceiling colors.
 void setNumberOfColors(int _numColors)
          Sets the number of colors
 void setPaletteType(int _paletteType)
          Sets the color palette.
 void setScale(double _floor, double _ceil)
          Sets the scale.
 void setZMap(ZExpansion map)
          Sets map for z values.
 javax.swing.JFrame showLegend()
          Shows the color legend.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPECTRUM

public static final int SPECTRUM
See Also:
Constant Field Values

GRAYSCALE

public static final int GRAYSCALE
See Also:
Constant Field Values

DUALSHADE

public static final int DUALSHADE
See Also:
Constant Field Values

RED

public static final int RED
See Also:
Constant Field Values

GREEN

public static final int GREEN
See Also:
Constant Field Values

BLUE

public static final int BLUE
See Also:
Constant Field Values

BLACK

public static final int BLACK
See Also:
Constant Field Values

WIREFRAME

public static final int WIREFRAME
See Also:
Constant Field Values

NORENDER

public static final int NORENDER
See Also:
Constant Field Values

REDBLUE_SHADE

public static final int REDBLUE_SHADE
See Also:
Constant Field Values

zMap

protected ZExpansion zMap
Constructor Detail

ColorMapper

public ColorMapper(int _numColors,
                   double _floor,
                   double _ceil,
                   int palette)
Constructor ColorMapper

Parameters:
_numColors -
_floor -
_ceil -
palette -
Method Detail

getLegendFrame

public javax.swing.JFrame getLegendFrame()

showLegend

public javax.swing.JFrame showLegend()
Shows the color legend.


setScale

public void setScale(double _floor,
                     double _ceil)
Sets the scale.

Parameters:
_floor -
_ceil -

doubleToComponents

public byte[] doubleToComponents(double value,
                                 byte[] rgb)
Converts a double to color components.

Parameters:
value - double
rgb - byte[]
Returns:
byte[]

doubleToColor

public java.awt.Color doubleToColor(double value)
Converts a double to a color.

Parameters:
value -
Returns:
the color

setZMap

public void setZMap(ZExpansion map)
Sets map for z values.

Parameters:
map - ZExpansion

getFloor

public double getFloor()
Gets the floor.

Returns:

getFloorColor

public java.awt.Color getFloorColor()
Gets the floor color;

Returns:

getCeil

public double getCeil()
Gets the ceiling color.

Returns:

getCeilColor

public java.awt.Color getCeilColor()
Gets the ceiling color.

Returns:

getNumColors

public int getNumColors()
Gets the number of colors between the floor and ceiling values.

Returns:

setFloorCeilColor

public void setFloorCeilColor(java.awt.Color _floorColor,
                              java.awt.Color _ceilColor)
Sets the floor and ceiling colors.

Parameters:
_floorColor -
_ceilColor -

getPaletteType

public int getPaletteType()
Returns the color palette.

Returns:
mode

setColorPalette

public void setColorPalette(java.awt.Color[] _colors)
Sets the color palette.

Parameters:
_colors -

setNumberOfColors

public void setNumberOfColors(int _numColors)
Sets the number of colors

Parameters:
_numColors -

setPaletteType

public void setPaletteType(int _paletteType)
Sets the color palette.

Parameters:
_paletteType -

getColorPalette

public static java.awt.Color[] getColorPalette(int numColors,
                                               int paletteType)
Gets a array of colors for use in data visualization. Colors are similar to the colors returned by a color mapper instance.

Parameters:
numColors -
paletteType -
Returns:

getLoader

public static XML.ObjectLoader getLoader()
Gets a loader that allows a Circle to be represented as XML data. Objects without XML loaders cannot be saved and retrieved from an XML file.

Returns:
ObjectLoader