QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
qgscolorramp.h
Go to the documentation of this file.
1/***************************************************************************
2 qgscolorramp.h
3 ---------------------
4 begin : November 2009
5 copyright : (C) 2009 by Martin Dobias
6 email : wonder dot sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSCOLORRAMP_H
17#define QGSCOLORRAMP_H
18
19#include "qgis_core.h"
20#include <QColor>
21#include "qgis.h"
22
29class CORE_EXPORT QgsColorRamp
30{
31
32#ifdef SIP_RUN
34 if ( sipCpp->type() == QgsGradientColorRamp::typeString() )
35 sipType = sipType_QgsGradientColorRamp;
36 else if ( sipCpp->type() == QgsLimitedRandomColorRamp::typeString() )
37 sipType = sipType_QgsLimitedRandomColorRamp;
38 else if ( sipCpp->type() == QgsRandomColorRamp::typeString() )
39 sipType = sipType_QgsRandomColorRamp;
40 else if ( sipCpp->type() == QgsPresetSchemeColorRamp::typeString() )
41 sipType = sipType_QgsPresetSchemeColorRamp;
42 else if ( sipCpp->type() == QgsColorBrewerColorRamp::typeString() )
43 sipType = sipType_QgsColorBrewerColorRamp;
44 else if ( sipCpp->type() == QgsCptCityColorRamp::typeString() )
45 sipType = sipType_QgsCptCityColorRamp;
46 else
47 sipType = 0;
49#endif
50 public:
51
52 virtual ~QgsColorRamp();
53
57 virtual int count() const = 0;
58
62 virtual double value( int index ) const = 0;
63
69 virtual QColor color( double value ) const = 0;
70
74 virtual QString type() const = 0;
75
76
80 virtual void invert() {}
81
85 virtual QgsColorRamp *clone() const = 0 SIP_FACTORY;
86
90 virtual QVariantMap properties() const = 0;
91
101 static QList< QPair< QString, QString > > rampTypes();
102};
103
104#endif
static QString typeString()
Returns the string identifier for QgsColorBrewerColorRamp.
Abstract base class for color ramps.
virtual QColor color(double value) const =0
Returns the color corresponding to a specified value.
virtual int count() const =0
Returns number of defined colors, or -1 if undefined.
virtual double value(int index) const =0
Returns relative value between [0,1] of color at specified index.
virtual QVariantMap properties() const =0
Returns a string map containing all the color ramp's properties.
virtual QgsColorRamp * clone() const =0
Creates a clone of the color ramp.
virtual QString type() const =0
Returns a string representing the color ramp type.
virtual ~QgsColorRamp()
virtual void invert()
Inverts the ordering of the color ramp.
static QString typeString()
Returns the string identifier for QgsCptCityColorRamp.
static QString typeString()
Returns the string identifier for QgsGradientColorRamp.
static QString typeString()
Returns the string identifier for QgsLimitedRandomColorRamp.
static QString typeString()
Returns the string identifier for QgsPresetSchemeColorRamp.
static QString typeString()
Returns the string identifier for QgsRandomColorRamp.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:186
#define SIP_FACTORY
Definition qgis_sip.h:76
#define SIP_END
Definition qgis_sip.h:203