cee::vis::OverlayColorLegendContinuousDomain
-
class OverlayColorLegendContinuousDomain : public OverlayItem
The OverlayColorLegendContinuousDomain is capable of visualizing all scalar mappers that derives from the ScalarMapperContinuousDomain.
The following scalar mappers can be used:
The color legend is configured from the scalar mapper with the setupFromScalarMapper() method. After doing that the appearance of the color legend can be configured with the settings in the class, e.g. set a title, custom tick marks, number formatting and custom labels.
See tutorial Geometry: Create a Geometry Model with Texture for an example of the use of OverlayColorLegendContinuousDomain.
Below is an example of each of the scalar mappers:
See also
OverlayItem, ScalarMapperFilledContoursUniform, ScalarMapperFilledContours, ScalarMapperContinuous, ScalarMapperContinuousPiecewise, and View
Public Functions
-
void setupFromScalarMapper(const ScalarMapperContinuousDomain *scalarMapper)
Sets up the color legend from the scalar mapper.
This will configure the color legend so that the legend will reflect the given scalar mapper If the mapper returns tick values (with the tickValuesHint() method) the tick values will also be configured (as is the case for Filled Contours style mappers). If not, only the min and max value will be added as tick marks. In this case, use the setupNiceNumbersTickmarks() or setupNiceNumbersTickmarksLogarithmic() methods to create appropriate tickmarks.
-
void setupNiceNumbersTickMarks(unsigned int maxNumTickMarks, const ScalarMapperContinuousDomain *scalarMapper)
Setup tickmarks on the color legend using round and human readable values.
This method assumes a linear scalar mapper.
-
void setupNiceNumbersTickMarksLogarithmic(unsigned int maxNumTickMarks, const ScalarMapperContinuousDomain *scalarMapper)
Setup tickmarks on the color legend using round and human readable values.
This method assumes a logarithmic scalar mapper.
-
void setTickValues(const std::vector<double> &tickValues, const ScalarMapperContinuousDomain *scalarMapper)
Sets the tick values to show on the color legend.
-
virtual unsigned int width() const
Returns the total width of the overlay item.
-
virtual unsigned int height() const
Returns the total height of the overlay item.
-
virtual void setSize(unsigned int width, unsigned int height)
Sets the size of the legend, in pixels.
-
void setWidthToFitText()
Sets the width of the legend to fit the current text.
-
virtual int priority() const
Returns the render priority of the item.
-
virtual void setPriority(int priority)
Sets render priority of the item.
The render priority determines the order in which item get rendered. Items with lower priorities get rendered first. The default priority is 10.
-
unsigned int legendBarWidth() const
Returns the width of the legend bar in pixels.
-
void setLegendBarWidth(unsigned int widthInPixels)
Sets the width of the legend bar in pixels.
-
void setTitle(const Str &title)
Sets the title of the legend.
Multiple lines can be specified by using the ‘
’ separator
-
void setTextColor(const Color3f &color)
Sets the text color for the category labels. Also sets the border color for the category bar.
-
char numericFormat() const
Returns the numeric format used for this legend.
-
void setNumericFormat(char format)
Sets the numeric format used for this legend.
-
int numericPrecision() const
Returns the numeric precision used for this legend.
-
void setNumericPrecision(int precision)
Sets the numeric precision used for this legend.
-
void setShowTickMarkLabels(bool show)
Specifies if the tick mark labels (usually the number values) should be shown together with the tick mark lines.
-
bool showTickMarkLabels() const
Returns true if the tick mark labels will be shown.
-
void setForceUniformTickMarkSpacing(bool forceUniformSpacing)
Returns true if the legend should be drawn with a uniform spacing between the tick values (not taking the actual value into account).
The color legend bar will be modified accordingly so the tick values indicate the right color.
-
bool forceUniformTickMarkSpacing() const
Returns true if the legend is drawn with a uniform spacing between tick values.
-
void setTickMarksThroughLegendBar(bool drawOverLegendBar)
Sets tick marks to be shown through the legend bar.
-
bool tickMarksThroughLegendBar() const
Returns true if tick marks are shown through the legend bar.
-
void setCustomLabels(const std::vector<Str> &labels, const std::vector<double> &relativePositions)
Sets custom labels that will be drawn at the given relative position on the color legend.
This could be used to render a description for the given color (for filled contour type legends) and may be used in combination with setShowTickmarkLabels(false) to create a more category type legend.
-
void clearCustomLabels()
Clears the custom labels.
See also