Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

ro.nolimits.rue.util
Class ColorGenerator  view ColorGenerator download ColorGenerator.java

java.lang.Object
  extended byro.nolimits.rue.util.ColorGenerator
All Implemented Interfaces:
java.io.Serializable

public final class ColorGenerator
extends java.lang.Object
implements java.io.Serializable

A utility class which generates random colors to be used to represent the data channels. It tries not to generate the same color more times.

Version:
$Revision: 0.5.1.1 $ $Date: 2000/08/01 10:52:50 $

Field Summary
private  int[] _bHist
          The blue color array in which we store the already geberated colors
private static ColorGenerator _cg
           
private  int _colorSpaceDim
          The number of maximum separate collors
private  int _colorStep
          The amount of difference which will distinguish two colors
private  int _currIndex
          The current color's index in the color array
private  int[] _gHist
          The green color array in which we store the already geberated colors
private  int[] _rHist
          The red color array in which we store the already geberated colors
private  int _startB
           
private  java.awt.Color _startColor
          The color from which we start
private  int _startG
           
private  int _startR
          The same color but splitted in RGB
 
Constructor Summary
ColorGenerator()
          The constructor
 
Method Summary
 void addColor(java.awt.Color color)
          Adds a color to the registered colors lists
 int getColorSpaceDim()
          Get the value of colorSpaceDim.
 int getColorStep()
          Get the value of colorStep.
static ColorGenerator getHandle()
          The hook for the ColorGenerator
 java.awt.Color getStartColor()
          Get the value of startColor.
 int indexOf(java.awt.Color color)
          Returns the index of the specified color.
private  void init()
          Some initialization
 boolean isColor(java.awt.Color color)
          Checks if an color is already registered
static void main(java.lang.String[] args)
          Just for testing purposes
 java.awt.Color nextColor()
          Generates a color which is all the time different than the other generated colors.
 void removeColor(java.awt.Color color)
          Removes a color from the register
 void setColorSpaceDim(int v)
          Set the value of colorSpaceDim.
 void setColorStep(int v)
          Set the value of colorStep.
 void setStartColor(java.awt.Color v)
          Set the value of startColor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_startColor

private java.awt.Color _startColor
The color from which we start


_startR

private int _startR
The same color but splitted in RGB


_startG

private int _startG

_startB

private int _startB

_colorSpaceDim

private int _colorSpaceDim
The number of maximum separate collors


_currIndex

private int _currIndex
The current color's index in the color array


_cg

private static ColorGenerator _cg

_rHist

private int[] _rHist
The red color array in which we store the already geberated colors


_gHist

private int[] _gHist
The green color array in which we store the already geberated colors


_bHist

private int[] _bHist
The blue color array in which we store the already geberated colors


_colorStep

private int _colorStep
The amount of difference which will distinguish two colors

Constructor Detail

ColorGenerator

public ColorGenerator()
The constructor

Method Detail

getHandle

public static ColorGenerator getHandle()
The hook for the ColorGenerator


init

private void init()
Some initialization


getColorSpaceDim

public int getColorSpaceDim()
Get the value of colorSpaceDim.


setColorSpaceDim

public void setColorSpaceDim(int v)
Set the value of colorSpaceDim.


getStartColor

public java.awt.Color getStartColor()
Get the value of startColor.


setStartColor

public void setStartColor(java.awt.Color v)
Set the value of startColor.


getColorStep

public int getColorStep()
Get the value of colorStep.


setColorStep

public void setColorStep(int v)
Set the value of colorStep.


nextColor

public java.awt.Color nextColor()
Generates a color which is all the time different than the other generated colors.
Used in the RUE-DataSources tree do distinguish between channels


isColor

public boolean isColor(java.awt.Color color)
Checks if an color is already registered


indexOf

public int indexOf(java.awt.Color color)
Returns the index of the specified color.


addColor

public void addColor(java.awt.Color color)
Adds a color to the registered colors lists


removeColor

public void removeColor(java.awt.Color color)
Removes a color from the register


main

public static void main(java.lang.String[] args)
Just for testing purposes