QGIS API Documentation
3.8.0-Zanzibar (11aff65)
|
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... | |
QgsStringMap | 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 QgsStringMap &properties=QgsStringMap()) |
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... | |
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 283 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 308 of file qgscolorramp.cpp.
|
overridevirtual |
Creates a clone of the color ramp.
Implements QgsColorRamp.
Definition at line 357 of file qgscolorramp.cpp.
|
overridevirtual |
Returns the color corresponding to a specified value.
value | value between [0, 1] inclusive |
Implements QgsColorRamp.
Definition at line 343 of file qgscolorramp.cpp.
|
inlineoverridevirtual |
Returns number of defined colors, or -1 if undefined.
Implements QgsColorRamp.
Definition at line 315 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 318 of file qgscolorramp.cpp.
|
inline |
Returns the maximum hue for generated colors.
Definition at line 342 of file qgscolorramp.h.
|
inline |
Returns the minimum hue for generated colors.
Definition at line 336 of file qgscolorramp.h.
|
overridevirtual |
Returns a string map containing all the color ramp's properties.
Implements QgsColorRamp.
Definition at line 362 of file qgscolorramp.cpp.
|
static |
|
inline |
Returns the maximum saturation for generated colors.
Definition at line 354 of file qgscolorramp.h.
|
inline |
Returns the minimum saturation for generated colors.
Definition at line 348 of file qgscolorramp.h.
|
inline |
Sets the number of colors contained in the ramp.
Definition at line 371 of file qgscolorramp.h.
|
inline |
Sets the maximum hue for generated colors.
Definition at line 383 of file qgscolorramp.h.
|
inline |
Sets the minimum hue for generated colors.
Definition at line 377 of file qgscolorramp.h.
|
inline |
Sets the maximum saturation for generated colors.
Definition at line 395 of file qgscolorramp.h.
|
inline |
Sets the minimum saturation for generated colors.
Definition at line 389 of file qgscolorramp.h.
|
inline |
Sets the maximum value for generated colors.
Definition at line 407 of file qgscolorramp.h.
|
inline |
Sets the minimum value for generated colors.
Definition at line 401 of file qgscolorramp.h.
|
inlineoverridevirtual |
Returns a string representing the color ramp type.
Implements QgsColorRamp.
Definition at line 312 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 409 of file qgscolorramp.cpp.
|
inline |
Returns the maximum value for generated colors.
Definition at line 366 of file qgscolorramp.h.
|
inline |
Returns the minimum value for generated colors.
Definition at line 360 of file qgscolorramp.h.
|
overridevirtual |
Returns relative value between [0,1] of color at specified index.
Implements QgsColorRamp.
Definition at line 336 of file qgscolorramp.cpp.
|
protected |
Definition at line 417 of file qgscolorramp.h.
|
protected |
Definition at line 410 of file qgscolorramp.h.
|
protected |
Definition at line 412 of file qgscolorramp.h.
|
protected |
Definition at line 411 of file qgscolorramp.h.
|
protected |
Definition at line 414 of file qgscolorramp.h.
|
protected |
Definition at line 413 of file qgscolorramp.h.
|
protected |
Definition at line 416 of file qgscolorramp.h.
|
protected |
Definition at line 415 of file qgscolorramp.h.