QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
|
Color ramp utilising "Color Brewer" preset color schemes. More...
#include <qgscolorrampimpl.h>
Public Member Functions | |
QgsColorBrewerColorRamp (const QString &schemeName=DEFAULT_COLORBREWER_SCHEMENAME, int colors=DEFAULT_COLORBREWER_COLORS, bool inverted=false) | |
Constructor for QgsColorBrewerColorRamp. | |
QgsColorBrewerColorRamp * | clone () const override |
Creates a clone of the color ramp. | |
QColor | color (double value) const override |
Returns the color corresponding to a specified value. | |
int | colors () const |
Returns the number of colors in the ramp. | |
int | count () const override |
Returns number of defined colors, or -1 if undefined. | |
void | invert () override |
Inverts the ordering of the color ramp. | |
QVariantMap | properties () const override |
Returns a string map containing all the color ramp's properties. | |
QString | schemeName () const |
Returns the name of the color brewer color scheme. | |
void | setColors (int colors) |
Sets the number of colors in the ramp. | |
void | setSchemeName (const QString &schemeName) |
Sets the name of the color brewer color scheme. | |
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. | |
![]() | |
virtual | ~QgsColorRamp () |
Static Public Member Functions | |
static QgsColorRamp * | create (const QVariantMap &properties=QVariantMap()) |
Returns a new QgsColorBrewerColorRamp color ramp created using the properties encoded in a string map. | |
static QStringList | listSchemeNames () |
Returns a list of all valid color brewer scheme names. | |
static QList< int > | listSchemeVariants (const QString &schemeName) |
Returns a list of the valid variants (numbers of colors) for a specified color brewer scheme name. | |
static QString | typeString () |
Returns the string identifier for QgsColorBrewerColorRamp. | |
![]() | |
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 Member Functions | |
void | loadPalette () |
Generates the scheme using the current name and number of colors. | |
Protected Attributes | |
int | mColors |
bool | mInverted |
QList< QColor > | mPalette |
QString | mSchemeName |
Color ramp utilising "Color Brewer" preset color schemes.
Definition at line 606 of file qgscolorrampimpl.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 823 of file qgscolorrampimpl.cpp.
|
overridevirtual |
Creates a clone of the color ramp.
Implements QgsColorRamp.
Definition at line 897 of file qgscolorrampimpl.cpp.
|
overridevirtual |
Returns the color corresponding to a specified value.
value | value between [0, 1] inclusive |
Implements QgsColorRamp.
Definition at line 880 of file qgscolorrampimpl.cpp.
|
inline |
Returns the number of colors in the ramp.
Definition at line 654 of file qgscolorrampimpl.h.
|
inlineoverridevirtual |
Returns number of defined colors, or -1 if undefined.
Implements QgsColorRamp.
Definition at line 642 of file qgscolorrampimpl.h.
|
static |
Returns a new QgsColorBrewerColorRamp color ramp created using the properties encoded in a string map.
properties | color ramp properties |
Definition at line 831 of file qgscolorrampimpl.cpp.
|
overridevirtual |
Inverts the ordering of the color ramp.
Reimplemented from QgsColorRamp.
Definition at line 891 of file qgscolorrampimpl.cpp.
|
static |
Returns a list of all valid color brewer scheme names.
Definition at line 863 of file qgscolorrampimpl.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 868 of file qgscolorrampimpl.cpp.
|
protected |
Generates the scheme using the current name and number of colors.
Definition at line 847 of file qgscolorrampimpl.cpp.
|
overridevirtual |
Returns a string map containing all the color ramp's properties.
Implements QgsColorRamp.
Definition at line 902 of file qgscolorrampimpl.cpp.
|
inline |
Returns the name of the color brewer color scheme.
Definition at line 648 of file qgscolorrampimpl.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 670 of file qgscolorrampimpl.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 662 of file qgscolorrampimpl.h.
|
inlineoverridevirtual |
Returns a string representing the color ramp type.
Implements QgsColorRamp.
Definition at line 638 of file qgscolorrampimpl.h.
|
inlinestatic |
Returns the string identifier for QgsColorBrewerColorRamp.
Definition at line 636 of file qgscolorrampimpl.h.
|
overridevirtual |
Returns relative value between [0,1] of color at specified index.
Implements QgsColorRamp.
Definition at line 873 of file qgscolorrampimpl.cpp.
|
protected |
Definition at line 692 of file qgscolorrampimpl.h.
|
protected |
Definition at line 694 of file qgscolorrampimpl.h.
|
protected |
Definition at line 693 of file qgscolorrampimpl.h.
|
protected |
Definition at line 691 of file qgscolorrampimpl.h.