QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
|
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. 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 () |
virtual QgsColorRamp * | clone () const =0 |
Creates a clone of the color ramp. More... | |
virtual QColor | color (double value) const =0 |
Returns the color corresponding to a specified value. More... | |
virtual int | count () const =0 |
Returns number of defined colors, or -1 if undefined. More... | |
virtual void | invert () |
Inverts the ordering of the color ramp. More... | |
virtual QVariantMap | properties () const =0 |
Returns a string map containing all the color ramp's properties. More... | |
virtual QString | type () const =0 |
Returns a string representing the color ramp type. More... | |
virtual double | value (int index) const =0 |
Returns relative value between [0,1] of color at specified index. 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 340 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 615 of file qgscolorrampimpl.cpp.
|
overridevirtual |
Creates a clone of the color ramp.
Implements QgsColorRamp.
Definition at line 669 of file qgscolorrampimpl.cpp.
|
overridevirtual |
Returns the color corresponding to a specified value.
value | value between [0, 1] inclusive |
Implements QgsColorRamp.
Definition at line 650 of file qgscolorrampimpl.cpp.
|
inlineoverridevirtual |
Returns number of defined colors, or -1 if undefined.
Implements QgsColorRamp.
Definition at line 380 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 625 of file qgscolorrampimpl.cpp.
|
inline |
Returns the maximum hue for generated colors.
Definition at line 407 of file qgscolorrampimpl.h.
|
inline |
Returns the minimum hue for generated colors.
Definition at line 401 of file qgscolorrampimpl.h.
|
overridevirtual |
Returns a string map containing all the color ramp's properties.
Implements QgsColorRamp.
Definition at line 674 of file qgscolorrampimpl.cpp.
|
static |
|
inline |
Returns the maximum saturation for generated colors.
Definition at line 419 of file qgscolorrampimpl.h.
|
inline |
Returns the minimum saturation for generated colors.
Definition at line 413 of file qgscolorrampimpl.h.
|
inline |
Sets the number of colors contained in the ramp.
Definition at line 436 of file qgscolorrampimpl.h.
|
inline |
Sets the maximum hue for generated colors.
Definition at line 448 of file qgscolorrampimpl.h.
|
inline |
Sets the minimum hue for generated colors.
Definition at line 442 of file qgscolorrampimpl.h.
|
inline |
Sets the maximum saturation for generated colors.
Definition at line 460 of file qgscolorrampimpl.h.
|
inline |
Sets the minimum saturation for generated colors.
Definition at line 454 of file qgscolorrampimpl.h.
|
inline |
Sets the maximum value for generated colors.
Definition at line 472 of file qgscolorrampimpl.h.
|
inline |
Sets the minimum value for generated colors.
Definition at line 466 of file qgscolorrampimpl.h.
|
overridevirtual |
Returns a string representing the color ramp type.
Implements QgsColorRamp.
Definition at line 664 of file qgscolorrampimpl.cpp.
|
inlinestatic |
Returns the string identifier for QgsLimitedRandomColorRamp.
Definition at line 375 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 721 of file qgscolorrampimpl.cpp.
|
inline |
Returns the maximum value for generated colors.
Definition at line 431 of file qgscolorrampimpl.h.
|
inline |
Returns the minimum value for generated colors.
Definition at line 425 of file qgscolorrampimpl.h.
|
overridevirtual |
Returns relative value between [0,1] of color at specified index.
Implements QgsColorRamp.
Definition at line 643 of file qgscolorrampimpl.cpp.
|
protected |
Definition at line 482 of file qgscolorrampimpl.h.
|
protected |
Definition at line 475 of file qgscolorrampimpl.h.
|
protected |
Definition at line 477 of file qgscolorrampimpl.h.
|
protected |
Definition at line 476 of file qgscolorrampimpl.h.
|
protected |
Definition at line 479 of file qgscolorrampimpl.h.
|
protected |
Definition at line 478 of file qgscolorrampimpl.h.
|
protected |
Definition at line 481 of file qgscolorrampimpl.h.
|
protected |
Definition at line 480 of file qgscolorrampimpl.h.