QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
|
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. | |
Public Member Functions inherited from QgsColorRamp | |
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 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. | |
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 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.