QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
QgsRandomColorRamp Class Reference

Totally random color ramp. More...

#include <qgscolorrampimpl.h>

Inheritance diagram for QgsRandomColorRamp:
Inheritance graph
[legend]

Public Member Functions

 QgsRandomColorRamp ()=default
 Constructor for QgsRandomColorRamp.
 
QgsRandomColorRampclone () 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.
 
QVariantMap properties () const override
 Returns a string map containing all the color ramp's properties.
 
virtual void setTotalColorCount (int colorCount)
 Sets the desired total number of unique colors for the resultant ramp.
 
QString type () const override
 Returns a string representing the color ramp type.
 
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 QString typeString ()
 Returns the string identifier for QgsRandomColorRamp.
 
- 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 > mPrecalculatedColors
 
int mTotalColorCount = 0
 

Detailed Description

Totally random color ramp.

Returns colors generated at random, but constrained to some hardcoded saturation and value ranges to prevent ugly color generation.

Since
QGIS 3.0

Definition at line 492 of file qgscolorrampimpl.h.

Constructor & Destructor Documentation

◆ QgsRandomColorRamp()

QgsRandomColorRamp::QgsRandomColorRamp ( )
default

Constructor for QgsRandomColorRamp.

Member Function Documentation

◆ clone()

QgsRandomColorRamp * QgsRandomColorRamp::clone ( ) const
overridevirtual

Creates a clone of the color ramp.

Implements QgsColorRamp.

Definition at line 804 of file qgscolorrampimpl.cpp.

◆ color()

QColor QgsRandomColorRamp::color ( double  value) const
overridevirtual

Returns the color corresponding to a specified value.

Parameters
valuevalue between [0, 1] inclusive
Returns
color for value

Implements QgsColorRamp.

Definition at line 739 of file qgscolorrampimpl.cpp.

◆ count()

int QgsRandomColorRamp::count ( ) const
overridevirtual

Returns number of defined colors, or -1 if undefined.

Implements QgsColorRamp.

Definition at line 728 of file qgscolorrampimpl.cpp.

◆ properties()

QVariantMap QgsRandomColorRamp::properties ( ) const
overridevirtual

Returns a string map containing all the color ramp's properties.

Implements QgsColorRamp.

Definition at line 809 of file qgscolorrampimpl.cpp.

◆ setTotalColorCount()

void QgsRandomColorRamp::setTotalColorCount ( int  colorCount)
virtual

Sets the desired total number of unique colors for the resultant ramp.

Calling this method pregenerates a set of visually distinct colors which are returned by subsequent calls to color().

Parameters
colorCountnumber of unique colors
Since
QGIS 2.5

Definition at line 765 of file qgscolorrampimpl.cpp.

◆ type()

QString QgsRandomColorRamp::type ( ) const
overridevirtual

Returns a string representing the color ramp type.

Implements QgsColorRamp.

Definition at line 799 of file qgscolorrampimpl.cpp.

◆ typeString()

static QString QgsRandomColorRamp::typeString ( )
inlinestatic

Returns the string identifier for QgsRandomColorRamp.

Since
QGIS 3.16

Definition at line 521 of file qgscolorrampimpl.h.

◆ value()

double QgsRandomColorRamp::value ( int  index) const
overridevirtual

Returns relative value between [0,1] of color at specified index.

Implements QgsColorRamp.

Definition at line 733 of file qgscolorrampimpl.cpp.

Member Data Documentation

◆ mPrecalculatedColors

QList<QColor> QgsRandomColorRamp::mPrecalculatedColors
protected

Definition at line 532 of file qgscolorrampimpl.h.

◆ mTotalColorCount

int QgsRandomColorRamp::mTotalColorCount = 0
protected

Definition at line 531 of file qgscolorrampimpl.h.


The documentation for this class was generated from the following files: