|  | OpenMS
    2.6.0
    | 
A gradient of multiple colors and arbitrary distances between colors. More...
#include <OpenMS/VISUAL/MultiGradient.h>
| Public Types | |
| enum | InterpolationMode { IM_LINEAR, IM_STAIRS } | 
| Interpolation 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 (double position, QColor color) | 
| sets or replaces the color at position positionMore... | |
| bool | remove (double position) | 
| removes the color at position positionMore... | |
| bool | exists (double 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 (double position) const | 
| Returns the color as position.  More... | |
| QColor | interpolatedColorAt (double position, double min, double max) const | 
| returns the color as positionwith the gradient stretched betweenminandmax.  More... | |
| void | activatePrecalculationMode (double min, double 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 (double 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 (double 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 interpolation mode (default or stairs). Default is linear  More... | |
| InterpolationMode | getInterpolationMode () const | 
| returns the interpolation 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 logarithmic intensity mode.  More... | |
| Protected Attributes | |
| std::map< double, QColor > | pos_col_ | 
| Map of index and color.  More... | |
| InterpolationMode | interpolation_mode_ | 
| Current interpolation mode.  More... | |
| std::vector< QColor > | pre_ | 
| Precalculated colors.  More... | |
| double | pre_min_ | 
| Minimum of the precalculated color range.  More... | |
| double | 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.
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 | ( | double | position | ) | 
returns if a value for position position exists 
| void fromString | ( | const std::string & | gradient | ) | 
Sets the gradient by string representation.
The string representation 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.
| 
 | static | 
Returns the default gradient for logarithmic intensity mode.
| InterpolationMode getInterpolationMode | ( | ) | const | 
returns the interpolation mode
| void insert | ( | double | position, | 
| QColor | color | ||
| ) | 
sets or replaces the color at position position 
| QColor interpolatedColorAt | ( | double | 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. 
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 range specified in activatePrecalculationMode() the behaviour depends on the debug mode:
References seqan::position().
| 
 | inline | 
precalculated color by its index in the table
References OPENMS_PRECONDITION.
Referenced by Spectrum2DCanvas::heightColor_().
index of color in precalculated table by position in gradient
References OPENMS_PRECONDITION, and seqan::position().
Referenced by Spectrum2DCanvas::precalculatedColorIndex_().
| 
 | inline | 
size of precalculated colors table
| bool remove | ( | double | position | ) | 
removes the color at position position 
| void setInterpolationMode | ( | InterpolationMode | mode | ) | 
sets the interpolation 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 | 
Precalculated colors.
| 
 | protected | 
Minimum of the precalculated color range.
| 
 | protected | 
Width of the precalculated color range.
| 
 | protected | 
Steps of the precalculated color range.
 1.8.16
 1.8.16