A gradient of multiple colors and arbitrary distances between colors. More...
#include <OpenMS/VISUAL/MultiGradient.h>
| Public Types | |
| enum | InterpolationMode { IM_LINEAR, IM_STAIRS } | 
| Interploation mode.  More... | |
| Public Member Functions | |
| MultiGradient () | |
| Constructor.  More... | |
| MultiGradient (const MultiGradient &multigradient) | |
| Copy constructor.  More... | |
| ~MultiGradient () | |
| Destructor.  More... | |
| MultiGradient & | operator= (const MultiGradient &rhs) | 
| Assignment operator.  More... | |
| void | insert (DoubleReal position, QColor color) | 
| sets or replaces the color at position positionMore... | |
| bool | remove (DoubleReal position) | 
| removes the color at position positionMore... | |
| bool | exists (DoubleReal position) | 
| returns if a value for position positionexists  More... | |
| UInt | position (UInt index) | 
| returns the position of the index-th point  More... | |
| QColor | color (UInt index) | 
| returns the color of the index-th point  More... | |
| QColor | interpolatedColorAt (DoubleReal position) const | 
| Returns the color as position.  More... | |
| QColor | interpolatedColorAt (DoubleReal position, DoubleReal min, DoubleReal max) const | 
| returns the color as positionwith the gradient stretched betweenminandmax.  More... | |
| void | activatePrecalculationMode (DoubleReal min, DoubleReal max, UInt steps) | 
| activates the precalculation of values (only approximate results are given)  More... | |
| void | deactivatePrecalculationMode () | 
| deactivates the precalculation of values ( and deletes the precalculated values)  More... | |
| Int | precalculatedColorIndex (DoubleReal position) const | 
| index of color in precalculated table by position in gradient  More... | |
| QColor | precalculatedColorByIndex (Int index) const | 
| precalculated color by its index in the table  More... | |
| QColor | precalculatedColorAt (DoubleReal position) const | 
| Returns a precalculated color.  More... | |
| Size | size () const | 
| return the number of color points  More... | |
| Size | precalculatedSize () const | 
| size of precalculated colors table  More... | |
| void | setInterpolationMode (InterpolationMode mode) | 
| sets the interploation mode (default or stairs). Default is linear  More... | |
| InterpolationMode | getInterpolationMode () const | 
| returns the interpolaion mode  More... | |
| std::string | toString () const | 
| convert to string representation  More... | |
| void | fromString (const std::string &gradient) | 
| Sets the gradient by string representation.  More... | |
| Static Public Member Functions | |
| static MultiGradient | getDefaultGradientLinearIntensityMode () | 
| Returns the default gradient for linear intensity mode.  More... | |
| static MultiGradient | getDefaultGradientLogarithmicIntensityMode () | 
| Returns the default gradient for linear intensity mode.  More... | |
| Protected Attributes | |
| std::map< DoubleReal, QColor > | pos_col_ | 
| Map of index and color.  More... | |
| InterpolationMode | interpolation_mode_ | 
| Current interpolation mode.  More... | |
| std::vector< QColor > | pre_ | 
| Precalculated colors.  More... | |
| DoubleReal | pre_min_ | 
| Minimum of the precalculated color range.  More... | |
| DoubleReal | pre_size_ | 
| Width of the precalculated color range.  More... | |
| UInt | pre_steps_ | 
| Steps of the precalculated color range.  More... | |
A gradient of multiple colors and arbitrary distances between colors.
Positions associated with numbers range from 0 to 100. There is always a color associated with position 0 and 100. Stretching the gradient to a specified range, and precalculation and caching is also possible.
| enum InterpolationMode | 
| MultiGradient | ( | ) | 
Constructor.
| MultiGradient | ( | const MultiGradient & | multigradient | ) | 
Copy constructor.
| ~MultiGradient | ( | ) | 
Destructor.
| void activatePrecalculationMode | ( | DoubleReal | min, | 
| DoubleReal | max, | ||
| UInt | steps | ||
| ) | 
activates the precalculation of values (only approximate results are given)
| QColor color | ( | UInt | index | ) | 
returns the color of the index -th point 
| Exception::IndexOverflow | is thrown for a too large index | 
| void deactivatePrecalculationMode | ( | ) | 
deactivates the precalculation of values ( and deletes the precalculated values)
| bool exists | ( | DoubleReal | position | ) | 
returns if a value for position position exists 
| void fromString | ( | const std::string & | gradient | ) | 
Sets the gradient by string representation.
The string represenation of a gradient starts with the interpolation mode: "Linear" or "Stairs" and the separator "|". It is followed by an arbitrary number of integer-color-pairs.
Such a pair consists of floating point number (0.0-100.0) followed by a comma and a "#". Then follows a color in RGB notation "#RRGGBB" and finally a semicolon.
Examples are:
| 
 | static | 
Returns the default gradient for linear intensity mode.
Referenced by TOPPViewBase::setIntensityMode().
| 
 | static | 
Returns the default gradient for linear intensity mode.
Referenced by TOPPViewBase::setIntensityMode().
| InterpolationMode getInterpolationMode | ( | ) | const | 
returns the interpolaion mode
| void insert | ( | DoubleReal | position, | 
| QColor | color | ||
| ) | 
sets or replaces the color at position position 
| QColor interpolatedColorAt | ( | DoubleReal | position | ) | const | 
Returns the color as position. 
If the position is higher or lower than the range [0,100] the highest, respectively the lowest, color is returned. 
| QColor interpolatedColorAt | ( | DoubleReal | position, | 
| DoubleReal | min, | ||
| DoubleReal | max | ||
| ) | const | 
returns the color as position with the gradient stretched between min and max. 
If the position is higher or lower than the range [min,max] the highest, respectively the lowest, color is returned. 
| MultiGradient& operator= | ( | const MultiGradient & | rhs | ) | 
Assignment operator.
returns the position of the index -th point 
| Exception::IndexOverflow | is thrown for a too large index | 
| 
 | inline | 
Returns a precalculated color.
If the position is out of the the range specified in activatePrecalculationMode() the behaviour depends on the debug mode:
| 
 | inline | 
precalculated color by its index in the table
References OPENMS_PRECONDITION.
Referenced by Spectrum2DCanvas::heightColor_().
| 
 | inline | 
index of color in precalculated table by position in gradient
References OPENMS_PRECONDITION.
Referenced by Spectrum2DCanvas::precalculatedColorIndex_().
| 
 | inline | 
size of precalculated colors table
| bool remove | ( | DoubleReal | position | ) | 
removes the color at position position 
| void setInterpolationMode | ( | InterpolationMode | mode | ) | 
sets the interploation mode (default or stairs). Default is linear
| Size size | ( | ) | const | 
return the number of color points
| std::string toString | ( | ) | const | 
convert to string representation
| 
 | protected | 
Current interpolation mode.
| 
 | protected | 
Map of index and color.
| 
 | protected | 
Precalculated colors.
| 
 | protected | 
Minimum of the precalculated color range.
| 
 | protected | 
Width of the precalculated color range.
| 
 | protected | 
Steps of the precalculated color range.
| OpenMS / TOPP release 1.11.1 | Documentation generated on Thu Nov 14 2013 11:19:35 using doxygen 1.8.5 |