|
OpenMS
2.6.0
|
Go to the documentation of this file.
38 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
47 #include <QtGui/QColor>
74 static MultiGradient getDefaultGradientLogarithmicIntensityMode();
96 void insert(
double position, QColor color);
112 QColor color(
UInt index);
121 QColor interpolatedColorAt(
double position)
const;
128 QColor interpolatedColorAt(
double position,
double min,
double max)
const;
131 void activatePrecalculationMode(
double min,
double max,
UInt steps);
133 void deactivatePrecalculationMode();
138 OPENMS_PRECONDITION(pre_.size() != 0,
"MultiGradient::precalculatedColorIndex(double): Precalculation mode not activated!");
139 OPENMS_PRECONDITION(
position >= pre_min_, (
String(
"MultiGradient::precalculatedColorIndex(double): position ") +
position +
" out of specified range (" + pre_min_ +
"-" + (pre_min_ + pre_size_) +
")!").c_str());
141 Int index = (
Int)((
position - pre_min_) / pre_size_ * pre_steps_);
143 return qBound( 0, index, (
Int)pre_.size() - 1 );
149 OPENMS_PRECONDITION(pre_.size() != 0,
"MultiGradient::precalculatedColorByIndex(Int): Precalculation mode not activated!");
150 OPENMS_PRECONDITION( index >= 0,
"MultiGradient::precalculatedColorByIndex(Int): negative indexes not allowed");
151 OPENMS_PRECONDITION( index < (
Int)pre_.size(), (
String(
"MultiGradient::indexedColor(Int): index ") + index +
" out of specified range (0-" + pre_.size() +
")!").c_str());
165 return precalculatedColorByIndex( precalculatedColorIndex(
position ) );
178 void setInterpolationMode(InterpolationMode mode);
180 InterpolationMode getInterpolationMode()
const;
199 void fromString(
const std::string & gradient);
A gradient of multiple colors and arbitrary distances between colors.
Definition: MultiGradient.h:67
double pre_size_
Width of the precalculated color range.
Definition: MultiGradient.h:211
A more convenient string class.
Definition: String.h:59
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: openms/include/OpenMS/CONCEPT/Macros.h:136
double pre_min_
Minimum of the precalculated color range.
Definition: MultiGradient.h:209
InterpolationMode
Interpolation mode.
Definition: MultiGradient.h:77
InterpolationMode interpolation_mode_
Current interpolation mode.
Definition: MultiGradient.h:205
Int precalculatedColorIndex(double position) const
index of color in precalculated table by position in gradient
Definition: MultiGradient.h:136
int Int
Signed integer type.
Definition: Types.h:102
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
std::vector< QColor > pre_
Precalculated colors.
Definition: MultiGradient.h:207
QColor precalculatedColorByIndex(Int index) const
precalculated color by its index in the table
Definition: MultiGradient.h:147
UInt pre_steps_
Steps of the precalculated color range.
Definition: MultiGradient.h:213
Size precalculatedSize() const
size of precalculated colors table
Definition: MultiGradient.h:172
IM_LINEAR returns the linear interpolation (default).
Definition: MultiGradient.h:79
std::map< double, QColor > pos_col_
Map of index and color.
Definition: MultiGradient.h:203
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
String toString(const T &i)
fallback template for general purpose using Boost::Karma; more specializations below
Definition: StringUtils.h:127
Size< TNeedle >::Type position(const PatternAuxData< TNeedle > &dh)
Definition: AhoCorasickAmbiguous.h:561
QColor precalculatedColorAt(double position) const
Returns a precalculated color.
Definition: MultiGradient.h:163