QGIS API Documentation
3.4.15-Madeira (e83d02e274)
|
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... | |
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 535 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 495 of file qgscolorramp.cpp.
|
overridevirtual |
Creates a clone of the color ramp.
Implements QgsColorRamp.
Definition at line 569 of file qgscolorramp.cpp.
|
overridevirtual |
Returns the color corresponding to a specified value.
value | value between [0, 1] inclusive |
Implements QgsColorRamp.
Definition at line 552 of file qgscolorramp.cpp.
|
inline |
Returns the number of colors in the ramp.
Definition at line 575 of file qgscolorramp.h.
|
inlineoverridevirtual |
Returns number of defined colors, or -1 if undefined.
Implements QgsColorRamp.
Definition at line 563 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 503 of file qgscolorramp.cpp.
|
overridevirtual |
Inverts the ordering of the color ramp.
Reimplemented from QgsColorRamp.
Definition at line 563 of file qgscolorramp.cpp.
|
static |
Returns a list of all valid color brewer scheme names.
Definition at line 535 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 540 of file qgscolorramp.cpp.
|
protected |
Generates the scheme using the current name and number of colors.
Definition at line 519 of file qgscolorramp.cpp.
|
overridevirtual |
Returns a string map containing all the color ramp's properties.
Implements QgsColorRamp.
Definition at line 574 of file qgscolorramp.cpp.
|
inline |
Returns the name of the color brewer color scheme.
Definition at line 569 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 591 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 583 of file qgscolorramp.h.
|
inlineoverridevirtual |
Returns a string representing the color ramp type.
Implements QgsColorRamp.
Definition at line 559 of file qgscolorramp.h.
|
overridevirtual |
Returns relative value between [0,1] of color at specified index.
Implements QgsColorRamp.
Definition at line 545 of file qgscolorramp.cpp.
|
protected |
Definition at line 613 of file qgscolorramp.h.
|
protected |
Definition at line 615 of file qgscolorramp.h.
|
protected |
Definition at line 614 of file qgscolorramp.h.
|
protected |
Definition at line 612 of file qgscolorramp.h.