Class WAbstractColorMap
- Direct Known Subclasses:
WStandardColorMap
The colormap has functionality to convert a numerical value to a WColor
. For details
on how, see the documentation of the implementations.
A colormap has a certain numerical range. When a colormap is painted as a colored strip or as a legend, this range is what will be presented, even if the colormap has the ability to convert values outside this range.
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
createStrip
(WPainter painter) Paints the colormap as a colored strip.abstract void
createStrip
(WPainter painter, WRectF area) Paints the colormap as a colored strip.Returns the format string.Returns the font to be used when drawing the labels in the legend.double
Returns the maximum of the colormap range.double
Returns the minimum of the colormap range.int
Returns the tickspacing for the legend.final void
paintLegend
(WPainter painter) Paints the colormap as a legend.abstract void
paintLegend
(WPainter painter, WRectF area) Paints the colormap as a legend.void
setFormatString
(CharSequence format) Sets the format for the labels on the colormap-legend.void
setLabelFont
(WFont font) Sets the font to be used when drawing the labels in the legend.void
setTickSpacing
(int spacing) Sets the tickspacing for the legend as a number of line-heights.abstract WColor
toColor
(double value) Converts a numerical value to aWColor
.Methods inherited from class eu.webtoolkit.jwt.WObject
getId, getObjectName, remove, setFormData, setObjectName, tr
-
Field Details
-
min_
protected double min_ -
max_
protected double max_ -
tickSpacing_
protected int tickSpacing_ -
format_
-
labelFont_
-
-
Constructor Details
-
WAbstractColorMap
public WAbstractColorMap(double min, double max) Constructor.Constructor taking a minimum and maximum value, determining the active range of the colormap. The default value for tickSpacing is 2 and the default label format is 2 decimal points.
-
-
Method Details
-
toColor
Converts a numerical value to aWColor
. -
createStrip
Paints the colormap as a colored strip.This paints the colormap from the minimum to the maximum value in the provided area (default = fill the entire paintdevice). This is no legend with ticks and labels, only the colors are painted.
-
createStrip
Paints the colormap as a colored strip. -
paintLegend
Paints the colormap as a legend.The colormap is painted as a legend with ticks and value-labels. The parameter area can be used to specify a part of the paintdevice where the legend should be drawn. When drawing the legend, the tickspacing, labelformat and labelfont are taken into account.
-
paintLegend
Paints the colormap as a legend. -
getMinimum
public double getMinimum()Returns the minimum of the colormap range. -
getMaximum
public double getMaximum()Returns the maximum of the colormap range. -
setTickSpacing
public void setTickSpacing(int spacing) Sets the tickspacing for the legend as a number of line-heights.The tickspacing must be specified as an integer number of line-heigths. For example, the default value of 2 will leave two line-heights between the labels of the ticks.
-
getTickSpacing
public int getTickSpacing()Returns the tickspacing for the legend.- See Also:
-
setFormatString
Sets the format for the labels on the colormap-legend.The format string is interpreted by snprintf(). The default is a float with two decimal places.
-
getFormatString
Returns the format string.- See Also:
-
setLabelFont
Sets the font to be used when drawing the labels in the legend.The default is a default constructed
WFont
. -
getLabelFont
Returns the font to be used when drawing the labels in the legend.- See Also:
-