QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Color ramp utilising "Color Brewer" preset color schemes. More...
#include <qgscolorramp.h>
Public Member Functions | |
QgsColorBrewerColorRamp (const QString &schemeName=DEFAULT_COLORBREWER_SCHEMENAME, int colors=DEFAULT_COLORBREWER_COLORS, bool inverted=false) | |
Constructor for QgsColorBrewerColorRamp. More... | |
QgsColorBrewerColorRamp * | 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 | colors () const |
Returns the number of colors in the ramp. More... | |
int | count () const override |
Returns number of defined colors, or -1 if undefined. More... | |
void | invert () override |
Inverts the ordering of the color ramp. More... | |
QgsStringMap | properties () const override |
Returns a string map containing all the color ramp's properties. More... | |
QString | schemeName () const |
Returns the name of the color brewer color scheme. More... | |
void | setColors (int colors) |
Sets the number of colors in the ramp. More... | |
void | setSchemeName (const QString &schemeName) |
Sets the name of the color brewer color scheme. More... | |
QString | type () const override |
Returns a string representing the color ramp type. 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 |
Static Public Member Functions | |
static QgsColorRamp * | create (const QgsStringMap &properties=QgsStringMap()) |
Returns a new QgsColorBrewerColorRamp color ramp created using the properties encoded in a string map. More... | |
static QStringList | listSchemeNames () |
Returns a list of all valid color brewer scheme names. More... | |
static QList< int > | listSchemeVariants (const QString &schemeName) |
Returns a list of the valid variants (numbers of colors) for a specified color brewer scheme name. More... | |
static QString | typeString () |
Returns the string identifier for QgsColorBrewerColorRamp. 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 Member Functions | |
void | loadPalette () |
Generates the scheme using the current name and number of colors. More... | |
Protected Attributes | |
int | mColors |
bool | mInverted |
QList< QColor > | mPalette |
QString | mSchemeName |
Color ramp utilising "Color Brewer" preset color schemes.
Definition at line 577 of file qgscolorramp.h.
QgsColorBrewerColorRamp::QgsColorBrewerColorRamp | ( | const QString & | schemeName = DEFAULT_COLORBREWER_SCHEMENAME , |
int | colors = DEFAULT_COLORBREWER_COLORS , |
||
bool | inverted = false |
||
) |
Constructor for QgsColorBrewerColorRamp.
schemeName | color brewer scheme name |
colors | number of colors in ramp |
inverted | invert ramp ordering |
Definition at line 506 of file qgscolorramp.cpp.
|
overridevirtual |
Creates a clone of the color ramp.
Implements QgsColorRamp.
Definition at line 580 of file qgscolorramp.cpp.
|
overridevirtual |
Returns the color corresponding to a specified value.
value | value between [0, 1] inclusive |
Implements QgsColorRamp.
Definition at line 563 of file qgscolorramp.cpp.
|
inline |
Returns the number of colors in the ramp.
Definition at line 625 of file qgscolorramp.h.
|
inlineoverridevirtual |
Returns number of defined colors, or -1 if undefined.
Implements QgsColorRamp.
Definition at line 613 of file qgscolorramp.h.
|
static |
Returns a new QgsColorBrewerColorRamp color ramp created using the properties encoded in a string map.
properties | color ramp properties |
Definition at line 514 of file qgscolorramp.cpp.
|
overridevirtual |
Inverts the ordering of the color ramp.
Reimplemented from QgsColorRamp.
Definition at line 574 of file qgscolorramp.cpp.
|
static |
Returns a list of all valid color brewer scheme names.
Definition at line 546 of file qgscolorramp.cpp.
|
static |
Returns a list of the valid variants (numbers of colors) for a specified color brewer scheme name.
schemeName | color brewer scheme name |
Definition at line 551 of file qgscolorramp.cpp.
|
protected |
Generates the scheme using the current name and number of colors.
Definition at line 530 of file qgscolorramp.cpp.
|
overridevirtual |
Returns a string map containing all the color ramp's properties.
Implements QgsColorRamp.
Definition at line 585 of file qgscolorramp.cpp.
|
inline |
Returns the name of the color brewer color scheme.
Definition at line 619 of file qgscolorramp.h.
|
inline |
Sets the number of colors in the ramp.
colors | number of colors. Must match a valid value for the scheme, which can be retrieved using listSchemeVariants() |
Definition at line 641 of file qgscolorramp.h.
|
inline |
Sets the name of the color brewer color scheme.
schemeName | scheme name, must match a valid color brewer scheme name |
Definition at line 633 of file qgscolorramp.h.
|
inlineoverridevirtual |
Returns a string representing the color ramp type.
Implements QgsColorRamp.
Definition at line 609 of file qgscolorramp.h.
|
inlinestatic |
Returns the string identifier for QgsColorBrewerColorRamp.
Definition at line 607 of file qgscolorramp.h.
|
overridevirtual |
Returns relative value between [0,1] of color at specified index.
Implements QgsColorRamp.
Definition at line 556 of file qgscolorramp.cpp.
|
protected |
Definition at line 663 of file qgscolorramp.h.
|
protected |
Definition at line 665 of file qgscolorramp.h.
|
protected |
Definition at line 664 of file qgscolorramp.h.
|
protected |
Definition at line 662 of file qgscolorramp.h.