QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
QgsColorRamp Class Referenceabstract

Abstract base class for color ramps. More...

#include <qgscolorramp.h>

Inheritance diagram for QgsColorRamp:
Inheritance graph
[legend]

Public Member Functions

virtual ~QgsColorRamp ()
 
virtual QgsColorRampclone () const =0
 Creates a clone of the color ramp.
 
virtual QColor color (double value) const =0
 Returns the color corresponding to a specified value.
 
virtual int count () const =0
 Returns number of defined colors, or -1 if undefined.
 
virtual void invert ()
 Inverts the ordering of the color ramp.
 
virtual QVariantMap properties () const =0
 Returns a string map containing all the color ramp's properties.
 
virtual QString type () const =0
 Returns a string representing the color ramp type.
 
virtual double value (int index) const =0
 Returns relative value between [0,1] of color at specified index.
 

Static Public Member Functions

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.
 

Detailed Description

Abstract base class for color ramps.

Definition at line 28 of file qgscolorramp.h.

Constructor & Destructor Documentation

◆ ~QgsColorRamp()

QgsColorRamp::~QgsColorRamp ( )
virtualdefault

Member Function Documentation

◆ clone()

virtual QgsColorRamp * QgsColorRamp::clone ( ) const
pure virtual

◆ color()

virtual QColor QgsColorRamp::color ( double  value) const
pure virtual

Returns the color corresponding to a specified value.

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

Implemented in QgsGradientColorRamp, QgsLimitedRandomColorRamp, QgsRandomColorRamp, QgsPresetSchemeColorRamp, and QgsColorBrewerColorRamp.

◆ count()

virtual int QgsColorRamp::count ( ) const
pure virtual

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

Implemented in QgsGradientColorRamp, QgsLimitedRandomColorRamp, QgsRandomColorRamp, QgsPresetSchemeColorRamp, and QgsColorBrewerColorRamp.

◆ invert()

virtual void QgsColorRamp::invert ( )
inlinevirtual

Inverts the ordering of the color ramp.

Reimplemented in QgsGradientColorRamp, QgsPresetSchemeColorRamp, QgsColorBrewerColorRamp, and QgsCptCityColorRamp.

Definition at line 79 of file qgscolorramp.h.

◆ properties()

virtual QVariantMap QgsColorRamp::properties ( ) const
pure virtual

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

Implemented in QgsGradientColorRamp, QgsLimitedRandomColorRamp, QgsRandomColorRamp, QgsPresetSchemeColorRamp, QgsColorBrewerColorRamp, and QgsCptCityColorRamp.

◆ rampTypes()

QList< QPair< QString, QString > > QgsColorRamp::rampTypes ( )
static

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.

The ramp types are returned in a order of precedence for exposing in UI, with more commonly used types listed first.

Since
QGIS 3.16

Definition at line 21 of file qgscolorramp.cpp.

◆ type()

virtual QString QgsColorRamp::type ( ) const
pure virtual

◆ value()

virtual double QgsColorRamp::value ( int  index) const
pure virtual

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

Implemented in QgsGradientColorRamp, QgsLimitedRandomColorRamp, QgsRandomColorRamp, QgsPresetSchemeColorRamp, and QgsColorBrewerColorRamp.


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