org.knime.core.data.property
Class ColorModelRange

java.lang.Object
  extended by org.knime.core.data.property.ColorModelRange
All Implemented Interfaces:
ColorHandler.ColorModel

public final class ColorModelRange
extends Object
implements ColorHandler.ColorModel

Computes colors based on a range of minimum and maximum values assigned to certain colors which are interpolated between a min and maximum color.

Author:
Thomas Gabriel, University of Konstanz

Constructor Summary
ColorModelRange(double lower, Color min, double upper, Color max)
          Creates new ColorHandler based on a mapping.
 
Method Summary
 boolean equals(Object obj)
          
 ColorAttr getColorAttr(DataCell dc)
          Returns a ColorAttr for the given DataCell value, or ColorAttr.DEFAULT if not set.
 Color getMaxColor()
           
 double getMaxValue()
           
 Color getMinColor()
           
 double getMinValue()
           
 int hashCode()
          
static ColorModelRange load(ConfigRO config)
          Load color settings from Config including lower and upper bound, and min and max colors.
 void save(ConfigWO config)
          Save lower and upper, and min and max colors to the given Config.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColorModelRange

public ColorModelRange(double lower,
                       Color min,
                       double upper,
                       Color max)
Creates new ColorHandler based on a mapping.

Parameters:
lower - Lower bound.
min - Color of lower bound.
upper - Upper bound.
max - Color of upper bound.
Throws:
IllegalArgumentException - If lower is greater or equal upper bound, or min or max is null.
Method Detail

getColorAttr

public ColorAttr getColorAttr(DataCell dc)
Returns a ColorAttr for the given DataCell value, or ColorAttr.DEFAULT if not set. The colors red, green, and blue are merged in the same ratio from the original spread of the lower and upper bounds.

Specified by:
getColorAttr in interface ColorHandler.ColorModel
Parameters:
dc - A DataCell value to get color for.
Returns:
A ColorAttr for a DataCell value or the DEFAULT ColorAttr.

getMinValue

public double getMinValue()
Returns:
minimum double value.

getMinColor

public Color getMinColor()
Returns:
minimum Color value.

getMaxValue

public double getMaxValue()
Returns:
maximum double value.

getMaxColor

public Color getMaxColor()
Returns:
maximum Color value.

save

public void save(ConfigWO config)
Save lower and upper, and min and max colors to the given Config.

Specified by:
save in interface ColorHandler.ColorModel
Parameters:
config - to save settings to.
See Also:
#save(ConfigWO)

load

public static ColorModelRange load(ConfigRO config)
                            throws InvalidSettingsException
Load color settings from Config including lower and upper bound, and min and max colors.

Parameters:
config - Read settings from.
Returns:
A new ColorModelRange object.
Throws:
InvalidSettingsException - If the settings could not be read.

toString

public String toString()
Overrides:
toString in class Object
Returns:
A string summary for this color model containing type and min/max values and colors.
See Also:
Object.toString()

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.