|
QGIS API Documentation
3.22.4-Białowieża (ce8e65e95e)
|
Constrained random color ramp, which returns random colors based on preset parameters. More...
#include <qgscolorramp.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. More... | |
| QgsLimitedRandomColorRamp * | clone () const override |
| Creates a clone of the color ramp. More... | |
| QColor | color (double value) const override |
| Returns the color corresponding to a specified value. More... | |
| int | count () const override |
| Returns number of defined colors, or -1 if undefined. More... | |
| int | hueMax () const |
| Returns the maximum hue for generated colors. More... | |
| int | hueMin () const |
| Returns the minimum hue for generated colors. More... | |
| QVariantMap | properties () const override |
| Returns a string map containing all the color ramp's properties. More... | |
| int | satMax () const |
| Returns the maximum saturation for generated colors. More... | |
| int | satMin () const |
| Returns the minimum saturation for generated colors. More... | |
| void | setCount (int val) |
| Sets the number of colors contained in the ramp. More... | |
| void | setHueMax (int val) |
| Sets the maximum hue for generated colors. More... | |
| void | setHueMin (int val) |
| Sets the minimum hue for generated colors. More... | |
| void | setSatMax (int val) |
| Sets the maximum saturation for generated colors. More... | |
| void | setSatMin (int val) |
| Sets the minimum saturation for generated colors. More... | |
| void | setValMax (int val) |
| Sets the maximum value for generated colors. More... | |
| void | setValMin (int val) |
| Sets the minimum value for generated colors. More... | |
| QString | type () const override |
| Returns a string representing the color ramp type. More... | |
| void | updateColors () |
| Must be called after changing the properties of the color ramp to regenerate the list of random colors. More... | |
| int | valMax () const |
| Returns the maximum value for generated colors. More... | |
| int | valMin () const |
| Returns the minimum value for generated colors. More... | |
| double | value (int index) const override |
| Returns relative value between [0,1] of color at specified index. More... | |
Public Member Functions inherited from QgsColorRamp | |
| virtual | ~QgsColorRamp ()=default |
| virtual void | invert () |
| Inverts the ordering of the color ramp. More... | |
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. More... | |
| 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. More... | |
| static QString | typeString () |
| Returns the string identifier for QgsLimitedRandomColorRamp. More... | |
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. More... | |
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 304 of file qgscolorramp.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 320 of file qgscolorramp.cpp.
|
overridevirtual |
Creates a clone of the color ramp.
Implements QgsColorRamp.
Definition at line 374 of file qgscolorramp.cpp.
|
overridevirtual |
Returns the color corresponding to a specified value.
| value | value between [0, 1] inclusive |
Implements QgsColorRamp.
Definition at line 355 of file qgscolorramp.cpp.
|
inlineoverridevirtual |
Returns number of defined colors, or -1 if undefined.
Implements QgsColorRamp.
Definition at line 344 of file qgscolorramp.h.
|
static |
Returns a new QgsLimitedRandomColorRamp color ramp created using the properties encoded in a string map.
| properties | color ramp properties |
Definition at line 330 of file qgscolorramp.cpp.
|
inline |
Returns the maximum hue for generated colors.
Definition at line 371 of file qgscolorramp.h.
|
inline |
Returns the minimum hue for generated colors.
Definition at line 365 of file qgscolorramp.h.
|
overridevirtual |
Returns a string map containing all the color ramp's properties.
Implements QgsColorRamp.
Definition at line 379 of file qgscolorramp.cpp.
|
static |
|
inline |
Returns the maximum saturation for generated colors.
Definition at line 383 of file qgscolorramp.h.
|
inline |
Returns the minimum saturation for generated colors.
Definition at line 377 of file qgscolorramp.h.
|
inline |
Sets the number of colors contained in the ramp.
Definition at line 400 of file qgscolorramp.h.
|
inline |
Sets the maximum hue for generated colors.
Definition at line 412 of file qgscolorramp.h.
|
inline |
Sets the minimum hue for generated colors.
Definition at line 406 of file qgscolorramp.h.
|
inline |
Sets the maximum saturation for generated colors.
Definition at line 424 of file qgscolorramp.h.
|
inline |
Sets the minimum saturation for generated colors.
Definition at line 418 of file qgscolorramp.h.
|
inline |
Sets the maximum value for generated colors.
Definition at line 436 of file qgscolorramp.h.
|
inline |
Sets the minimum value for generated colors.
Definition at line 430 of file qgscolorramp.h.
|
overridevirtual |
Returns a string representing the color ramp type.
Implements QgsColorRamp.
Definition at line 369 of file qgscolorramp.cpp.
|
inlinestatic |
Returns the string identifier for QgsLimitedRandomColorRamp.
Definition at line 339 of file qgscolorramp.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 426 of file qgscolorramp.cpp.
|
inline |
Returns the maximum value for generated colors.
Definition at line 395 of file qgscolorramp.h.
|
inline |
Returns the minimum value for generated colors.
Definition at line 389 of file qgscolorramp.h.
|
overridevirtual |
Returns relative value between [0,1] of color at specified index.
Implements QgsColorRamp.
Definition at line 348 of file qgscolorramp.cpp.
|
protected |
Definition at line 446 of file qgscolorramp.h.
|
protected |
Definition at line 439 of file qgscolorramp.h.
|
protected |
Definition at line 441 of file qgscolorramp.h.
|
protected |
Definition at line 440 of file qgscolorramp.h.
|
protected |
Definition at line 443 of file qgscolorramp.h.
|
protected |
Definition at line 442 of file qgscolorramp.h.
|
protected |
Definition at line 445 of file qgscolorramp.h.
|
protected |
Definition at line 444 of file qgscolorramp.h.