Class ContinousColorMap
- java.lang.Object
-
- idare.imagenode.ColorManagement.ColorMap
-
- idare.imagenode.ColorManagement.ColorMapTypes.ContinousColorMap
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ContinousZeroBalancedMap
public abstract class ContinousColorMap extends ColorMap
An Abstract class representing general continuous color maps and providing some functionality for such maps.- Author:
- Thomas Pfau
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
ContinousColorMap.ColorScaleLegendLayout
A Class that provides layout functionality for ColorScale Legends.
-
Field Summary
Fields Modifier and Type Field Description protected JPanel
ColorPane
protected Color[]
ColorScaleColors
protected float[]
ColorScaleFractions
protected Vector<JLabel>
DescriptionPanes
protected double
maxval
protected double
minval
protected boolean
oddrange
protected double
range
-
Constructor Summary
Constructors Constructor Description ContinousColorMap(double maxvalue, double minvalue, ColorScale cs)
Generate a continous color map based on a color scale and a minimal and maximal value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected JComponent
buildColorMapVisualisation(HashMap<Double,String> translate, JScrollPane Legend)
Generate the Color Scale Layout and visual representation based on the Labels used for the respective positions.double
getCenterPosition()
Get the central position of the color map (on a 0-1 range).protected double
getCenterValue()
Get the center value (i.e.Color
getColor(Comparable Value)
Get theColor
that is associated with theComparable
object provided.protected HashMap<Double,String>
GetLabelForNumbers(HashMap<Double,Double> fractions)
Create Strings Representations for the values in a Map which are Doubles.protected void
resetColorData()
Clear all color related data i.e.protected void
setup()
Setup this Color Map.-
Methods inherited from class idare.imagenode.ColorManagement.ColorMap
getColorMapComponent, getColorScalePane, getDefaultColor, getDisplayStrings, setColorScale
-
-
-
-
Constructor Detail
-
ContinousColorMap
public ContinousColorMap(double maxvalue, double minvalue, ColorScale cs)
Generate a continous color map based on a color scale and a minimal and maximal value.- Parameters:
maxvalue
- the maximum value this map shall be able to mapminvalue
- the minimum this map shall be able to mapcs
- the colorscale this map should use for color generation.
-
-
Method Detail
-
resetColorData
protected void resetColorData()
Clear all color related data i.e. ColorScale Colors, fRactions and Panes.
-
setup
protected void setup()
Setup this Color Map.
-
buildColorMapVisualisation
protected JComponent buildColorMapVisualisation(HashMap<Double,String> translate, JScrollPane Legend)
Generate the Color Scale Layout and visual representation based on the Labels used for the respective positions.- Parameters:
translate
- A Translation between the double values and Strings.Legend
- The Legend to build this ColorMap Visualisation for (to listen to resize events).- Returns:
- A
JComponent
which plots the ColorMap
-
getCenterValue
protected double getCenterValue()
Get the center value (i.e. the value in the middle between the minimum and maximum values mapped by this map.- Returns:
- the center value
-
GetLabelForNumbers
protected HashMap<Double,String> GetLabelForNumbers(HashMap<Double,Double> fractions)
Create Strings Representations for the values in a Map which are Doubles. This is a helper function to allow the generation of sensible numbers for legends.- Parameters:
fractions
- A Translation between double keys to double values. The values will be used to generate strings.- Returns:
- a Map, that maps the keys of the input to the string representation of the values of the input.
-
getColor
public Color getColor(Comparable Value)
Description copied from class:ColorMap
Get theColor
that is associated with theComparable
object provided.- Specified by:
getColor
in classColorMap
- Parameters:
Value
- AComparable
value.- Returns:
- a
Color
-
getCenterPosition
public double getCenterPosition()
Get the central position of the color map (on a 0-1 range). This is the position that returns the value of theColorScale
when 0.5 is requested from a basic colorscale used for this map.- Returns:
- the central position of the
ColorMap
-
-