QGIS API Documentation
3.8.0-Zanzibar (11aff65)
|
A scheme based color ramp consisting of a list of predefined colors. More...
#include <qgscolorramp.h>
Public Member Functions | |
QgsPresetSchemeColorRamp (const QList< QColor > &colors=QList< QColor >()) | |
Constructor for QgsPresetSchemeColorRamp. More... | |
QgsPresetSchemeColorRamp (const QgsNamedColorList &colors) | |
Constructor for QgsPresetColorRamp. More... | |
QgsPresetSchemeColorRamp * | 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... | |
QList< QColor > | colors () const |
Returns the list of colors used by the ramp. More... | |
int | count () const override |
Returns number of defined colors, or -1 if undefined. More... | |
QgsNamedColorList | fetchColors (const QString &context=QString(), const QColor &baseColor=QColor()) override |
Gets a list of colors from the scheme. More... | |
void | invert () override |
Inverts the ordering of the color ramp. More... | |
bool | isEditable () const override |
Returns whether the color scheme is editable. More... | |
QgsStringMap | properties () const override |
Returns a string map containing all the color ramp's properties. More... | |
QString | schemeName () const override |
Gets the name for the color scheme. More... | |
bool | setColors (const QgsNamedColorList &colors, const QString &=QString(), const QColor &=QColor()) override |
Sets the list of colors used by the ramp. 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 |
Public Member Functions inherited from QgsColorScheme | |
QgsColorScheme ()=default | |
Constructor for QgsColorScheme. More... | |
virtual | ~QgsColorScheme ()=default |
virtual SchemeFlags | flags () const |
Returns the current flags for the color scheme. More... | |
Static Public Member Functions | |
static QgsColorRamp * | create (const QgsStringMap &properties=QgsStringMap()) |
Returns a new QgsPresetSchemeColorRamp color ramp created using the properties encoded in a string map. More... | |
Additional Inherited Members | |
Public Types inherited from QgsColorScheme | |
enum | SchemeFlag { ShowInColorDialog = 0x01, ShowInColorButtonMenu = 0x02, ShowInAllContexts = ShowInColorDialog | ShowInColorButtonMenu } |
Flags for controlling behavior of color scheme. More... | |
A scheme based color ramp consisting of a list of predefined colors.
Definition at line 471 of file qgscolorramp.h.
QgsPresetSchemeColorRamp::QgsPresetSchemeColorRamp | ( | const QList< QColor > & | colors = QList< QColor >() | ) |
Constructor for QgsPresetSchemeColorRamp.
colors | list of colors in ramp |
Definition at line 811 of file qgscolorramp.cpp.
QgsPresetSchemeColorRamp::QgsPresetSchemeColorRamp | ( | const QgsNamedColorList & | colors | ) |
Constructor for QgsPresetColorRamp.
colors | list of named colors in ramp |
Definition at line 823 of file qgscolorramp.cpp.
|
overridevirtual |
Creates a clone of the color ramp.
Implements QgsColorRamp.
Definition at line 892 of file qgscolorramp.cpp.
|
overridevirtual |
Returns the color corresponding to a specified value.
value | value between [0, 1] inclusive |
Implements QgsColorRamp.
Definition at line 867 of file qgscolorramp.cpp.
QList< QColor > QgsPresetSchemeColorRamp::colors | ( | ) | const |
Returns the list of colors used by the ramp.
Definition at line 849 of file qgscolorramp.cpp.
|
overridevirtual |
Returns number of defined colors, or -1 if undefined.
Implements QgsColorRamp.
Definition at line 909 of file qgscolorramp.cpp.
|
static |
Returns a new QgsPresetSchemeColorRamp color ramp created using the properties encoded in a string map.
properties | color ramp properties |
Definition at line 831 of file qgscolorramp.cpp.
|
overridevirtual |
Gets a list of colors from the scheme.
The colors can optionally be generated using the supplied context and base color.
context | string specifying an optional context for the returned colors. For instance, a "recent colors" scheme may filter returned colors by context so that colors used only in a "composer" context are returned. |
baseColor | base color for the scheme's colors. Some color schemes may take advantage of this to filter or modify their returned colors to colors related to the base color. |
Implements QgsColorScheme.
Definition at line 914 of file qgscolorramp.cpp.
|
overridevirtual |
Inverts the ordering of the color ramp.
Reimplemented from QgsColorRamp.
Definition at line 881 of file qgscolorramp.cpp.
|
inlineoverridevirtual |
Returns whether the color scheme is editable.
true
if scheme is editable Reimplemented from QgsColorScheme.
Definition at line 518 of file qgscolorramp.h.
|
overridevirtual |
Returns a string map containing all the color ramp's properties.
Implements QgsColorRamp.
Definition at line 897 of file qgscolorramp.cpp.
|
inlineoverridevirtual |
Gets the name for the color scheme.
Implements QgsColorScheme.
Definition at line 516 of file qgscolorramp.h.
|
inlineoverridevirtual |
Sets the list of colors used by the ramp.
colors | list of colors |
Reimplemented from QgsColorScheme.
Definition at line 500 of file qgscolorramp.h.
|
inlineoverridevirtual |
Returns a string representing the color ramp type.
Implements QgsColorRamp.
Definition at line 510 of file qgscolorramp.h.
|
overridevirtual |
Returns relative value between [0,1] of color at specified index.
Implements QgsColorRamp.
Definition at line 860 of file qgscolorramp.cpp.