35 #ifndef OPENMS_VISUAL_MULTIGRADIENT_H 
   36 #define OPENMS_VISUAL_MULTIGRADIENT_H 
   45 #include <QtGui/QColor> 
   72     static MultiGradient getDefaultGradientLogarithmicIntensityMode();
 
   94     void insert(
DoubleReal position, QColor color);
 
  110     QColor color(
UInt index);
 
  119     QColor interpolatedColorAt(
DoubleReal position) 
const;
 
  131     void deactivatePrecalculationMode();
 
  136       OPENMS_PRECONDITION(pre_.size() != 0, 
"MultiGradient::precalculatedColorIndex(DoubleReal): Precalculation mode not activated!");
 
  137       OPENMS_PRECONDITION(position >= pre_min_, (
String(
"MultiGradient::precalculatedColorIndex(DoubleReal): position ") + position + 
" out of specified range (" + pre_min_ + 
"-" + (pre_min_ + pre_size_) + 
")!").c_str());
 
  139       Int index = (
Int)((position - pre_min_) / pre_size_ * pre_steps_);
 
  141       return qBound( 0, index, (
Int)pre_.size() - 1 );
 
  147       OPENMS_PRECONDITION(pre_.size() != 0, 
"MultiGradient::precalculatedColorByIndex(Int): Precalculation mode not activated!");
 
  148       OPENMS_PRECONDITION( index >= 0, 
"MultiGradient::precalculatedColorByIndex(Int): negative indexes not allowed");
 
  149       OPENMS_PRECONDITION( index < (
Int)pre_.size(), (
String(
"MultiGradient::indexedColor(Int): index ") + index + 
" out of specified range (0-" + pre_.size() + 
")!").c_str());
 
  163       return precalculatedColorByIndex( precalculatedColorIndex( position ) );
 
  176     void setInterpolationMode(InterpolationMode mode);
 
  178     InterpolationMode getInterpolationMode() 
const;
 
  181     std::string toString() 
const;
 
  197     void fromString(
const std::string & gradient);
 
  216 #endif // OPENMS_VISUAL_MULTIGRADIENT_H 
QColor precalculatedColorAt(DoubleReal position) const 
Returns a precalculated color. 
Definition: MultiGradient.h:161
InterpolationMode
Interploation mode. 
Definition: MultiGradient.h:75
A more convenient string class. 
Definition: String.h:56
#define OPENMS_PRECONDITION(condition, message)
Precondition macro. 
Definition: Macros.h:107
InterpolationMode interpolation_mode_
Current interpolation mode. 
Definition: MultiGradient.h:203
UInt pre_steps_
Steps of the precalculated color range. 
Definition: MultiGradient.h:211
Int precalculatedColorIndex(DoubleReal position) const 
index of color in precalculated table by position in gradient 
Definition: MultiGradient.h:134
std::vector< QColor > pre_
Precalculated colors. 
Definition: MultiGradient.h:205
IM_LINEAR returns the linear interploation (default). 
Definition: MultiGradient.h:77
size_t Size
Size type e.g. used as variable which can hold result of size() 
Definition: Types.h:144
QColor precalculatedColorByIndex(Int index) const 
precalculated color by its index in the table 
Definition: MultiGradient.h:145
std::map< DoubleReal, QColor > pos_col_
Map of index and color. 
Definition: MultiGradient.h:201
DoubleReal pre_min_
Minimum of the precalculated color range. 
Definition: MultiGradient.h:207
Size precalculatedSize() const 
size of precalculated colors table 
Definition: MultiGradient.h:170
DoubleReal pre_size_
Width of the precalculated color range. 
Definition: MultiGradient.h:209
A gradient of multiple colors and arbitrary distances between colors. 
Definition: MultiGradient.h:65
int Int
Signed integer type. 
Definition: Types.h:100