NetCharts Pro

netcharts.pro.common
Class NFColorSpectrum

java.lang.Object
  extended by netcharts.pro.common.NFBaseClass
      extended by netcharts.pro.common.NFColorSpectrum
All Implemented Interfaces:
java.lang.Cloneable, NFCDLGenerator

public class NFColorSpectrum
extends NFBaseClass
implements NFCDLGenerator

Defines attributes for a color spectrum. A color spectrum is generated from two colors which are the starting and ending colors and from the number of steps which is the number of color buckets. The minimum and maximim values represent the data range for the entire spectrum. Each color bucket in the spectrum represents a certain data range. So if a data point falls within that range, it will be shown with its associated color. The spectrum colors start at color1, go to white or almost white, depending on the number of steps, and then end at color2. The number of steps determines the amount each color bucket is changed by and the data values each color represents.


Field Summary
static double DEFAULT_MAX
          Default value for the max value if not specified.
static double DEFAULT_MIN
          Default value for the min value if not specified.
static int DEFAULT_NUM_STEPS
          Default value for the number of steps if not specified.
static int MIN_STEPS
          Minimum number of steps allowed
 
Constructor Summary
NFColorSpectrum()
          Constructs a default color spectrum object.
NFColorSpectrum(java.awt.Color color1, java.awt.Color color2)
          Constructs a color spectrum object from the specified colors.
NFColorSpectrum(java.awt.Color color1, java.awt.Color color2, double min, double max, int numSteps)
          Constructs a color spectrum object from the specified colors, minimum value, maximum value and number of steps.
NFColorSpectrum(java.awt.Color color1, java.awt.Color color2, int numSteps)
          Constructs a color spectrum object from the specified colors and the specified number of steps.
 
Method Summary
 java.lang.String getCDL()
          Generate CDL parameters representing the color spectrum
 void getCDL(java.lang.StringBuffer sb, boolean includeParens)
          Append CDL parameters representing the color spectrum to the given StringBuffer.
 java.awt.Color getColor1()
          Returns the color to start with in the spectrum
 java.awt.Color getColor2()
          Returns the color to end with in the spectrum
 double getMax()
          Return the maximum range value for the color spectrum.
 double getMin()
          Return the minimum range value for the color spectrum.
 int getNumSteps()
          Returns the number of steps in the spectrum.
 void setCDL(java.lang.String cdl)
          Configures this object from a CDL parameter representation.
 int setCDL(java.lang.String[] elements, int offset)
          Configures this object from a CDL parameter representation.
 void setColor1(java.awt.Color color1)
          Sets the color to start with in the spectrum
 void setColor2(java.awt.Color color2)
          Sets the color to end with in the spectrum
 void setMax(double max)
          Set the maximum range value for the color spectrum.
 void setMin(double min)
          Set the minimum range value for the color spectrum.
 void setNumSteps(int numSteps)
          Sets the number of steps in the spectrum.
 java.lang.String toString()
          Returns a String object representing the color spectrum.
 
Methods inherited from class netcharts.pro.common.NFBaseClass
clone, getModified, getUserObject, setModified, setUserObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_NUM_STEPS

public static final int DEFAULT_NUM_STEPS
Default value for the number of steps if not specified.

See Also:
Constant Field Values

DEFAULT_MIN

public static final double DEFAULT_MIN
Default value for the min value if not specified.

See Also:
Constant Field Values

DEFAULT_MAX

public static final double DEFAULT_MAX
Default value for the max value if not specified.

See Also:
Constant Field Values

MIN_STEPS

public static final int MIN_STEPS
Minimum number of steps allowed

See Also:
Constant Field Values
Constructor Detail

NFColorSpectrum

public NFColorSpectrum()
Constructs a default color spectrum object.


NFColorSpectrum

public NFColorSpectrum(java.awt.Color color1,
                       java.awt.Color color2)
Constructs a color spectrum object from the specified colors. Defaults will be used for the minimum value, maximum value and number of steps.


NFColorSpectrum

public NFColorSpectrum(java.awt.Color color1,
                       java.awt.Color color2,
                       int numSteps)
Constructs a color spectrum object from the specified colors and the specified number of steps. Defaults will be used for the minimum value and maximum value.


NFColorSpectrum

public NFColorSpectrum(java.awt.Color color1,
                       java.awt.Color color2,
                       double min,
                       double max,
                       int numSteps)
Constructs a color spectrum object from the specified colors, minimum value, maximum value and number of steps.

Method Detail

setColor1

public void setColor1(java.awt.Color color1)
Sets the color to start with in the spectrum

Parameters:
color1 - starting color

getColor1

public java.awt.Color getColor1()
Returns the color to start with in the spectrum

Returns:
starting color or null if not set.

setColor2

public void setColor2(java.awt.Color color2)
Sets the color to end with in the spectrum

Parameters:
color2 - ending color

getColor2

public java.awt.Color getColor2()
Returns the color to end with in the spectrum

Returns:
ending color or null if not set.

setMin

public void setMin(double min)
Set the minimum range value for the color spectrum.

Parameters:
min - minimum range value

getMin

public double getMin()
Return the minimum range value for the color spectrum.

Returns:
minimum range value or DEFAULT_MIN if not set

setMax

public void setMax(double max)
Set the maximum range value for the color spectrum.

Parameters:
max - maximum range value

getMax

public double getMax()
Return the maximum range value for the color spectrum.

Returns:
maximum range value or DEFAULT_MAX if not set

setNumSteps

public void setNumSteps(int numSteps)
Sets the number of steps in the spectrum. The number of steps cannot be less than MIN_STEPS.

Parameters:
numSteps - number of steps

getNumSteps

public int getNumSteps()
Returns the number of steps in the spectrum. This number is used to determine the amount each color and value are incremented by and represents the total number of colors in the spectrum. The number of steps cannot be less than MIN_STEPS.

Returns:
number of steps or DEFAULT_NUM_STEPS if not set

getCDL

public java.lang.String getCDL()
Generate CDL parameters representing the color spectrum

Specified by:
getCDL in interface NFCDLGenerator
Returns:
CDL in the form: (color1, color2, min, max, numSteps)

getCDL

public void getCDL(java.lang.StringBuffer sb,
                   boolean includeParens)
Append CDL parameters representing the color spectrum to the given StringBuffer.

Parameters:
sb - Target buffer to append the CDL parameters
includeParens - If true, this will cause the parameters to be delimited with parenthesis.

toString

public java.lang.String toString()
Returns a String object representing the color spectrum.

Specified by:
toString in interface NFCDLGenerator
Overrides:
toString in class java.lang.Object
Returns:
String object in the same form as that given by getCDL().

setCDL

public void setCDL(java.lang.String cdl)
Configures this object from a CDL parameter representation.

Specified by:
setCDL in interface NFCDLGenerator
Parameters:
cdl - CDL in the form: (color1, color2, min, max, numSteps)

setCDL

public int setCDL(java.lang.String[] elements,
                  int offset)
Configures this object from a CDL parameter representation.

Parameters:
elements - Array of parameter elements. This array is expected to contain consecutive elements containing color1, color2, min value, max value, and number of steps.
offset - Offset into the elements array.

NetCharts Pro


Visual Mining, Inc.
2099 Gaither Rd.
Suite 220
Rockville, MD 20850
800.308.0731
301.947.8293 FAX

Copyright © Visual Mining, Inc. 1996 - 2011
All Rights Reserved.

NetCharts Pro TM is a registered trademark of Visual Mining, Inc. Other brands and their products are trademarks of their respective holders.

Last Modified: Jun 28, 2011