QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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() == QgsGradientColorRamp::typeString() )
37  sipType = sipType_QgsGradientColorRamp;
38  else if ( sipCpp->type() == QgsLimitedRandomColorRamp::typeString() )
39  sipType = sipType_QgsLimitedRandomColorRamp;
40  else if ( sipCpp->type() == QgsRandomColorRamp::typeString() )
41  sipType = sipType_QgsRandomColorRamp;
42  else if ( sipCpp->type() == QgsPresetSchemeColorRamp::typeString() )
43  sipType = sipType_QgsPresetSchemeColorRamp;
44  else if ( sipCpp->type() == QgsColorBrewerColorRamp::typeString() )
45  sipType = sipType_QgsColorBrewerColorRamp;
46  else if ( sipCpp->type() == QgsCptCityColorRamp::typeString() )
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 
103  static QList< QPair< QString, QString > > rampTypes();
104 };
105 
112 class CORE_EXPORT QgsGradientStop
113 {
114  public:
115 
121  QgsGradientStop( double offset, const QColor &color )
122  : offset( offset )
123  , color( color )
124  { }
125 
127  double offset;
129  QColor color;
130 
131  bool operator==( const QgsGradientStop &other ) const
132  {
133  return other.color == color && qgsDoubleNear( other.offset, offset );
134  }
135 };
136 
138 typedef QList<QgsGradientStop> QgsGradientStopsList;
139 
140 #define DEFAULT_GRADIENT_COLOR1 QColor(0,0,255)
141 #define DEFAULT_GRADIENT_COLOR2 QColor(0,255,0)
142 
150 class CORE_EXPORT QgsGradientColorRamp : public QgsColorRamp
151 {
152  public:
153 
162  QgsGradientColorRamp( const QColor &color1 = DEFAULT_GRADIENT_COLOR1,
163  const QColor &color2 = DEFAULT_GRADIENT_COLOR2,
164  bool discrete = false,
165  const QgsGradientStopsList &stops = QgsGradientStopsList() );
166 
168  static QgsColorRamp *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
169 
170  int count() const override { return mStops.count() + 2; }
171  double value( int index ) const override;
172  QColor color( double value ) const override;
173 
179  static QString typeString() { return QStringLiteral( "gradient" ); }
180 
181  QString type() const override;
182  void invert() override;
183  QgsGradientColorRamp *clone() const override SIP_FACTORY;
184  QgsStringMap properties() const override;
185 
191  QColor color1() const { return mColor1; }
192 
198  QColor color2() const { return mColor2; }
199 
206  void setColor1( const QColor &color ) { mColor1 = color; }
207 
214  void setColor2( const QColor &color ) { mColor2 = color; }
215 
221  bool isDiscrete() const { return mDiscrete; }
222 
230  void setDiscrete( bool discrete ) { mDiscrete = discrete; }
231 
239  void convertToDiscrete( bool discrete );
240 
248  void setStops( const QgsGradientStopsList &stops );
249 
254  QgsGradientStopsList stops() const { return mStops; }
255 
260  QgsStringMap info() const { return mInfo; }
261 
267  void setInfo( const QgsStringMap &info ) { mInfo = info; }
268 
276  void addStopsToGradient( QGradient *gradient, double opacity = 1 );
277 
278  protected:
279  QColor mColor1;
280  QColor mColor2;
281  bool mDiscrete;
284 };
285 
287 
288 #define DEFAULT_RANDOM_COUNT 10
289 #define DEFAULT_RANDOM_HUE_MIN 0
290 #define DEFAULT_RANDOM_HUE_MAX 359
291 #define DEFAULT_RANDOM_VAL_MIN 200
292 #define DEFAULT_RANDOM_VAL_MAX 240
293 #define DEFAULT_RANDOM_SAT_MIN 100
294 #define DEFAULT_RANDOM_SAT_MAX 240
295 
302 class CORE_EXPORT QgsLimitedRandomColorRamp : public QgsColorRamp
303 {
304  public:
305 
317  int hueMin = DEFAULT_RANDOM_HUE_MIN, int hueMax = DEFAULT_RANDOM_HUE_MAX,
318  int satMin = DEFAULT_RANDOM_SAT_MIN, int satMax = DEFAULT_RANDOM_SAT_MAX,
319  int valMin = DEFAULT_RANDOM_VAL_MIN, int valMax = DEFAULT_RANDOM_VAL_MAX );
320 
327  static QgsColorRamp *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
328 
329  double value( int index ) const override;
330  QColor color( double value ) const override;
331 
337  static QString typeString() { return QStringLiteral( "random" ); }
338 
339  QString type() const override;
340  QgsLimitedRandomColorRamp *clone() const override SIP_FACTORY;
341  QgsStringMap properties() const override;
342  int count() const override { return mCount; }
343 
348  static QList<QColor> randomColors( int count,
349  int hueMax = DEFAULT_RANDOM_HUE_MAX, int hueMin = DEFAULT_RANDOM_HUE_MIN,
350  int satMax = DEFAULT_RANDOM_SAT_MAX, int satMin = DEFAULT_RANDOM_SAT_MIN,
351  int valMax = DEFAULT_RANDOM_VAL_MAX, int valMin = DEFAULT_RANDOM_VAL_MIN );
352 
357  void updateColors();
358 
363  int hueMin() const { return mHueMin; }
364 
369  int hueMax() const { return mHueMax; }
370 
375  int satMin() const { return mSatMin; }
376 
381  int satMax() const { return mSatMax; }
382 
387  int valMin() const { return mValMin; }
388 
393  int valMax() const { return mValMax; }
394 
398  void setCount( int val ) { mCount = val; }
399 
404  void setHueMin( int val ) { mHueMin = val; }
405 
410  void setHueMax( int val ) { mHueMax = val; }
411 
416  void setSatMin( int val ) { mSatMin = val; }
417 
422  void setSatMax( int val ) { mSatMax = val; }
423 
428  void setValMin( int val ) { mValMin = val; }
429 
434  void setValMax( int val ) { mValMax = val; }
435 
436  protected:
437  int mCount;
438  int mHueMin;
439  int mHueMax;
440  int mSatMin;
441  int mSatMax;
442  int mValMin;
443  int mValMax;
444  QList<QColor> mColors;
445 };
446 
454 class CORE_EXPORT QgsRandomColorRamp: public QgsColorRamp
455 {
456  public:
457 
461  QgsRandomColorRamp() = default;
462 
463  int count() const override;
464 
465  double value( int index ) const override;
466 
467  QColor color( double value ) const override;
468 
476  virtual void setTotalColorCount( int colorCount );
477 
483  static QString typeString() { return QStringLiteral( "randomcolors" ); }
484 
485  QString type() const override;
486 
487  QgsRandomColorRamp *clone() const override SIP_FACTORY;
488 
489  QgsStringMap properties() const override;
490 
491  protected:
492 
493  int mTotalColorCount = 0;
494  QList<QColor> mPrecalculatedColors;
495 
496 };
497 
498 
505 class CORE_EXPORT QgsPresetSchemeColorRamp : public QgsColorRamp, public QgsColorScheme
506 {
507  public:
508 
513  QgsPresetSchemeColorRamp( const QList< QColor > &colors = QList< QColor >() );
514 
520 
527  static QgsColorRamp *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
528 
534  bool setColors( const QgsNamedColorList &colors, const QString & = QString(), const QColor & = QColor() ) override { mColors = colors; return true; }
535 
540  QList< QColor > colors() const;
541 
542  double value( int index ) const override;
543  QColor color( double value ) const override;
544 
550  static QString typeString() { return QStringLiteral( "preset" ); }
551 
552  QString type() const override;
553  void invert() override;
554  QgsPresetSchemeColorRamp *clone() const override SIP_FACTORY;
555  QgsStringMap properties() const override;
556  int count() const override;
557 
558  QString schemeName() const override { return QStringLiteral( "preset" ); }
559  QgsNamedColorList fetchColors( const QString &context = QString(), const QColor &baseColor = QColor() ) override;
560  bool isEditable() const override { return true; }
561 
562  private:
563 
564  QgsNamedColorList mColors;
565 };
566 
567 
568 #define DEFAULT_COLORBREWER_SCHEMENAME "Spectral"
569 #define DEFAULT_COLORBREWER_COLORS 5
570 
577 class CORE_EXPORT QgsColorBrewerColorRamp : public QgsColorRamp
578 {
579  public:
580 
587  QgsColorBrewerColorRamp( const QString &schemeName = DEFAULT_COLORBREWER_SCHEMENAME,
588  int colors = DEFAULT_COLORBREWER_COLORS,
589  bool inverted = false );
590 
597  static QgsColorRamp *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
598 
599  double value( int index ) const override;
600  QColor color( double value ) const override;
601 
607  static QString typeString() { return QStringLiteral( "colorbrewer" ); }
608 
609  QString type() const override { return QgsColorBrewerColorRamp::typeString(); }
610  void invert() override;
611  QgsColorBrewerColorRamp *clone() const override SIP_FACTORY;
612  QgsStringMap properties() const override;
613  int count() const override { return mColors; }
614 
619  QString schemeName() const { return mSchemeName; }
620 
625  int colors() const { return mColors; }
626 
633  void setSchemeName( const QString &schemeName ) { mSchemeName = schemeName; loadPalette(); }
634 
641  void setColors( int colors ) { mColors = colors; loadPalette(); }
642 
647  static QStringList listSchemeNames();
648 
655  static QList<int> listSchemeVariants( const QString &schemeName );
656 
657  protected:
658 
660  void loadPalette();
661 
662  QString mSchemeName;
663  int mColors;
664  QList<QColor> mPalette;
665  bool mInverted;
666 };
667 
668 
669 #define DEFAULT_CPTCITY_SCHEMENAME "cb/div/BrBG_" //change this
670 #define DEFAULT_CPTCITY_VARIANTNAME "05"
671 
676 class CORE_EXPORT QgsCptCityColorRamp : public QgsGradientColorRamp
677 {
678  public:
679 
687  QgsCptCityColorRamp( const QString &schemeName = DEFAULT_CPTCITY_SCHEMENAME,
688  const QString &variantName = DEFAULT_CPTCITY_VARIANTNAME,
689  bool inverted = false,
690  bool doLoadFile = true );
691 
700  QgsCptCityColorRamp( const QString &schemeName, const QStringList &variantList,
701  const QString &variantName = QString(), bool inverted = false,
702  bool doLoadFile = true );
703 
704  static QgsColorRamp *create( const QgsStringMap &properties = QgsStringMap() ) SIP_FACTORY;
705 
711  static QString typeString() { return QStringLiteral( "cpt-city" ); }
712 
713  QString type() const override;
714 
715  void invert() override;
716 
717  QgsCptCityColorRamp *clone() const override SIP_FACTORY;
718  void copy( const QgsCptCityColorRamp *other );
719  QgsGradientColorRamp *cloneGradientRamp() const SIP_FACTORY;
720 
721  QgsStringMap properties() const override;
722 
723  QString schemeName() const { return mSchemeName; }
724  QString variantName() const { return mVariantName; }
725  QStringList variantList() const { return mVariantList; }
726 
727  // lazy loading - have to call loadPalette() explicitly
728  void setSchemeName( const QString &schemeName ) { mSchemeName = schemeName; mFileLoaded = false; }
729  void setVariantName( const QString &variantName ) { mVariantName = variantName; mFileLoaded = false; }
730  void setVariantList( const QStringList &variantList ) { mVariantList = variantList; }
731  void setName( const QString &schemeName, const QString &variantName = QString(), const QStringList &variantList = QStringList() )
732  { mSchemeName = schemeName; mVariantName = variantName; mVariantList = variantList; mFileLoaded = false; }
733 
734  void loadPalette() { loadFile(); }
735  bool hasMultiStops() const { return mMultiStops; }
736 
737  QString fileName() const;
738  bool loadFile();
739  bool fileLoaded() const { return mFileLoaded; }
740 
741  QString copyingFileName() const;
742  QString descFileName() const;
743  QgsStringMap copyingInfo() const;
744 
745  protected:
746  QString mSchemeName;
747  QString mVariantName;
748  QStringList mVariantList;
749  bool mFileLoaded = false;
750  bool mMultiStops = false;
751  bool mInverted;
752 
753 };
754 
755 // clazy:excludeall=qstring-allocations
756 
757 #endif
QgsGradientStop::QgsGradientStop
QgsGradientStop(double offset, const QColor &color)
Constructor for QgsGradientStop.
Definition: qgscolorramp.h:121
DEFAULT_RANDOM_VAL_MAX
#define DEFAULT_RANDOM_VAL_MAX
Definition: qgscolorramp.h:292
DEFAULT_RANDOM_HUE_MAX
#define DEFAULT_RANDOM_HUE_MAX
Definition: qgscolorramp.h:290
QgsColorRamp
Abstract base class for color ramps.
Definition: qgscolorramp.h:32
qgscolorscheme.h
QgsCptCityColorRamp::mInverted
bool mInverted
Definition: qgscolorramp.h:751
QgsGradientStop::color
QColor color
Gradient color at stop.
Definition: qgscolorramp.h:129
QgsGradientColorRamp
Gradient color ramp, which smoothly interpolates between two colors and also supports optional extra ...
Definition: qgscolorramp.h:151
QgsCptCityColorRamp::setSchemeName
void setSchemeName(const QString &schemeName)
Definition: qgscolorramp.h:728
QgsLimitedRandomColorRamp::mSatMax
int mSatMax
Definition: qgscolorramp.h:441
QgsCptCityColorRamp::setName
void setName(const QString &schemeName, const QString &variantName=QString(), const QStringList &variantList=QStringList())
Definition: qgscolorramp.h:731
QgsLimitedRandomColorRamp::hueMin
int hueMin() const
Returns the minimum hue for generated colors.
Definition: qgscolorramp.h:363
DEFAULT_CPTCITY_VARIANTNAME
#define DEFAULT_CPTCITY_VARIANTNAME
Definition: qgscolorramp.h:670
QgsLimitedRandomColorRamp::mCount
int mCount
Definition: qgscolorramp.h:437
DEFAULT_COLORBREWER_COLORS
#define DEFAULT_COLORBREWER_COLORS
Definition: qgscolorramp.h:569
QgsLimitedRandomColorRamp::mSatMin
int mSatMin
Definition: qgscolorramp.h:440
QgsGradientColorRamp::setInfo
void setInfo(const QgsStringMap &info)
Sets additional info to attach to the gradient ramp (e.g., authorship notes)
Definition: qgscolorramp.h:267
QgsPresetSchemeColorRamp
A scheme based color ramp consisting of a list of predefined colors.
Definition: qgscolorramp.h:506
QgsCptCityColorRamp::setVariantList
void setVariantList(const QStringList &variantList)
Definition: qgscolorramp.h:730
QgsLimitedRandomColorRamp::setSatMax
void setSatMax(int val)
Sets the maximum saturation for generated colors.
Definition: qgscolorramp.h:422
QgsNamedColorList
QList< QPair< QColor, QString > > QgsNamedColorList
List of colors paired with a friendly display name identifying the color.
Definition: qgscolorscheme.h:34
DEFAULT_COLORBREWER_SCHEMENAME
#define DEFAULT_COLORBREWER_SCHEMENAME
Definition: qgscolorramp.h:568
QgsGradientColorRamp::clone
QgsGradientColorRamp * clone() const override
Creates a clone of the color ramp.
Definition: qgscolorramp.cpp:195
QgsColorBrewerColorRamp::mInverted
bool mInverted
Definition: qgscolorramp.h:665
qgis.h
QgsLimitedRandomColorRamp::setValMin
void setValMin(int val)
Sets the minimum value for generated colors.
Definition: qgscolorramp.h:428
QgsCptCityColorRamp::variantName
QString variantName() const
Definition: qgscolorramp.h:724
QgsCptCityColorRamp::variantList
QStringList variantList() const
Definition: qgscolorramp.h:725
DEFAULT_RANDOM_HUE_MIN
#define DEFAULT_RANDOM_HUE_MIN
Definition: qgscolorramp.h:289
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:168
QgsColorBrewerColorRamp::typeString
static QString typeString()
Returns the string identifier for QgsColorBrewerColorRamp.
Definition: qgscolorramp.h:607
QgsLimitedRandomColorRamp
Constrained random color ramp, which returns random colors based on preset parameters.
Definition: qgscolorramp.h:303
QgsLimitedRandomColorRamp::satMax
int satMax() const
Returns the maximum saturation for generated colors.
Definition: qgscolorramp.h:381
QgsColorBrewerColorRamp
Color ramp utilising "Color Brewer" preset color schemes.
Definition: qgscolorramp.h:578
QgsLimitedRandomColorRamp::setSatMin
void setSatMin(int val)
Sets the minimum saturation for generated colors.
Definition: qgscolorramp.h:416
QgsGradientColorRamp::mColor2
QColor mColor2
Definition: qgscolorramp.h:280
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:560
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(QgsMeshTimeSettings)
QgsLimitedRandomColorRamp::setHueMax
void setHueMax(int val)
Sets the maximum hue for generated colors.
Definition: qgscolorramp.h:410
QgsRandomColorRamp
Totally random color ramp.
Definition: qgscolorramp.h:455
QgsGradientColorRamp::stops
QgsGradientStopsList stops() const
Returns the list of intermediate gradient stops for the ramp.
Definition: qgscolorramp.h:254
QgsCptCityColorRamp::typeString
static QString typeString()
Returns the string identifier for QgsCptCityColorRamp.
Definition: qgscolorramp.h:711
QgsGradientColorRamp::typeString
static QString typeString()
Returns the string identifier for QgsGradientColorRamp.
Definition: qgscolorramp.h:179
QgsCptCityColorRamp::mSchemeName
QString mSchemeName
Definition: qgscolorramp.h:746
SIP_CONVERT_TO_SUBCLASS_CODE
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:177
QgsGradientStopsList
QList< QgsGradientStop > QgsGradientStopsList
List of gradient stops.
Definition: qgscolorramp.h:138
QgsPresetSchemeColorRamp::typeString
static QString typeString()
Returns the string identifier for QgsPresetSchemeColorRamp.
Definition: qgscolorramp.h:550
QgsGradientColorRamp::setColor1
void setColor1(const QColor &color)
Sets the gradient start color.
Definition: qgscolorramp.h:206
DEFAULT_GRADIENT_COLOR1
#define DEFAULT_GRADIENT_COLOR1
Definition: qgscolorramp.h:140
QgsGradientColorRamp::count
int count() const override
Returns number of defined colors, or -1 if undefined.
Definition: qgscolorramp.h:170
QgsLimitedRandomColorRamp::valMax
int valMax() const
Returns the maximum value for generated colors.
Definition: qgscolorramp.h:393
QgsGradientColorRamp::color2
QColor color2() const
Returns the gradient end color.
Definition: qgscolorramp.h:198
QgsLimitedRandomColorRamp::satMin
int satMin() const
Returns the minimum saturation for generated colors.
Definition: qgscolorramp.h:375
QgsRandomColorRamp::typeString
static QString typeString()
Returns the string identifier for QgsRandomColorRamp.
Definition: qgscolorramp.h:483
QgsColorBrewerColorRamp::colors
int colors() const
Returns the number of colors in the ramp.
Definition: qgscolorramp.h:625
QgsColorRamp::~QgsColorRamp
virtual ~QgsColorRamp()=default
QgsGradientColorRamp::setColor2
void setColor2(const QColor &color)
Sets the gradient end color.
Definition: qgscolorramp.h:214
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:633
QgsGradientColorRamp::mColor1
QColor mColor1
Definition: qgscolorramp.h:279
DEFAULT_RANDOM_VAL_MIN
#define DEFAULT_RANDOM_VAL_MIN
Definition: qgscolorramp.h:291
QgsColorBrewerColorRamp::schemeName
QString schemeName() const
Returns the name of the color brewer color scheme.
Definition: qgscolorramp.h:619
QgsColorBrewerColorRamp::mSchemeName
QString mSchemeName
Definition: qgscolorramp.h:662
QgsGradientColorRamp::type
QString type() const override
Returns a string representing the color ramp type.
Definition: qgscolorramp.cpp:163
DEFAULT_RANDOM_SAT_MIN
#define DEFAULT_RANDOM_SAT_MIN
Definition: qgscolorramp.h:293
DEFAULT_CPTCITY_SCHEMENAME
#define DEFAULT_CPTCITY_SCHEMENAME
Definition: qgscolorramp.h:669
QgsColorBrewerColorRamp::type
QString type() const override
Returns a string representing the color ramp type.
Definition: qgscolorramp.h:609
QgsLimitedRandomColorRamp::setCount
void setCount(int val)
Sets the number of colors contained in the ramp.
Definition: qgscolorramp.h:398
QgsColorRamp::clone
virtual QgsColorRamp * clone() const =0
Creates a clone of the color ramp.
QgsLimitedRandomColorRamp::mColors
QList< QColor > mColors
Definition: qgscolorramp.h:444
QgsColorBrewerColorRamp::mPalette
QList< QColor > mPalette
Definition: qgscolorramp.h:664
QgsRandomColorRamp::QgsRandomColorRamp
QgsRandomColorRamp()=default
Constructor for QgsRandomColorRamp.
QgsCptCityColorRamp::setVariantName
void setVariantName(const QString &variantName)
Definition: qgscolorramp.h:729
QgsCptCityColorRamp::fileLoaded
bool fileLoaded() const
Definition: qgscolorramp.h:739
QgsStringMap
QMap< QString, QString > QgsStringMap
Definition: qgis.h:758
QgsGradientStop::operator==
bool operator==(const QgsGradientStop &other) const
Definition: qgscolorramp.h:131
QgsColorScheme
Abstract base class for color schemes.
Definition: qgscolorscheme.h:47
QgsCptCityColorRamp::mVariantName
QString mVariantName
Definition: qgscolorramp.h:747
QgsLimitedRandomColorRamp::hueMax
int hueMax() const
Returns the maximum hue for generated colors.
Definition: qgscolorramp.h:369
QgsLimitedRandomColorRamp::mHueMin
int mHueMin
Definition: qgscolorramp.h:438
QgsLimitedRandomColorRamp::setHueMin
void setHueMin(int val)
Sets the minimum hue for generated colors.
Definition: qgscolorramp.h:404
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:288
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:735
QgsGradientColorRamp::mInfo
QgsStringMap mInfo
Definition: qgscolorramp.h:283
QgsColorBrewerColorRamp::setColors
void setColors(int colors)
Sets the number of colors in the ramp.
Definition: qgscolorramp.h:641
QgsLimitedRandomColorRamp::mValMin
int mValMin
Definition: qgscolorramp.h:442
QgsGradientColorRamp::setDiscrete
void setDiscrete(bool discrete)
Sets whether the gradient should use discrete interpolation, rather than smoothly interpolating betwe...
Definition: qgscolorramp.h:230
QgsCptCityColorRamp::loadPalette
void loadPalette()
Definition: qgscolorramp.h:734
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:748
QgsColorRamp::invert
virtual void invert()
Inverts the ordering of the color ramp.
Definition: qgscolorramp.h:82
QgsGradientColorRamp::mDiscrete
bool mDiscrete
Definition: qgscolorramp.h:281
QgsCptCityColorRamp
Definition: qgscolorramp.h:677
QgsGradientColorRamp::mStops
QgsGradientStopsList mStops
Definition: qgscolorramp.h:282
DEFAULT_GRADIENT_COLOR2
#define DEFAULT_GRADIENT_COLOR2
Definition: qgscolorramp.h:141
QgsLimitedRandomColorRamp::setValMax
void setValMax(int val)
Sets the maximum value for generated colors.
Definition: qgscolorramp.h:434
SIP_END
#define SIP_END
Definition: qgis_sip.h:194
QgsColorBrewerColorRamp::mColors
int mColors
Definition: qgscolorramp.h:663
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:534
QgsLimitedRandomColorRamp::typeString
static QString typeString()
Returns the string identifier for QgsLimitedRandomColorRamp.
Definition: qgscolorramp.h:337
QgsGradientStop
Represents a color stop within a QgsGradientColorRamp color ramp.
Definition: qgscolorramp.h:113
QgsGradientColorRamp::isDiscrete
bool isDiscrete() const
Returns true if the gradient is using discrete interpolation, rather than smoothly interpolating betw...
Definition: qgscolorramp.h:221
QgsLimitedRandomColorRamp::valMin
int valMin() const
Returns the minimum value for generated colors.
Definition: qgscolorramp.h:387
QgsGradientStop::offset
double offset
Relative positional offset, between 0 and 1.
Definition: qgscolorramp.h:127
QgsGradientColorRamp::info
QgsStringMap info() const
Returns any additional info attached to the gradient ramp (e.g., authorship notes)
Definition: qgscolorramp.h:260
QgsLimitedRandomColorRamp::mHueMax
int mHueMax
Definition: qgscolorramp.h:439
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:443
DEFAULT_RANDOM_SAT_MAX
#define DEFAULT_RANDOM_SAT_MAX
Definition: qgscolorramp.h:294