QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
Constrained random color ramp, which returns random colors based on preset parameters. More...
#include <qgscolorrampimpl.h>
Public Member Functions | |
QgsLimitedRandomColorRamp (int count=DEFAULT_RANDOM_COUNT, int hueMin=DEFAULT_RANDOM_HUE_MIN, int hueMax=DEFAULT_RANDOM_HUE_MAX, int satMin=DEFAULT_RANDOM_SAT_MIN, int satMax=DEFAULT_RANDOM_SAT_MAX, int valMin=DEFAULT_RANDOM_VAL_MIN, int valMax=DEFAULT_RANDOM_VAL_MAX) | |
Constructor for QgsLimitedRandomColorRamp. | |
QgsLimitedRandomColorRamp * | clone () const override |
Creates a clone of the color ramp. | |
QColor | color (double value) const override |
Returns the color corresponding to a specified value. | |
int | count () const override |
Returns number of defined colors, or -1 if undefined. | |
int | hueMax () const |
Returns the maximum hue for generated colors. | |
int | hueMin () const |
Returns the minimum hue for generated colors. | |
QVariantMap | properties () const override |
Returns a string map containing all the color ramp's properties. | |
int | satMax () const |
Returns the maximum saturation for generated colors. | |
int | satMin () const |
Returns the minimum saturation for generated colors. | |
void | setCount (int val) |
Sets the number of colors contained in the ramp. | |
void | setHueMax (int val) |
Sets the maximum hue for generated colors. | |
void | setHueMin (int val) |
Sets the minimum hue for generated colors. | |
void | setSatMax (int val) |
Sets the maximum saturation for generated colors. | |
void | setSatMin (int val) |
Sets the minimum saturation for generated colors. | |
void | setValMax (int val) |
Sets the maximum value for generated colors. | |
void | setValMin (int val) |
Sets the minimum value for generated colors. | |
QString | type () const override |
Returns a string representing the color ramp type. | |
void | updateColors () |
Must be called after changing the properties of the color ramp to regenerate the list of random colors. | |
int | valMax () const |
Returns the maximum value for generated colors. | |
int | valMin () const |
Returns the minimum value for generated colors. | |
double | value (int index) const override |
Returns relative value between [0,1] of color at specified index. | |
Public Member Functions inherited from QgsColorRamp | |
virtual | ~QgsColorRamp () |
virtual void | invert () |
Inverts the ordering of the color ramp. | |
Static Public Member Functions | |
static QgsColorRamp * | create (const QVariantMap &properties=QVariantMap()) |
Returns a new QgsLimitedRandomColorRamp color ramp created using the properties encoded in a string map. | |
static QList< QColor > | randomColors (int count, int hueMax=DEFAULT_RANDOM_HUE_MAX, int hueMin=DEFAULT_RANDOM_HUE_MIN, int satMax=DEFAULT_RANDOM_SAT_MAX, int satMin=DEFAULT_RANDOM_SAT_MIN, int valMax=DEFAULT_RANDOM_VAL_MAX, int valMin=DEFAULT_RANDOM_VAL_MIN) |
Gets a list of random colors. | |
static QString | typeString () |
Returns the string identifier for QgsLimitedRandomColorRamp. | |
Static Public Member Functions inherited from QgsColorRamp | |
static QList< QPair< QString, QString > > | rampTypes () |
Returns a list of available ramp types, where the first value in each item is the QgsColorRamp::type() string and the second is a user friendly, translated name for the color ramp type. | |
Protected Attributes | |
QList< QColor > | mColors |
int | mCount |
int | mHueMax |
int | mHueMin |
int | mSatMax |
int | mSatMin |
int | mValMax |
int | mValMin |
Constrained random color ramp, which returns random colors based on preset parameters.
Definition at line 336 of file qgscolorrampimpl.h.
QgsLimitedRandomColorRamp::QgsLimitedRandomColorRamp | ( | int | count = DEFAULT_RANDOM_COUNT , |
int | hueMin = DEFAULT_RANDOM_HUE_MIN , |
||
int | hueMax = DEFAULT_RANDOM_HUE_MAX , |
||
int | satMin = DEFAULT_RANDOM_SAT_MIN , |
||
int | satMax = DEFAULT_RANDOM_SAT_MAX , |
||
int | valMin = DEFAULT_RANDOM_VAL_MIN , |
||
int | valMax = DEFAULT_RANDOM_VAL_MAX |
||
) |
Constructor for QgsLimitedRandomColorRamp.
count | number of colors in ramp |
hueMin | minimum hue |
hueMax | maximum hue |
satMin | minimum saturation |
satMax | maximum saturation |
valMin | minimum color value |
valMax | maximum color value |
Definition at line 653 of file qgscolorrampimpl.cpp.
|
overridevirtual |
Creates a clone of the color ramp.
Implements QgsColorRamp.
Definition at line 707 of file qgscolorrampimpl.cpp.
|
overridevirtual |
Returns the color corresponding to a specified value.
value | value between [0, 1] inclusive |
Implements QgsColorRamp.
Definition at line 688 of file qgscolorrampimpl.cpp.
|
inlineoverridevirtual |
Returns number of defined colors, or -1 if undefined.
Implements QgsColorRamp.
Definition at line 376 of file qgscolorrampimpl.h.
|
static |
Returns a new QgsLimitedRandomColorRamp color ramp created using the properties encoded in a string map.
properties | color ramp properties |
Definition at line 663 of file qgscolorrampimpl.cpp.
|
inline |
Returns the maximum hue for generated colors.
Definition at line 402 of file qgscolorrampimpl.h.
|
inline |
Returns the minimum hue for generated colors.
Definition at line 396 of file qgscolorrampimpl.h.
|
overridevirtual |
Returns a string map containing all the color ramp's properties.
Implements QgsColorRamp.
Definition at line 712 of file qgscolorrampimpl.cpp.
|
static |
Gets a list of random colors.
Definition at line 726 of file qgscolorrampimpl.cpp.
|
inline |
Returns the maximum saturation for generated colors.
Definition at line 414 of file qgscolorrampimpl.h.
|
inline |
Returns the minimum saturation for generated colors.
Definition at line 408 of file qgscolorrampimpl.h.
|
inline |
Sets the number of colors contained in the ramp.
Definition at line 431 of file qgscolorrampimpl.h.
|
inline |
Sets the maximum hue for generated colors.
Definition at line 443 of file qgscolorrampimpl.h.
|
inline |
Sets the minimum hue for generated colors.
Definition at line 437 of file qgscolorrampimpl.h.
|
inline |
Sets the maximum saturation for generated colors.
Definition at line 455 of file qgscolorrampimpl.h.
|
inline |
Sets the minimum saturation for generated colors.
Definition at line 449 of file qgscolorrampimpl.h.
|
inline |
Sets the maximum value for generated colors.
Definition at line 467 of file qgscolorrampimpl.h.
|
inline |
Sets the minimum value for generated colors.
Definition at line 461 of file qgscolorrampimpl.h.
|
overridevirtual |
Returns a string representing the color ramp type.
Implements QgsColorRamp.
Definition at line 702 of file qgscolorrampimpl.cpp.
|
inlinestatic |
Returns the string identifier for QgsLimitedRandomColorRamp.
Definition at line 371 of file qgscolorrampimpl.h.
void QgsLimitedRandomColorRamp::updateColors | ( | ) |
Must be called after changing the properties of the color ramp to regenerate the list of random colors.
Definition at line 759 of file qgscolorrampimpl.cpp.
|
inline |
Returns the maximum value for generated colors.
Definition at line 426 of file qgscolorrampimpl.h.
|
inline |
Returns the minimum value for generated colors.
Definition at line 420 of file qgscolorrampimpl.h.
|
overridevirtual |
Returns relative value between [0,1] of color at specified index.
Implements QgsColorRamp.
Definition at line 681 of file qgscolorrampimpl.cpp.
|
protected |
Definition at line 477 of file qgscolorrampimpl.h.
|
protected |
Definition at line 470 of file qgscolorrampimpl.h.
|
protected |
Definition at line 472 of file qgscolorrampimpl.h.
|
protected |
Definition at line 471 of file qgscolorrampimpl.h.
|
protected |
Definition at line 474 of file qgscolorrampimpl.h.
|
protected |
Definition at line 473 of file qgscolorrampimpl.h.
|
protected |
Definition at line 476 of file qgscolorrampimpl.h.
|
protected |
Definition at line 475 of file qgscolorrampimpl.h.