QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 
29 class 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;
48  SIP_END
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
QgsColorRamp
Abstract base class for color ramps.
Definition: qgscolorramp.h:29
qgis.h
QgsColorBrewerColorRamp::typeString
static QString typeString()
Returns the string identifier for QgsColorBrewerColorRamp.
Definition: qgscolorrampimpl.h:645
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsCptCityColorRamp::typeString
static QString typeString()
Returns the string identifier for QgsCptCityColorRamp.
Definition: qgscolorrampimpl.h:750
QgsGradientColorRamp::typeString
static QString typeString()
Returns the string identifier for QgsGradientColorRamp.
Definition: qgscolorrampimpl.h:165
SIP_CONVERT_TO_SUBCLASS_CODE
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:186
QgsPresetSchemeColorRamp::typeString
static QString typeString()
Returns the string identifier for QgsPresetSchemeColorRamp.
Definition: qgscolorrampimpl.h:588
QgsRandomColorRamp::typeString
static QString typeString()
Returns the string identifier for QgsRandomColorRamp.
Definition: qgscolorrampimpl.h:521
QgsColorRamp::invert
virtual void invert()
Inverts the ordering of the color ramp.
Definition: qgscolorramp.h:80
SIP_END
#define SIP_END
Definition: qgis_sip.h:203
QgsLimitedRandomColorRamp::typeString
static QString typeString()
Returns the string identifier for QgsLimitedRandomColorRamp.
Definition: qgscolorrampimpl.h:375