QgsLimitedRandomColorRamp class
Constrained random color ramp, which returns random colors based on preset parameters.
Contents
Base classes
- class QgsColorRamp
- Abstract base class for color ramps.
Public static functions
- static auto create(const QgsStringMap& properties = QgsStringMap()) -> QgsColorRamp*
- Returns a new QgsLimitedRandomColorRamp color ramp created using the properties encoded in a string map.
-
static auto 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) -> QList<QColor> - Gets a list of random colors.
Constructors, destructors, conversion operators
-
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.
Public functions
- auto clone() const -> QgsLimitedRandomColorRamp* override
- Creates a clone of the color ramp.
- auto color(double value) const -> QColor override
- Returns the color corresponding to a specified value.
- auto count() const -> int override
- Returns number of defined colors, or -1 if undefined.
- auto hueMax() const -> int
- Returns the maximum hue for generated colors.
- auto hueMin() const -> int
- Returns the minimum hue for generated colors.
- auto properties() const -> QgsStringMap override
- Returns a string map containing all the color ramp's properties.
- auto satMax() const -> int
- Returns the maximum saturation for generated colors.
- auto satMin() const -> int
- 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.
- auto type() const -> QString 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.
- auto valMax() const -> int
- Returns the maximum value for generated colors.
- auto valMin() const -> int
- Returns the minimum value for generated colors.
- auto value(int index) const -> double override
- Returns relative value between [0,1] of color at specified index.
Function documentation
static QgsColorRamp* QgsLimitedRandomColorRamp:: create(const QgsStringMap& properties = QgsStringMap())
Returns a new QgsLimitedRandomColorRamp color ramp created using the properties encoded in a string map.
| Parameters | |
|---|---|
| properties | color ramp properties |
static QList<QColor> QgsLimitedRandomColorRamp:: 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.
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.
| Parameters | |
|---|---|
| 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 |
QColor QgsLimitedRandomColorRamp:: color(double value) const override
Returns the color corresponding to a specified value.
| Parameters | |
|---|---|
| value | value between [0, 1] inclusive |
| Returns | color for value |
int QgsLimitedRandomColorRamp:: hueMax() const
Returns the maximum hue for generated colors.
int QgsLimitedRandomColorRamp:: hueMin() const
Returns the minimum hue for generated colors.
int QgsLimitedRandomColorRamp:: satMax() const
Returns the maximum saturation for generated colors.
int QgsLimitedRandomColorRamp:: satMin() const
Returns the minimum saturation for generated colors.
void QgsLimitedRandomColorRamp:: setHueMax(int val)
Sets the maximum hue for generated colors.
void QgsLimitedRandomColorRamp:: setHueMin(int val)
Sets the minimum hue for generated colors.
void QgsLimitedRandomColorRamp:: setSatMax(int val)
Sets the maximum saturation for generated colors.
void QgsLimitedRandomColorRamp:: setSatMin(int val)
Sets the minimum saturation for generated colors.
void QgsLimitedRandomColorRamp:: setValMax(int val)
Sets the maximum value for generated colors.
void QgsLimitedRandomColorRamp:: setValMin(int val)
Sets the minimum value for generated colors.
int QgsLimitedRandomColorRamp:: valMax() const
Returns the maximum value for generated colors.
int QgsLimitedRandomColorRamp:: valMin() const
Returns the minimum value for generated colors.