QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 <QGradient>
22 #include "qgis.h"
23 #include "qgscolorscheme.h"
24 
31 class CORE_EXPORT QgsColorRamp
32 {
33 
34 #ifdef SIP_RUN
36  if ( sipCpp->type() == "gradient" )
37  sipType = sipType_QgsGradientColorRamp;
38  else if ( sipCpp->type() == "random" )
39  sipType = sipType_QgsLimitedRandomColorRamp;
40  else if ( sipCpp->type() == "randomcolors" )
41  sipType = sipType_QgsRandomColorRamp;
42  else if ( sipCpp->type() == "preset" )
43  sipType = sipType_QgsPresetSchemeColorRamp;
44  else if ( sipCpp->type() == "colorbrewer" )
45  sipType = sipType_QgsColorBrewerColorRamp;
46  else if ( sipCpp->type() == "cpt-city" )
47  sipType = sipType_QgsCptCityColorRamp;
48  else
49  sipType = 0;
50  SIP_END
51 #endif
52  public:
53 
54  virtual ~QgsColorRamp() = default;
55 
59  virtual int count() const = 0;
60 
64  virtual double value( int index ) const = 0;
65 
71  virtual QColor color( double value ) const = 0;
72 
76  virtual QString type() const = 0;
77 
78 
82  virtual void invert() {}
83 
87  virtual QgsColorRamp *clone() const = 0 SIP_FACTORY;
88 
92  virtual QgsStringMap properties() const = 0;
93 };
94 
101 class CORE_EXPORT QgsGradientStop
102 {
103  public:
104 
110  QgsGradientStop( double offset, const QColor &color )
111  : offset( offset )
112  , color( color )
113  { }
114 
116  double offset;
118  QColor color;
119 
120  bool operator==( const QgsGradientStop &other ) const
121  {
122  return other.color == color && qgsDoubleNear( other.offset, offset );
123  }
124 };
125 
127 typedef QList<QgsGradientStop> QgsGradientStopsList;
128 
129 #define DEFAULT_GRADIENT_COLOR1 QColor(0,0,255)
130 #define DEFAULT_GRADIENT_COLOR2 QColor(0,255,0)
131 
139 class CORE_EXPORT QgsGradientColorRamp : public QgsColorRamp
140 {
141  public:
142 
151  QgsGradientColorRamp( const QColor &color1 = DEFAULT_GRADIENT_COLOR1,
152  const QColor &color2 = DEFAULT_GRADIENT_COLOR2,
153  bool discrete = false,
154  const QgsGradientStopsList &stops = QgsGradientStopsList() );
155 
157  static QgsColorRamp *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
158 
159  int count() const override { return mStops.count() + 2; }
160  double value( int index ) const override;
161  QColor color( double value ) const override;
162  QString type() const override { return QStringLiteral( "gradient" ); }
163  void invert() override;
164  QgsGradientColorRamp *clone() const override SIP_FACTORY;
165  QgsStringMap properties() const override;
166 
172  QColor color1() const { return mColor1; }
173 
179  QColor color2() const { return mColor2; }
180 
187  void setColor1( const QColor &color ) { mColor1 = color; }
188 
195  void setColor2( const QColor &color ) { mColor2 = color; }
196 
202  bool isDiscrete() const { return mDiscrete; }
203 
211  void setDiscrete( bool discrete ) { mDiscrete = discrete; }
212 
220  void convertToDiscrete( bool discrete );
221 
229  void setStops( const QgsGradientStopsList &stops );
230 
235  QgsGradientStopsList stops() const { return mStops; }
236 
241  QgsStringMap info() const { return mInfo; }
242 
248  void setInfo( const QgsStringMap &info ) { mInfo = info; }
249 
257  void addStopsToGradient( QGradient *gradient, double opacity = 1 );
258 
259  protected:
260  QColor mColor1;
261  QColor mColor2;
262  bool mDiscrete;
265 };
266 
268 
269 #define DEFAULT_RANDOM_COUNT 10
270 #define DEFAULT_RANDOM_HUE_MIN 0
271 #define DEFAULT_RANDOM_HUE_MAX 359
272 #define DEFAULT_RANDOM_VAL_MIN 200
273 #define DEFAULT_RANDOM_VAL_MAX 240
274 #define DEFAULT_RANDOM_SAT_MIN 100
275 #define DEFAULT_RANDOM_SAT_MAX 240
276 
283 class CORE_EXPORT QgsLimitedRandomColorRamp : public QgsColorRamp
284 {
285  public:
286 
298  int hueMin = DEFAULT_RANDOM_HUE_MIN, int hueMax = DEFAULT_RANDOM_HUE_MAX,
299  int satMin = DEFAULT_RANDOM_SAT_MIN, int satMax = DEFAULT_RANDOM_SAT_MAX,
300  int valMin = DEFAULT_RANDOM_VAL_MIN, int valMax = DEFAULT_RANDOM_VAL_MAX );
301 
308  static QgsColorRamp *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
309 
310  double value( int index ) const override;
311  QColor color( double value ) const override;
312  QString type() const override { return QStringLiteral( "random" ); }
313  QgsLimitedRandomColorRamp *clone() const override SIP_FACTORY;
314  QgsStringMap properties() const override;
315  int count() const override { return mCount; }
316 
321  static QList<QColor> randomColors( int count,
322  int hueMax = DEFAULT_RANDOM_HUE_MAX, int hueMin = DEFAULT_RANDOM_HUE_MIN,
323  int satMax = DEFAULT_RANDOM_SAT_MAX, int satMin = DEFAULT_RANDOM_SAT_MIN,
324  int valMax = DEFAULT_RANDOM_VAL_MAX, int valMin = DEFAULT_RANDOM_VAL_MIN );
325 
330  void updateColors();
331 
336  int hueMin() const { return mHueMin; }
337 
342  int hueMax() const { return mHueMax; }
343 
348  int satMin() const { return mSatMin; }
349 
354  int satMax() const { return mSatMax; }
355 
360  int valMin() const { return mValMin; }
361 
366  int valMax() const { return mValMax; }
367 
371  void setCount( int val ) { mCount = val; }
372 
377  void setHueMin( int val ) { mHueMin = val; }
378 
383  void setHueMax( int val ) { mHueMax = val; }
384 
389  void setSatMin( int val ) { mSatMin = val; }
390 
395  void setSatMax( int val ) { mSatMax = val; }
396 
401  void setValMin( int val ) { mValMin = val; }
402 
407  void setValMax( int val ) { mValMax = val; }
408 
409  protected:
410  int mCount;
411  int mHueMin;
412  int mHueMax;
413  int mSatMin;
414  int mSatMax;
415  int mValMin;
416  int mValMax;
417  QList<QColor> mColors;
418 };
419 
427 class CORE_EXPORT QgsRandomColorRamp: public QgsColorRamp
428 {
429  public:
430 
434  QgsRandomColorRamp() = default;
435 
436  int count() const override;
437 
438  double value( int index ) const override;
439 
440  QColor color( double value ) const override;
441 
449  virtual void setTotalColorCount( int colorCount );
450 
451  QString type() const override;
452 
453  QgsRandomColorRamp *clone() const override SIP_FACTORY;
454 
455  QgsStringMap properties() const override;
456 
457  protected:
458 
459  int mTotalColorCount = 0;
460  QList<QColor> mPrecalculatedColors;
461 
462 };
463 
464 
471 class CORE_EXPORT QgsPresetSchemeColorRamp : public QgsColorRamp, public QgsColorScheme
472 {
473  public:
474 
479  QgsPresetSchemeColorRamp( const QList< QColor > &colors = QList< QColor >() );
480 
486 
493  static QgsColorRamp *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
494 
500  bool setColors( const QgsNamedColorList &colors, const QString & = QString(), const QColor & = QColor() ) override { mColors = colors; return true; }
501 
506  QList< QColor > colors() const;
507 
508  double value( int index ) const override;
509  QColor color( double value ) const override;
510  QString type() const override { return QStringLiteral( "preset" ); }
511  void invert() override;
512  QgsPresetSchemeColorRamp *clone() const override SIP_FACTORY;
513  QgsStringMap properties() const override;
514  int count() const override;
515 
516  QString schemeName() const override { return QStringLiteral( "preset" ); }
517  QgsNamedColorList fetchColors( const QString &context = QString(), const QColor &baseColor = QColor() ) override;
518  bool isEditable() const override { return true; }
519 
520  private:
521 
522  QgsNamedColorList mColors;
523 };
524 
525 
526 #define DEFAULT_COLORBREWER_SCHEMENAME "Spectral"
527 #define DEFAULT_COLORBREWER_COLORS 5
528 
535 class CORE_EXPORT QgsColorBrewerColorRamp : public QgsColorRamp
536 {
537  public:
538 
545  QgsColorBrewerColorRamp( const QString &schemeName = DEFAULT_COLORBREWER_SCHEMENAME,
546  int colors = DEFAULT_COLORBREWER_COLORS,
547  bool inverted = false );
548 
555  static QgsColorRamp *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
556 
557  double value( int index ) const override;
558  QColor color( double value ) const override;
559  QString type() const override { return QStringLiteral( "colorbrewer" ); }
560  void invert() override;
561  QgsColorBrewerColorRamp *clone() const override SIP_FACTORY;
562  QgsStringMap properties() const override;
563  int count() const override { return mColors; }
564 
569  QString schemeName() const { return mSchemeName; }
570 
575  int colors() const { return mColors; }
576 
583  void setSchemeName( const QString &schemeName ) { mSchemeName = schemeName; loadPalette(); }
584 
591  void setColors( int colors ) { mColors = colors; loadPalette(); }
592 
597  static QStringList listSchemeNames();
598 
605  static QList<int> listSchemeVariants( const QString &schemeName );
606 
607  protected:
608 
610  void loadPalette();
611 
612  QString mSchemeName;
613  int mColors;
614  QList<QColor> mPalette;
615  bool mInverted;
616 };
617 
618 
619 #define DEFAULT_CPTCITY_SCHEMENAME "cb/div/BrBG_" //change this
620 #define DEFAULT_CPTCITY_VARIANTNAME "05"
621 
626 class CORE_EXPORT QgsCptCityColorRamp : public QgsGradientColorRamp
627 {
628  public:
629 
637  QgsCptCityColorRamp( const QString &schemeName = DEFAULT_CPTCITY_SCHEMENAME,
638  const QString &variantName = DEFAULT_CPTCITY_VARIANTNAME,
639  bool inverted = false,
640  bool doLoadFile = true );
641 
650  QgsCptCityColorRamp( const QString &schemeName, const QStringList &variantList,
651  const QString &variantName = QString(), bool inverted = false,
652  bool doLoadFile = true );
653 
654  static QgsColorRamp *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
655 
656  QString type() const override { return QStringLiteral( "cpt-city" ); }
657 
658  void invert() override;
659 
660  QgsCptCityColorRamp *clone() const override SIP_FACTORY;
661  void copy( const QgsCptCityColorRamp *other );
662  QgsGradientColorRamp *cloneGradientRamp() const SIP_FACTORY;
663 
664  QgsStringMap properties() const override;
665 
666  QString schemeName() const { return mSchemeName; }
667  QString variantName() const { return mVariantName; }
668  QStringList variantList() const { return mVariantList; }
669 
670  // lazy loading - have to call loadPalette() explicitly
671  void setSchemeName( const QString &schemeName ) { mSchemeName = schemeName; mFileLoaded = false; }
672  void setVariantName( const QString &variantName ) { mVariantName = variantName; mFileLoaded = false; }
673  void setVariantList( const QStringList &variantList ) { mVariantList = variantList; }
674  void setName( const QString &schemeName, const QString &variantName = QString(), const QStringList &variantList = QStringList() )
675  { mSchemeName = schemeName; mVariantName = variantName; mVariantList = variantList; mFileLoaded = false; }
676 
677  void loadPalette() { loadFile(); }
678  bool hasMultiStops() const { return mMultiStops; }
679 
680  QString fileName() const;
681  bool loadFile();
682  bool fileLoaded() const { return mFileLoaded; }
683 
684  QString copyingFileName() const;
685  QString descFileName() const;
686  QgsStringMap copyingInfo() const;
687 
688  protected:
689  QString mSchemeName;
690  QString mVariantName;
691  QStringList mVariantList;
692  bool mFileLoaded = false;
693  bool mMultiStops = false;
694  bool mInverted;
695 
696 };
697 
698 // clazy:excludeall=qstring-allocations
699 
700 #endif
QgsGradientStop::QgsGradientStop
QgsGradientStop(double offset, const QColor &color)
Constructor for QgsGradientStop.
Definition: qgscolorramp.h:110
DEFAULT_RANDOM_VAL_MAX
#define DEFAULT_RANDOM_VAL_MAX
Definition: qgscolorramp.h:273
DEFAULT_RANDOM_HUE_MAX
#define DEFAULT_RANDOM_HUE_MAX
Definition: qgscolorramp.h:271
QgsColorRamp
Abstract base class for color ramps.
Definition: qgscolorramp.h:31
QgsRandomColorRamp::mPrecalculatedColors
QList< QColor > mPrecalculatedColors
Definition: qgscolorramp.h:460
qgscolorscheme.h
QgsCptCityColorRamp::mInverted
bool mInverted
Definition: qgscolorramp.h:694
QgsGradientStop::color
QColor color
Gradient color at stop.
Definition: qgscolorramp.h:118
QgsGradientColorRamp
Gradient color ramp, which smoothly interpolates between two colors and also supports optional extra ...
Definition: qgscolorramp.h:139
QgsCptCityColorRamp::setSchemeName
void setSchemeName(const QString &schemeName)
Definition: qgscolorramp.h:671
QgsLimitedRandomColorRamp::mSatMax
int mSatMax
Definition: qgscolorramp.h:414
QgsCptCityColorRamp::setName
void setName(const QString &schemeName, const QString &variantName=QString(), const QStringList &variantList=QStringList())
Definition: qgscolorramp.h:674
QgsLimitedRandomColorRamp::hueMin
int hueMin() const
Returns the minimum hue for generated colors.
Definition: qgscolorramp.h:336
DEFAULT_CPTCITY_VARIANTNAME
#define DEFAULT_CPTCITY_VARIANTNAME
Definition: qgscolorramp.h:620
QgsLimitedRandomColorRamp::mCount
int mCount
Definition: qgscolorramp.h:410
DEFAULT_COLORBREWER_COLORS
#define DEFAULT_COLORBREWER_COLORS
Definition: qgscolorramp.h:527
QgsLimitedRandomColorRamp::mSatMin
int mSatMin
Definition: qgscolorramp.h:413
QgsGradientColorRamp::setInfo
void setInfo(const QgsStringMap &info)
Sets additional info to attach to the gradient ramp (e.g., authorship notes)
Definition: qgscolorramp.h:248
QgsPresetSchemeColorRamp::type
QString type() const override
Returns a string representing the color ramp type.
Definition: qgscolorramp.h:510
QgsPresetSchemeColorRamp
A scheme based color ramp consisting of a list of predefined colors.
Definition: qgscolorramp.h:471
QgsCptCityColorRamp::setVariantList
void setVariantList(const QStringList &variantList)
Definition: qgscolorramp.h:673
QgsLimitedRandomColorRamp::setSatMax
void setSatMax(int val)
Sets the maximum saturation for generated colors.
Definition: qgscolorramp.h:395
QgsNamedColorList
QList< QPair< QColor, QString > > QgsNamedColorList
Definition: qgscolorscheme.h:34
DEFAULT_COLORBREWER_SCHEMENAME
#define DEFAULT_COLORBREWER_SCHEMENAME
Definition: qgscolorramp.h:526
QgsGradientColorRamp::clone
QgsGradientColorRamp * clone() const override
Creates a clone of the color ramp.
Definition: qgscolorramp.cpp:190
QgsColorBrewerColorRamp::mInverted
bool mInverted
Definition: qgscolorramp.h:615
qgis.h
QgsLimitedRandomColorRamp::setValMin
void setValMin(int val)
Sets the minimum value for generated colors.
Definition: qgscolorramp.h:401
QgsCptCityColorRamp::variantName
QString variantName() const
Definition: qgscolorramp.h:667
QgsCptCityColorRamp::variantList
QStringList variantList() const
Definition: qgscolorramp.h:668
DEFAULT_RANDOM_HUE_MIN
#define DEFAULT_RANDOM_HUE_MIN
Definition: qgscolorramp.h:270
QgsColorRamp::properties
virtual QgsStringMap properties() const =0
Returns a string map containing all the color ramp's properties.
QgsGradientColorRamp::invert
void invert() override
Inverts the ordering of the color ramp.
Definition: qgscolorramp.cpp:163
QgsLimitedRandomColorRamp
Constrained random color ramp, which returns random colors based on preset parameters.
Definition: qgscolorramp.h:283
QgsLimitedRandomColorRamp::satMax
int satMax() const
Returns the maximum saturation for generated colors.
Definition: qgscolorramp.h:354
QgsColorBrewerColorRamp
Color ramp utilising "Color Brewer" preset color schemes.
Definition: qgscolorramp.h:535
QgsLimitedRandomColorRamp::setSatMin
void setSatMin(int val)
Sets the minimum saturation for generated colors.
Definition: qgscolorramp.h:389
QgsGradientColorRamp::mColor2
QColor mColor2
Definition: qgscolorramp.h:261
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsPresetSchemeColorRamp::isEditable
bool isEditable() const override
Returns whether the color scheme is editable.
Definition: qgscolorramp.h:518
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(QgsMeshTimeSettings)
QgsLimitedRandomColorRamp::setHueMax
void setHueMax(int val)
Sets the maximum hue for generated colors.
Definition: qgscolorramp.h:383
QgsRandomColorRamp
Totally random color ramp. Returns colors generated at random, but constrained to some hardcoded satu...
Definition: qgscolorramp.h:427
QgsGradientColorRamp::stops
QgsGradientStopsList stops() const
Returns the list of intermediate gradient stops for the ramp.
Definition: qgscolorramp.h:235
QgsLimitedRandomColorRamp::type
QString type() const override
Returns a string representing the color ramp type.
Definition: qgscolorramp.h:312
QgsCptCityColorRamp::mSchemeName
QString mSchemeName
Definition: qgscolorramp.h:689
SIP_CONVERT_TO_SUBCLASS_CODE
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:172
QgsGradientStopsList
QList< QgsGradientStop > QgsGradientStopsList
List of gradient stops.
Definition: qgscolorramp.h:127
QgsGradientColorRamp::setColor1
void setColor1(const QColor &color)
Sets the gradient start color.
Definition: qgscolorramp.h:187
DEFAULT_GRADIENT_COLOR1
#define DEFAULT_GRADIENT_COLOR1
Definition: qgscolorramp.h:129
QgsGradientColorRamp::count
int count() const override
Returns number of defined colors, or -1 if undefined.
Definition: qgscolorramp.h:159
QgsLimitedRandomColorRamp::valMax
int valMax() const
Returns the maximum value for generated colors.
Definition: qgscolorramp.h:366
QgsGradientColorRamp::color2
QColor color2() const
Returns the gradient end color.
Definition: qgscolorramp.h:179
QgsLimitedRandomColorRamp::satMin
int satMin() const
Returns the minimum saturation for generated colors.
Definition: qgscolorramp.h:348
QgsColorBrewerColorRamp::colors
int colors() const
Returns the number of colors in the ramp.
Definition: qgscolorramp.h:575
QgsGradientColorRamp::setColor2
void setColor2(const QColor &color)
Sets the gradient end color.
Definition: qgscolorramp.h:195
qgsDoubleNear
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
Definition: qgis.h:315
QgsColorBrewerColorRamp::setSchemeName
void setSchemeName(const QString &schemeName)
Sets the name of the color brewer color scheme.
Definition: qgscolorramp.h:583
QgsGradientColorRamp::mColor1
QColor mColor1
Definition: qgscolorramp.h:260
DEFAULT_RANDOM_VAL_MIN
#define DEFAULT_RANDOM_VAL_MIN
Definition: qgscolorramp.h:272
QgsColorBrewerColorRamp::schemeName
QString schemeName() const
Returns the name of the color brewer color scheme.
Definition: qgscolorramp.h:569
QgsColorBrewerColorRamp::mSchemeName
QString mSchemeName
Definition: qgscolorramp.h:612
QgsGradientColorRamp::type
QString type() const override
Returns a string representing the color ramp type.
Definition: qgscolorramp.h:162
DEFAULT_RANDOM_SAT_MIN
#define DEFAULT_RANDOM_SAT_MIN
Definition: qgscolorramp.h:274
DEFAULT_CPTCITY_SCHEMENAME
#define DEFAULT_CPTCITY_SCHEMENAME
Definition: qgscolorramp.h:619
QgsColorBrewerColorRamp::type
QString type() const override
Returns a string representing the color ramp type.
Definition: qgscolorramp.h:559
QgsLimitedRandomColorRamp::setCount
void setCount(int val)
Sets the number of colors contained in the ramp.
Definition: qgscolorramp.h:371
QgsColorRamp::clone
virtual QgsColorRamp * clone() const =0
Creates a clone of the color ramp.
QgsLimitedRandomColorRamp::mColors
QList< QColor > mColors
Definition: qgscolorramp.h:417
QgsCptCityColorRamp::type
QString type() const override
Returns a string representing the color ramp type.
Definition: qgscolorramp.h:656
QgsColorBrewerColorRamp::mPalette
QList< QColor > mPalette
Definition: qgscolorramp.h:614
QgsCptCityColorRamp::setVariantName
void setVariantName(const QString &variantName)
Definition: qgscolorramp.h:672
QgsCptCityColorRamp::fileLoaded
bool fileLoaded() const
Definition: qgscolorramp.h:682
QgsStringMap
QMap< QString, QString > QgsStringMap
Definition: qgis.h:714
QgsColorScheme::fetchColors
virtual QgsNamedColorList fetchColors(const QString &context=QString(), const QColor &baseColor=QColor())=0
Gets a list of colors from the scheme.
QgsGradientStop::operator==
bool operator==(const QgsGradientStop &other) const
Definition: qgscolorramp.h:120
QgsColorScheme
Abstract base class for color schemes.
Definition: qgscolorscheme.h:46
QgsCptCityColorRamp::mVariantName
QString mVariantName
Definition: qgscolorramp.h:690
QgsLimitedRandomColorRamp::hueMax
int hueMax() const
Returns the maximum hue for generated colors.
Definition: qgscolorramp.h:342
QgsLimitedRandomColorRamp::mHueMin
int mHueMin
Definition: qgscolorramp.h:411
QgsLimitedRandomColorRamp::setHueMin
void setHueMin(int val)
Sets the minimum hue for generated colors.
Definition: qgscolorramp.h:377
QgsColorRamp::type
virtual QString type() const =0
Returns a string representing the color ramp type.
DEFAULT_RANDOM_COUNT
#define DEFAULT_RANDOM_COUNT
Definition: qgscolorramp.h:269
QgsColorRamp::count
virtual int count() const =0
Returns number of defined colors, or -1 if undefined.
QgsColorRamp::color
virtual QColor color(double value) const =0
Returns the color corresponding to a specified value.
QgsCptCityColorRamp::hasMultiStops
bool hasMultiStops() const
Definition: qgscolorramp.h:678
QgsGradientColorRamp::mInfo
QgsStringMap mInfo
Definition: qgscolorramp.h:264
QgsColorBrewerColorRamp::setColors
void setColors(int colors)
Sets the number of colors in the ramp.
Definition: qgscolorramp.h:591
QgsLimitedRandomColorRamp::mValMin
int mValMin
Definition: qgscolorramp.h:415
QgsGradientColorRamp::setDiscrete
void setDiscrete(bool discrete)
Sets whether the gradient should use discrete interpolation, rather than smoothly interpolating betwe...
Definition: qgscolorramp.h:211
QgsCptCityColorRamp::loadPalette
void loadPalette()
Definition: qgscolorramp.h:677
QgsGradientColorRamp::create
static QgsColorRamp * create(const QgsStringMap &properties=QgsStringMap())
Creates a new QgsColorRamp from a map of properties.
Definition: qgscolorramp.cpp:53
QgsCptCityColorRamp::mVariantList
QStringList mVariantList
Definition: qgscolorramp.h:691
QgsColorRamp::invert
virtual void invert()
Inverts the ordering of the color ramp.
Definition: qgscolorramp.h:82
QgsGradientColorRamp::mDiscrete
bool mDiscrete
Definition: qgscolorramp.h:262
QgsCptCityColorRamp
Definition: qgscolorramp.h:626
QgsGradientColorRamp::mStops
QgsGradientStopsList mStops
Definition: qgscolorramp.h:263
DEFAULT_GRADIENT_COLOR2
#define DEFAULT_GRADIENT_COLOR2
Definition: qgscolorramp.h:130
QgsLimitedRandomColorRamp::setValMax
void setValMax(int val)
Sets the maximum value for generated colors.
Definition: qgscolorramp.h:407
SIP_END
#define SIP_END
Definition: qgis_sip.h:189
QgsColorBrewerColorRamp::mColors
int mColors
Definition: qgscolorramp.h:613
QgsPresetSchemeColorRamp::setColors
bool setColors(const QgsNamedColorList &colors, const QString &=QString(), const QColor &=QColor()) override
Sets the list of colors used by the ramp.
Definition: qgscolorramp.h:500
QgsGradientStop
Represents a color stop within a QgsGradientColorRamp color ramp.
Definition: qgscolorramp.h:101
QgsGradientColorRamp::isDiscrete
bool isDiscrete() const
Returns true if the gradient is using discrete interpolation, rather than smoothly interpolating betw...
Definition: qgscolorramp.h:202
QgsLimitedRandomColorRamp::valMin
int valMin() const
Returns the minimum value for generated colors.
Definition: qgscolorramp.h:360
QgsGradientStop::offset
double offset
Relative positional offset, between 0 and 1.
Definition: qgscolorramp.h:116
QgsGradientColorRamp::info
QgsStringMap info() const
Returns any additional info attached to the gradient ramp (e.g., authorship notes)
Definition: qgscolorramp.h:241
QgsLimitedRandomColorRamp::mHueMax
int mHueMax
Definition: qgscolorramp.h:412
QgsColorRamp::value
virtual double value(int index) const =0
Returns relative value between [0,1] of color at specified index.
QgsLimitedRandomColorRamp::mValMax
int mValMax
Definition: qgscolorramp.h:416
DEFAULT_RANDOM_SAT_MAX
#define DEFAULT_RANDOM_SAT_MAX
Definition: qgscolorramp.h:275