JMV 0.80 Programmer's Documentation

Class ColorCategory

java.lang.Object
  |
  +--ColorCategory

public class ColorCategory
extends java.lang.Object

Storage for color info and methods for choosing and creating colors


Field Summary
static javax.media.j3d.Appearance[] m_appearanceArray
          current Appearance array, contains Appearances for each of the rgb colors in m_colorArray
static float[][] m_colorArray
          current color array of (r,g,b) values
static float[] m_endColor
          end color for color range
static float[] m_midColor
          middle color for color range
static float[] m_startColor
          start color for color range
 
Constructor Summary
ColorCategory()
          Default constructor
 
Method Summary
 void changeRangeColors(float[] start, float[] mid, float[] end)
          Changes the start, middle, and end colors used for creating color ranges
static float[][] createColorsByIndexRange(int numColors)
          Creates a color table from a user-supplied index range It creates a list of rgb colors that fade from m_startColor to m_midColor to m_endColor.
 javax.media.j3d.Appearance getAppearance(Molecule molec, int index, int colorScheme)
          Gets the Appearance for a specific atom in a molecule
 float[] getColor(Molecule molec, int index, int colorScheme)
          Gets the color for a specific atom in a molecule
static int mapFloat2Color(float value, float min, float max)
          Maps floating point data to a color gradient palette
static int mapIndex2Color(int totalindices, int index)
          Maps zero or one-based integer indexed data to a color gradient palette
static void setColorArray(Molecule molec, int scheme)
          Creates the array of colors to use in the scene Also creates the array of Appearances
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_colorArray

public static float[][] m_colorArray
current color array of (r,g,b) values


m_appearanceArray

public static javax.media.j3d.Appearance[] m_appearanceArray
current Appearance array, contains Appearances for each of the rgb colors in m_colorArray


m_startColor

public static float[] m_startColor
start color for color range


m_midColor

public static float[] m_midColor
middle color for color range


m_endColor

public static float[] m_endColor
end color for color range

Constructor Detail

ColorCategory

public ColorCategory()
Default constructor

Method Detail

createColorsByIndexRange

public static float[][] createColorsByIndexRange(int numColors)
Creates a color table from a user-supplied index range It creates a list of rgb colors that fade from m_startColor to m_midColor to m_endColor.

Parameters:
numColors - the number of colors to create
Returns:
a 2d float array of the rgb colors

changeRangeColors

public void changeRangeColors(float[] start,
                              float[] mid,
                              float[] end)
Changes the start, middle, and end colors used for creating color ranges

Parameters:
start - a float array with rgb values for the starting color

getColor

public float[] getColor(Molecule molec,
                        int index,
                        int colorScheme)
Gets the color for a specific atom in a molecule

Parameters:
molec - the Molecule being colored
index - the Atom index of the atom to be colored in the Molecule
colorScheme - the current coloring scheme used
Returns:
a float array of the rgb values used to color this Atom

getAppearance

public javax.media.j3d.Appearance getAppearance(Molecule molec,
                                                int index,
                                                int colorScheme)
Gets the Appearance for a specific atom in a molecule

Parameters:
molec - the Molecule being colored
index - the Atom index of the atom to be colored in the Molecule
colorScheme - the current coloring scheme used
Returns:
an Appearance used to color this Atom

mapIndex2Color

public static int mapIndex2Color(int totalindices,
                                 int index)
Maps zero or one-based integer indexed data to a color gradient palette

Parameters:
index - the current index for the atom to color

mapFloat2Color

public static int mapFloat2Color(float value,
                                 float min,
                                 float max)
Maps floating point data to a color gradient palette

Parameters:
value - float value to calculate index for
min - minimum index value in color gradient
max - maximum index value in color gradient

setColorArray

public static void setColorArray(Molecule molec,
                                 int scheme)
Creates the array of colors to use in the scene Also creates the array of Appearances

Parameters:
molec - Molecule to calculate colors for
scheme - color scheme to use

Copyright (C) 2000-2002 The Board of Trustees of the University of Illinois