QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
|
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. 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... | |
QVariantMap | 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... | |
![]() | |
virtual | ~QgsColorRamp () |
virtual QgsColorRamp * | clone () const =0 |
Creates a clone of the color ramp. More... | |
virtual QColor | color (double value) const =0 |
Returns the color corresponding to a specified value. More... | |
virtual int | count () const =0 |
Returns number of defined colors, or -1 if undefined. More... | |
virtual void | invert () |
Inverts the ordering of the color ramp. More... | |
virtual QVariantMap | properties () const =0 |
Returns a string map containing all the color ramp's properties. More... | |
virtual QString | type () const =0 |
Returns a string representing the color ramp type. More... | |
virtual double | value (int index) const =0 |
Returns relative value between [0,1] of color at specified index. More... | |
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. 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 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 615 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 816 of file qgscolorrampimpl.cpp.
|
overridevirtual |
Creates a clone of the color ramp.
Implements QgsColorRamp.
Definition at line 890 of file qgscolorrampimpl.cpp.
|
overridevirtual |
Returns the color corresponding to a specified value.
value | value between [0, 1] inclusive |
Implements QgsColorRamp.
Definition at line 873 of file qgscolorrampimpl.cpp.
|
inline |
Returns the number of colors in the ramp.
Definition at line 663 of file qgscolorrampimpl.h.
|
inlineoverridevirtual |
Returns number of defined colors, or -1 if undefined.
Implements QgsColorRamp.
Definition at line 651 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 824 of file qgscolorrampimpl.cpp.
|
overridevirtual |
Inverts the ordering of the color ramp.
Reimplemented from QgsColorRamp.
Definition at line 884 of file qgscolorrampimpl.cpp.
|
static |
Returns a list of all valid color brewer scheme names.
Definition at line 856 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 861 of file qgscolorrampimpl.cpp.
|
protected |
Generates the scheme using the current name and number of colors.
Definition at line 840 of file qgscolorrampimpl.cpp.
|
overridevirtual |
Returns a string map containing all the color ramp's properties.
Implements QgsColorRamp.
Definition at line 895 of file qgscolorrampimpl.cpp.
|
inline |
Returns the name of the color brewer color scheme.
Definition at line 657 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 679 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 671 of file qgscolorrampimpl.h.
|
inlineoverridevirtual |
Returns a string representing the color ramp type.
Implements QgsColorRamp.
Definition at line 647 of file qgscolorrampimpl.h.
|
inlinestatic |
Returns the string identifier for QgsColorBrewerColorRamp.
Definition at line 645 of file qgscolorrampimpl.h.
|
overridevirtual |
Returns relative value between [0,1] of color at specified index.
Implements QgsColorRamp.
Definition at line 866 of file qgscolorrampimpl.cpp.
|
protected |
Definition at line 701 of file qgscolorrampimpl.h.
|
protected |
Definition at line 703 of file qgscolorrampimpl.h.
|
protected |
Definition at line 702 of file qgscolorrampimpl.h.
|
protected |
Definition at line 700 of file qgscolorrampimpl.h.