QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
A scheme based color ramp consisting of a list of predefined colors. More...
#include <qgscolorrampimpl.h>
Public Member Functions | |
QgsPresetSchemeColorRamp (const QgsNamedColorList &colors) | |
Constructor for QgsPresetColorRamp. | |
QgsPresetSchemeColorRamp (const QList< QColor > &colors=QList< QColor >()) | |
Constructor for QgsPresetSchemeColorRamp. | |
QgsPresetSchemeColorRamp * | clone () const override |
Creates a clone of the color ramp. | |
QColor | color (double value) const override |
Returns the color corresponding to a specified value. | |
QList< QColor > | colors () const |
Returns the list of colors used by the ramp. | |
int | count () const override |
Returns number of defined colors, or -1 if undefined. | |
QgsNamedColorList | fetchColors (const QString &context=QString(), const QColor &baseColor=QColor()) override |
Gets a list of colors from the scheme. | |
void | invert () override |
Inverts the ordering of the color ramp. | |
bool | isEditable () const override |
Returns whether the color scheme is editable. | |
QVariantMap | properties () const override |
Returns a string map containing all the color ramp's properties. | |
QString | schemeName () const override |
Gets the name for the color scheme. | |
bool | setColors (const QgsNamedColorList &colors, const QString &=QString(), const QColor &=QColor()) override |
Sets the list of colors used by the ramp. | |
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 () |
Public Member Functions inherited from QgsColorScheme | |
QgsColorScheme ()=default | |
virtual | ~QgsColorScheme ()=default |
virtual SchemeFlags | flags () const |
Returns the current flags for the color scheme. | |
Static Public Member Functions | |
static QgsColorRamp * | create (const QVariantMap &properties=QVariantMap()) |
Returns a new QgsPresetSchemeColorRamp color ramp created using the properties encoded in a string map. | |
static QString | typeString () |
Returns the string identifier for QgsPresetSchemeColorRamp. | |
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. | |
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... | |
typedef QFlags< SchemeFlag > | SchemeFlags |
A scheme based color ramp consisting of a list of predefined colors.
Definition at line 532 of file qgscolorrampimpl.h.
QgsPresetSchemeColorRamp::QgsPresetSchemeColorRamp | ( | const QList< QColor > & | colors = QList< QColor >() | ) |
Constructor for QgsPresetSchemeColorRamp.
colors | list of colors in ramp |
Definition at line 1177 of file qgscolorrampimpl.cpp.
QgsPresetSchemeColorRamp::QgsPresetSchemeColorRamp | ( | const QgsNamedColorList & | colors | ) |
Constructor for QgsPresetColorRamp.
colors | list of named colors in ramp |
Definition at line 1189 of file qgscolorrampimpl.cpp.
|
overridevirtual |
Creates a clone of the color ramp.
Implements QgsColorRamp.
Definition at line 1263 of file qgscolorrampimpl.cpp.
|
overridevirtual |
Returns the color corresponding to a specified value.
value | value between [0, 1] inclusive |
Implements QgsColorRamp.
Definition at line 1233 of file qgscolorrampimpl.cpp.
QList< QColor > QgsPresetSchemeColorRamp::colors | ( | ) | const |
Returns the list of colors used by the ramp.
Definition at line 1215 of file qgscolorrampimpl.cpp.
|
overridevirtual |
Returns number of defined colors, or -1 if undefined.
Implements QgsColorRamp.
Definition at line 1280 of file qgscolorrampimpl.cpp.
|
static |
Returns a new QgsPresetSchemeColorRamp color ramp created using the properties encoded in a string map.
properties | color ramp properties |
Definition at line 1197 of file qgscolorrampimpl.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 1285 of file qgscolorrampimpl.cpp.
|
overridevirtual |
Inverts the ordering of the color ramp.
Reimplemented from QgsColorRamp.
Definition at line 1252 of file qgscolorrampimpl.cpp.
|
inlineoverridevirtual |
Returns whether the color scheme is editable.
true
if scheme is editable Reimplemented from QgsColorScheme.
Definition at line 587 of file qgscolorrampimpl.h.
|
overridevirtual |
Returns a string map containing all the color ramp's properties.
Implements QgsColorRamp.
Definition at line 1268 of file qgscolorrampimpl.cpp.
|
inlineoverridevirtual |
Gets the name for the color scheme.
Implements QgsColorScheme.
Definition at line 585 of file qgscolorrampimpl.h.
|
inlineoverridevirtual |
Sets the list of colors used by the ramp.
colors | list of colors |
Reimplemented from QgsColorScheme.
Definition at line 561 of file qgscolorrampimpl.h.
|
overridevirtual |
Returns a string representing the color ramp type.
Implements QgsColorRamp.
Definition at line 1247 of file qgscolorrampimpl.cpp.
|
inlinestatic |
Returns the string identifier for QgsPresetSchemeColorRamp.
Definition at line 577 of file qgscolorrampimpl.h.
|
overridevirtual |
Returns relative value between [0,1] of color at specified index.
Implements QgsColorRamp.
Definition at line 1226 of file qgscolorrampimpl.cpp.