MIRA
Public Member Functions | Static Public Member Functions | List of all members
ColormapProperty Class Reference

A special property class that can be used as member, if you want to provide a ComboBox where the user is able to select the available and registered color colormaps. More...

#include <visualization/ColormapProperty.h>

Public Member Functions

template<typename Reflector >
void reflectRead (Reflector &r)
 
template<typename Reflector >
void reflectWrite (Reflector &r)
 
 ColormapProperty ()
 Creates property with no selected colormap. More...
 
 ColormapProperty (const std::string &colormapIdentifier)
 Tries to select the specified colormap. More...
 
bool isValid () const
 Returns true, if a valid colormap was chosen. More...
 
ColormapPropertyoperator= (const std::string &identifier)
 Assigns colormap identifier string. More...
 
const std::string & str () const
 Returns the set colormap identifier as string. More...
 
const ColormapgetColormap () const
 Returns the chosen color colormap. More...
 
const QVector< QRgb > & getColorTable () const
 Returns the chosen color colormap as color table in Qt compliant form. More...
 
void setFilter (boost::function< bool(const Colormap *)> filterFunction)
 Allows to specify a filter function. More...
 
bool filter (const Colormap *colormap) const
 Returns true, if the specified colormap has passed the optional set filter. More...
 

Static Public Member Functions

static bool filterContinuous (const Colormap *colormap)
 A predefined filter function that filters all ContinuousColormap classes. More...
 

Detailed Description

A special property class that can be used as member, if you want to provide a ComboBox where the user is able to select the available and registered color colormaps.

See also
Colormap

Constructor & Destructor Documentation

◆ ColormapProperty() [1/2]

ColormapProperty ( )
inline

Creates property with no selected colormap.

◆ ColormapProperty() [2/2]

ColormapProperty ( const std::string &  colormapIdentifier)

Tries to select the specified colormap.

Member Function Documentation

◆ reflectRead()

void reflectRead ( Reflector &  r)
inline

◆ reflectWrite()

void reflectWrite ( Reflector &  r)
inline

◆ isValid()

bool isValid ( ) const

Returns true, if a valid colormap was chosen.

◆ operator=()

ColormapProperty& operator= ( const std::string &  identifier)
inline

Assigns colormap identifier string.

◆ str()

const std::string& str ( ) const
inline

Returns the set colormap identifier as string.

◆ getColormap()

const Colormap& getColormap ( ) const

Returns the chosen color colormap.

Exceptions
XInvalidParameterif no valid colormap is set.

◆ getColorTable()

const QVector<QRgb>& getColorTable ( ) const

Returns the chosen color colormap as color table in Qt compliant form.

Exceptions
XInvalidParameterif no valid colormap is set.

◆ setFilter()

void setFilter ( boost::function< bool(const Colormap *)>  filterFunction)

Allows to specify a filter function.

The filter function can be used to filter the colormaps that are shown in the combobox and that can be specified using the property. The filter function must take a pointer to a Colormap as parameter and should return true, if the colormap is allowed, or false, if it should be filtered out.

A predefined filter function is filterContinuous().

Example:

Note
: if you use a ColormapProperty member 'mycolormap' in your class and mycolormap is reflected, be aware that it may not be enough to set the filter to colormap in your class' constructor: When restoring your class from serialized data (e.g. XML), depending on the particular method used for reflection, a temporary ColormapProperty object may be created, which is then copied over to the mycolormap member, thus overwriting the filter setting. To avoid this, use a setter function in your reflection and set the filter on mycolormap after copying the parameter value.

◆ filter()

bool filter ( const Colormap colormap) const

Returns true, if the specified colormap has passed the optional set filter.

(for internal use)

◆ filterContinuous()

static bool filterContinuous ( const Colormap colormap)
inlinestatic

A predefined filter function that filters all ContinuousColormap classes.

It can be set using the setFilter() method, e.g:


The documentation for this class was generated from the following file: