jas.plot
Class ColorRangeMap
java.lang.Object
jas.plot.ColorMap
jas.plot.ColorRangeMap
- All Implemented Interfaces:
- IColorMap
public class ColorRangeMap
- extends ColorMap
It builds automatically a color map using a variable range.
There are three types of range:
- From black color to a given color, based on a linear range.
- From given color to a given color, based on a linear range.
- From given color to a given color, based on dual range, with a
middle color.
Title: JAS
Description: Java Agent-based Simulation library
Copyright (C) 2002 Michele Sonnessa
This library is free software; you can redistribute it and/or modify it under the terms
of the GNU Lesser General Public License as published by the Free Software Foundation;
either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this
library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307, USA.
- Author:
- Michele Sonnessa, Matteo Morini
Constructor Summary |
ColorRangeMap(int gradients,
double minValue,
double maxValue,
java.awt.Color color)
Create a color range map from black to given color. |
ColorRangeMap(int gradients,
double minValue,
double maxValue,
java.awt.Color bottomColor,
java.awt.Color topColor)
Create a color range map from given color to given color. |
ColorRangeMap(int gradients,
double minValue,
double midValue,
double maxValue,
java.awt.Color bottomColor,
java.awt.Color middleColor,
java.awt.Color topColor)
Create a color range map from lower given color to middle given color and
from middle to the highest given one. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ColorRangeMap
public ColorRangeMap(int gradients,
double minValue,
double maxValue,
java.awt.Color color)
- Create a color range map from black to given color.
- Parameters:
gradients
- The number of color gradients that are added to the map.minValue
- The lower bound of the range.maxValue
- The upper bound of the range.color
- The highest color. It will correspond to maxValue.
ColorRangeMap
public ColorRangeMap(int gradients,
double minValue,
double maxValue,
java.awt.Color bottomColor,
java.awt.Color topColor)
- Create a color range map from given color to given color.
- Parameters:
gradients
- The number of color gradients that are added to the map.minValue
- The lower bound of the range.maxValue
- The upper bound of the range.bottomColor
- The lowest color. It will correspond to minValue.topColor
- The highest color. It will correspond to maxValue.
ColorRangeMap
public ColorRangeMap(int gradients,
double minValue,
double midValue,
double maxValue,
java.awt.Color bottomColor,
java.awt.Color middleColor,
java.awt.Color topColor)
- Create a color range map from lower given color to middle given color and
from middle to the highest given one.
- Parameters:
gradients
- The number of color gradients that are added to the map.minValue
- The lower bound of the range.midValue
- The value at which color changes the range.maxValue
- The upper bound of the range.bottomColor
- The lowest color. It will correspond to minValue.middleColor
- The middle color. It will correspond to midValue.topColor
- The highest color. It will correspond to maxValue.
getColorIndex
public int getColorIndex(double value)
- Return the color index.
- Specified by:
getColorIndex
in interface IColorMap
- Overrides:
getColorIndex
in class ColorMap
- Parameters:
value
- The value to be mapped. If it is outside the range bounds,
the method returns its nearest bound.
- Returns:
- The index of the color list mapping the value.
getColorIndex
public int getColorIndex(int value)
- Return the color index.
- Specified by:
getColorIndex
in interface IColorMap
- Overrides:
getColorIndex
in class ColorMap
- Parameters:
value
- The value to be mapped. If it is outside the range bounds,
the method returns its nearest bound.
- Returns:
- The index of the color list mapping the value.