QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgscolorrampimpl.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscolorrampimpl.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 QGSCOLORRAMPIMPL_H
17 #define QGSCOLORRAMPIMPL_H
18 
19 #include "qgis_core.h"
20 #include <QColor>
21 #include <QGradient>
22 #include "qgis.h"
23 #include "qgscolorscheme.h"
24 #include "qgscolorramp.h"
25 
26 #ifndef SIP_RUN
27 typedef QColor( *InterpolateColorFunc )( const QColor &c1, const QColor &c2, const double value, Qgis::AngularDirection direction );
30 #endif
31 
38 class CORE_EXPORT QgsGradientStop
39 {
40  public:
41 
47  QgsGradientStop( double offset, const QColor &color );
48 
50  double offset;
52  QColor color;
53 
54  bool operator==( const QgsGradientStop &other ) const
55  {
56  return other.color == color && qgsDoubleNear( other.offset, offset ) && other.mColorSpec == mColorSpec && other.mDirection == mDirection;
57  }
58 
59  bool operator!=( const QgsGradientStop &other ) const
60  {
61  return !( *this == other );
62  }
63 
73  QColor::Spec colorSpec() const { return mColorSpec; }
74 
86  void setColorSpec( QColor::Spec spec );
87 
98  Qgis::AngularDirection direction() const { return mDirection; }
99 
110  void setDirection( Qgis::AngularDirection direction ) { mDirection = direction; }
111 
112  private:
113 
114  QColor::Spec mColorSpec = QColor::Spec::Rgb;
116  InterpolateColorFunc mFunc = nullptr;
117 
118  friend class QgsGradientColorRamp;
119 };
120 
122 typedef QList<QgsGradientStop> QgsGradientStopsList;
123 
124 // these are the QGIS branding colors, exaggerated a bit to make a default ramp with greater color variation
125 // then the official QGIS color gradient!
126 #define DEFAULT_GRADIENT_COLOR1 QColor(69, 116, 40)
127 #define DEFAULT_GRADIENT_COLOR2 QColor(188, 220, 60)
128 
136 class CORE_EXPORT QgsGradientColorRamp : public QgsColorRamp
137 {
138  public:
139 
148  QgsGradientColorRamp( const QColor &color1 = DEFAULT_GRADIENT_COLOR1,
149  const QColor &color2 = DEFAULT_GRADIENT_COLOR2,
150  bool discrete = false,
151  const QgsGradientStopsList &stops = QgsGradientStopsList() );
152 
154  static QgsColorRamp *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
155 
156  int count() const override { return mStops.count() + 2; }
157  double value( int index ) const override;
158  QColor color( double value ) const override;
159 
165  static QString typeString() { return QStringLiteral( "gradient" ); }
166 
167  QString type() const override;
168  void invert() override;
169  QgsGradientColorRamp *clone() const override SIP_FACTORY;
170  QVariantMap properties() const override;
171 
177  QColor color1() const { return mColor1; }
178 
184  QColor color2() const { return mColor2; }
185 
192  void setColor1( const QColor &color ) { mColor1 = color; }
193 
200  void setColor2( const QColor &color ) { mColor2 = color; }
201 
207  bool isDiscrete() const { return mDiscrete; }
208 
216  void setDiscrete( bool discrete ) { mDiscrete = discrete; }
217 
225  void convertToDiscrete( bool discrete );
226 
234  void setStops( const QgsGradientStopsList &stops );
235 
240  QgsGradientStopsList stops() const { return mStops; }
241 
246  QgsStringMap info() const { return mInfo; }
247 
253  void setInfo( const QgsStringMap &info ) { mInfo = info; }
254 
262  void addStopsToGradient( QGradient *gradient, double opacity = 1 ) const;
263 
273  QColor::Spec colorSpec() const { return mColorSpec; }
274 
286  void setColorSpec( QColor::Spec spec );
287 
298  Qgis::AngularDirection direction() const { return mDirection; }
299 
310  void setDirection( Qgis::AngularDirection direction ) { mDirection = direction; }
311 
312  protected:
313  QColor mColor1;
314  QColor mColor2;
315  bool mDiscrete;
318  QColor::Spec mColorSpec = QColor::Spec::Rgb;
320 
321  InterpolateColorFunc mFunc = nullptr;
322 };
323 
325 
326 #define DEFAULT_RANDOM_COUNT 10
327 #define DEFAULT_RANDOM_HUE_MIN 0
328 #define DEFAULT_RANDOM_HUE_MAX 359
329 #define DEFAULT_RANDOM_VAL_MIN 200
330 #define DEFAULT_RANDOM_VAL_MAX 240
331 #define DEFAULT_RANDOM_SAT_MIN 100
332 #define DEFAULT_RANDOM_SAT_MAX 240
333 
340 class CORE_EXPORT QgsLimitedRandomColorRamp : public QgsColorRamp
341 {
342  public:
343 
355  int hueMin = DEFAULT_RANDOM_HUE_MIN, int hueMax = DEFAULT_RANDOM_HUE_MAX,
356  int satMin = DEFAULT_RANDOM_SAT_MIN, int satMax = DEFAULT_RANDOM_SAT_MAX,
357  int valMin = DEFAULT_RANDOM_VAL_MIN, int valMax = DEFAULT_RANDOM_VAL_MAX );
358 
365  static QgsColorRamp *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
366 
367  double value( int index ) const override;
368  QColor color( double value ) const override;
369 
375  static QString typeString() { return QStringLiteral( "random" ); }
376 
377  QString type() const override;
378  QgsLimitedRandomColorRamp *clone() const override SIP_FACTORY;
379  QVariantMap properties() const override;
380  int count() const override { return mCount; }
381 
386  static QList<QColor> randomColors( int count,
387  int hueMax = DEFAULT_RANDOM_HUE_MAX, int hueMin = DEFAULT_RANDOM_HUE_MIN,
388  int satMax = DEFAULT_RANDOM_SAT_MAX, int satMin = DEFAULT_RANDOM_SAT_MIN,
389  int valMax = DEFAULT_RANDOM_VAL_MAX, int valMin = DEFAULT_RANDOM_VAL_MIN );
390 
395  void updateColors();
396 
401  int hueMin() const { return mHueMin; }
402 
407  int hueMax() const { return mHueMax; }
408 
413  int satMin() const { return mSatMin; }
414 
419  int satMax() const { return mSatMax; }
420 
425  int valMin() const { return mValMin; }
426 
431  int valMax() const { return mValMax; }
432 
436  void setCount( int val ) { mCount = val; }
437 
442  void setHueMin( int val ) { mHueMin = val; }
443 
448  void setHueMax( int val ) { mHueMax = val; }
449 
454  void setSatMin( int val ) { mSatMin = val; }
455 
460  void setSatMax( int val ) { mSatMax = val; }
461 
466  void setValMin( int val ) { mValMin = val; }
467 
472  void setValMax( int val ) { mValMax = val; }
473 
474  protected:
475  int mCount;
476  int mHueMin;
477  int mHueMax;
478  int mSatMin;
479  int mSatMax;
480  int mValMin;
481  int mValMax;
482  QList<QColor> mColors;
483 };
484 
492 class CORE_EXPORT QgsRandomColorRamp: public QgsColorRamp
493 {
494  public:
495 
499  QgsRandomColorRamp() = default;
500 
501  int count() const override;
502 
503  double value( int index ) const override;
504 
505  QColor color( double value ) const override;
506 
514  virtual void setTotalColorCount( int colorCount );
515 
521  static QString typeString() { return QStringLiteral( "randomcolors" ); }
522 
523  QString type() const override;
524 
525  QgsRandomColorRamp *clone() const override SIP_FACTORY;
526 
527  QVariantMap properties() const override;
528 
529  protected:
530 
531  int mTotalColorCount = 0;
532  QList<QColor> mPrecalculatedColors;
533 
534 };
535 
536 
543 class CORE_EXPORT QgsPresetSchemeColorRamp : public QgsColorRamp, public QgsColorScheme
544 {
545  public:
546 
551  QgsPresetSchemeColorRamp( const QList< QColor > &colors = QList< QColor >() );
552 
558 
565  static QgsColorRamp *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
566 
572  bool setColors( const QgsNamedColorList &colors, const QString & = QString(), const QColor & = QColor() ) override { mColors = colors; return true; }
573 
578  QList< QColor > colors() const;
579 
580  double value( int index ) const override;
581  QColor color( double value ) const override;
582 
588  static QString typeString() { return QStringLiteral( "preset" ); }
589 
590  QString type() const override;
591  void invert() override;
592  QgsPresetSchemeColorRamp *clone() const override SIP_FACTORY;
593  QVariantMap properties() const override;
594  int count() const override;
595 
596  QString schemeName() const override { return QStringLiteral( "preset" ); }
597  QgsNamedColorList fetchColors( const QString &context = QString(), const QColor &baseColor = QColor() ) override;
598  bool isEditable() const override { return true; }
599 
600  private:
601 
602  QgsNamedColorList mColors;
603 };
604 
605 
606 #define DEFAULT_COLORBREWER_SCHEMENAME "Spectral"
607 #define DEFAULT_COLORBREWER_COLORS 5
608 
615 class CORE_EXPORT QgsColorBrewerColorRamp : public QgsColorRamp
616 {
617  public:
618 
625  QgsColorBrewerColorRamp( const QString &schemeName = DEFAULT_COLORBREWER_SCHEMENAME,
626  int colors = DEFAULT_COLORBREWER_COLORS,
627  bool inverted = false );
628 
635  static QgsColorRamp *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
636 
637  double value( int index ) const override;
638  QColor color( double value ) const override;
639 
645  static QString typeString() { return QStringLiteral( "colorbrewer" ); }
646 
647  QString type() const override { return QgsColorBrewerColorRamp::typeString(); }
648  void invert() override;
649  QgsColorBrewerColorRamp *clone() const override SIP_FACTORY;
650  QVariantMap properties() const override;
651  int count() const override { return mColors; }
652 
657  QString schemeName() const { return mSchemeName; }
658 
663  int colors() const { return mColors; }
664 
671  void setSchemeName( const QString &schemeName ) { mSchemeName = schemeName; loadPalette(); }
672 
679  void setColors( int colors ) { mColors = colors; loadPalette(); }
680 
685  static QStringList listSchemeNames();
686 
693  static QList<int> listSchemeVariants( const QString &schemeName );
694 
695  protected:
696 
698  void loadPalette();
699 
700  QString mSchemeName;
701  int mColors;
702  QList<QColor> mPalette;
703  bool mInverted;
704 };
705 
706 
707 #define DEFAULT_CPTCITY_SCHEMENAME "cb/div/BrBG_" //change this
708 #define DEFAULT_CPTCITY_VARIANTNAME "05"
709 
714 class CORE_EXPORT QgsCptCityColorRamp : public QgsGradientColorRamp
715 {
716  public:
717 
725  QgsCptCityColorRamp( const QString &schemeName = DEFAULT_CPTCITY_SCHEMENAME,
726  const QString &variantName = DEFAULT_CPTCITY_VARIANTNAME,
727  bool inverted = false,
728  bool doLoadFile = true );
729 
738  QgsCptCityColorRamp( const QString &schemeName, const QStringList &variantList,
739  const QString &variantName = QString(), bool inverted = false,
740  bool doLoadFile = true );
741 
743  static QgsColorRamp *create( const QVariantMap &properties = QVariantMap() ) SIP_FACTORY;
744 
750  static QString typeString() { return QStringLiteral( "cpt-city" ); }
751 
752  QString type() const override;
753 
754  void invert() override;
755 
756  QgsCptCityColorRamp *clone() const override SIP_FACTORY;
757  void copy( const QgsCptCityColorRamp *other );
758  QgsGradientColorRamp *cloneGradientRamp() const SIP_FACTORY;
759 
760  QVariantMap properties() const override;
761 
762  QString schemeName() const { return mSchemeName; }
763  QString variantName() const { return mVariantName; }
764  QStringList variantList() const { return mVariantList; }
765 
766  // lazy loading - have to call loadPalette() explicitly
767  void setSchemeName( const QString &schemeName ) { mSchemeName = schemeName; mFileLoaded = false; }
768  void setVariantName( const QString &variantName ) { mVariantName = variantName; mFileLoaded = false; }
769  void setVariantList( const QStringList &variantList ) { mVariantList = variantList; }
770  void setName( const QString &schemeName, const QString &variantName = QString(), const QStringList &variantList = QStringList() )
771  { mSchemeName = schemeName; mVariantName = variantName; mVariantList = variantList; mFileLoaded = false; }
772 
773  void loadPalette() { loadFile(); }
774  bool hasMultiStops() const { return mMultiStops; }
775 
782  static QString fileNameForVariant( const QString &schema, const QString &variant ) SIP_SKIP;
783 
784  QString fileName() const;
785  bool loadFile();
786  bool fileLoaded() const { return mFileLoaded; }
787 
788  QString copyingFileName() const;
789  QString descFileName() const;
790  QgsStringMap copyingInfo() const;
791 
792  protected:
793  QString mSchemeName;
794  QString mVariantName;
795  QStringList mVariantList;
796  bool mFileLoaded = false;
797  bool mMultiStops = false;
798  bool mInverted;
799 
800 };
801 
802 // clazy:excludeall=qstring-allocations
803 
804 #endif
DEFAULT_COLORBREWER_SCHEMENAME
#define DEFAULT_COLORBREWER_SCHEMENAME
Definition: qgscolorrampimpl.h:606
QgsColorRamp
Abstract base class for color ramps.
Definition: qgscolorramp.h:29
qgscolorscheme.h
QgsCptCityColorRamp::mInverted
bool mInverted
Definition: qgscolorrampimpl.h:798
QgsGradientStop::color
QColor color
Gradient color at stop.
Definition: qgscolorrampimpl.h:52
QgsGradientColorRamp
Gradient color ramp, which smoothly interpolates between two colors and also supports optional extra ...
Definition: qgscolorrampimpl.h:136
QgsCptCityColorRamp::setSchemeName
void setSchemeName(const QString &schemeName)
Definition: qgscolorrampimpl.h:767
QgsLimitedRandomColorRamp::mSatMax
int mSatMax
Definition: qgscolorrampimpl.h:479
QgsCptCityColorRamp::setName
void setName(const QString &schemeName, const QString &variantName=QString(), const QStringList &variantList=QStringList())
Definition: qgscolorrampimpl.h:770
QgsLimitedRandomColorRamp::hueMin
int hueMin() const
Returns the minimum hue for generated colors.
Definition: qgscolorrampimpl.h:401
DEFAULT_GRADIENT_COLOR2
#define DEFAULT_GRADIENT_COLOR2
Definition: qgscolorrampimpl.h:127
QgsLimitedRandomColorRamp::mCount
int mCount
Definition: qgscolorrampimpl.h:475
QgsLimitedRandomColorRamp::mSatMin
int mSatMin
Definition: qgscolorrampimpl.h:478
QgsGradientColorRamp::setInfo
void setInfo(const QgsStringMap &info)
Sets additional info to attach to the gradient ramp (e.g., authorship notes)
Definition: qgscolorrampimpl.h:253
DEFAULT_RANDOM_VAL_MAX
#define DEFAULT_RANDOM_VAL_MAX
Definition: qgscolorrampimpl.h:330
QgsPresetSchemeColorRamp
A scheme based color ramp consisting of a list of predefined colors.
Definition: qgscolorrampimpl.h:543
QgsCptCityColorRamp::setVariantList
void setVariantList(const QStringList &variantList)
Definition: qgscolorrampimpl.h:769
QgsLimitedRandomColorRamp::setSatMax
void setSatMax(int val)
Sets the maximum saturation for generated colors.
Definition: qgscolorrampimpl.h:460
QgsNamedColorList
QList< QPair< QColor, QString > > QgsNamedColorList
List of colors paired with a friendly display name identifying the color.
Definition: qgscolorscheme.h:34
QgsGradientColorRamp::clone
QgsGradientColorRamp * clone() const override
Creates a clone of the color ramp.
Definition: qgscolorrampimpl.cpp:415
QgsColorBrewerColorRamp::mInverted
bool mInverted
Definition: qgscolorrampimpl.h:703
qgis.h
QgsLimitedRandomColorRamp::setValMin
void setValMin(int val)
Sets the minimum value for generated colors.
Definition: qgscolorrampimpl.h:466
QgsCptCityColorRamp::variantName
QString variantName() const
Definition: qgscolorrampimpl.h:763
QgsCptCityColorRamp::variantList
QStringList variantList() const
Definition: qgscolorrampimpl.h:764
QgsGradientColorRamp::invert
void invert() override
Inverts the ordering of the color ramp.
Definition: qgscolorrampimpl.cpp:367
DEFAULT_COLORBREWER_COLORS
#define DEFAULT_COLORBREWER_COLORS
Definition: qgscolorrampimpl.h:607
QgsColorBrewerColorRamp::typeString
static QString typeString()
Returns the string identifier for QgsColorBrewerColorRamp.
Definition: qgscolorrampimpl.h:645
QgsLimitedRandomColorRamp
Constrained random color ramp, which returns random colors based on preset parameters.
Definition: qgscolorrampimpl.h:340
QgsLimitedRandomColorRamp::satMax
int satMax() const
Returns the maximum saturation for generated colors.
Definition: qgscolorrampimpl.h:419
QgsColorBrewerColorRamp
Color ramp utilising "Color Brewer" preset color schemes.
Definition: qgscolorrampimpl.h:615
DEFAULT_GRADIENT_COLOR1
#define DEFAULT_GRADIENT_COLOR1
Definition: qgscolorrampimpl.h:126
QgsLimitedRandomColorRamp::setSatMin
void setSatMin(int val)
Sets the minimum saturation for generated colors.
Definition: qgscolorrampimpl.h:454
QgsGradientColorRamp::mColor2
QColor mColor2
Definition: qgscolorrampimpl.h:314
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsPresetSchemeColorRamp::isEditable
bool isEditable() const override
Returns whether the color scheme is editable.
Definition: qgscolorrampimpl.h:598
DEFAULT_RANDOM_SAT_MIN
#define DEFAULT_RANDOM_SAT_MIN
Definition: qgscolorrampimpl.h:331
QgsLimitedRandomColorRamp::setHueMax
void setHueMax(int val)
Sets the maximum hue for generated colors.
Definition: qgscolorrampimpl.h:448
QgsRandomColorRamp
Totally random color ramp. Returns colors generated at random, but constrained to some hardcoded satu...
Definition: qgscolorrampimpl.h:492
QgsGradientColorRamp::stops
QgsGradientStopsList stops() const
Returns the list of intermediate gradient stops for the ramp.
Definition: qgscolorrampimpl.h:240
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
QgsCptCityColorRamp::mSchemeName
QString mSchemeName
Definition: qgscolorrampimpl.h:793
QgsGradientStop::setDirection
void setDirection(Qgis::AngularDirection direction)
Sets the direction to traverse the color wheel using when interpolating hue-based color specification...
Definition: qgscolorrampimpl.h:110
QgsPresetSchemeColorRamp::typeString
static QString typeString()
Returns the string identifier for QgsPresetSchemeColorRamp.
Definition: qgscolorrampimpl.h:588
QgsGradientColorRamp::setColor1
void setColor1(const QColor &color)
Sets the gradient start color.
Definition: qgscolorrampimpl.h:192
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsGradientColorRamp::count
int count() const override
Returns number of defined colors, or -1 if undefined.
Definition: qgscolorrampimpl.h:156
DEFAULT_CPTCITY_SCHEMENAME
#define DEFAULT_CPTCITY_SCHEMENAME
Definition: qgscolorrampimpl.h:707
QgsLimitedRandomColorRamp::valMax
int valMax() const
Returns the maximum value for generated colors.
Definition: qgscolorrampimpl.h:431
QgsGradientColorRamp::create
static QgsColorRamp * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsColorRamp from a map of properties.
Definition: qgscolorrampimpl.cpp:216
QgsGradientColorRamp::color2
QColor color2() const
Returns the gradient end color.
Definition: qgscolorrampimpl.h:184
QgsLimitedRandomColorRamp::satMin
int satMin() const
Returns the minimum saturation for generated colors.
Definition: qgscolorrampimpl.h:413
QgsRandomColorRamp::typeString
static QString typeString()
Returns the string identifier for QgsRandomColorRamp.
Definition: qgscolorrampimpl.h:521
QgsColorBrewerColorRamp::colors
int colors() const
Returns the number of colors in the ramp.
Definition: qgscolorrampimpl.h:663
qgscolorramp.h
QgsGradientColorRamp::setColor2
void setColor2(const QColor &color)
Sets the gradient end color.
Definition: qgscolorrampimpl.h:200
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:2265
QgsColorBrewerColorRamp::setSchemeName
void setSchemeName(const QString &schemeName)
Sets the name of the color brewer color scheme.
Definition: qgscolorrampimpl.h:671
QgsGradientColorRamp::mColor1
QColor mColor1
Definition: qgscolorrampimpl.h:313
QgsColorBrewerColorRamp::schemeName
QString schemeName() const
Returns the name of the color brewer color scheme.
Definition: qgscolorrampimpl.h:657
QgsColorBrewerColorRamp::mSchemeName
QString mSchemeName
Definition: qgscolorrampimpl.h:700
QgsGradientColorRamp::direction
Qgis::AngularDirection direction() const
Returns the direction to traverse the color wheel using when interpolating hue-based color specificat...
Definition: qgscolorrampimpl.h:298
QgsGradientColorRamp::type
QString type() const override
Returns a string representing the color ramp type.
Definition: qgscolorrampimpl.cpp:362
Qgis::AngularDirection::CounterClockwise
@ CounterClockwise
Counter-clockwise direction.
QgsColorBrewerColorRamp::type
QString type() const override
Returns a string representing the color ramp type.
Definition: qgscolorrampimpl.h:647
QgsGradientStop::operator!=
bool operator!=(const QgsGradientStop &other) const
Definition: qgscolorrampimpl.h:59
QgsLimitedRandomColorRamp::setCount
void setCount(int val)
Sets the number of colors contained in the ramp.
Definition: qgscolorrampimpl.h:436
DEFAULT_CPTCITY_VARIANTNAME
#define DEFAULT_CPTCITY_VARIANTNAME
Definition: qgscolorrampimpl.h:708
QgsColorRamp::clone
virtual QgsColorRamp * clone() const =0
Creates a clone of the color ramp.
QgsGradientColorRamp::setDirection
void setDirection(Qgis::AngularDirection direction)
Sets the direction to traverse the color wheel using when interpolating hue-based color specification...
Definition: qgscolorrampimpl.h:310
DEFAULT_RANDOM_SAT_MAX
#define DEFAULT_RANDOM_SAT_MAX
Definition: qgscolorrampimpl.h:332
QgsLimitedRandomColorRamp::mColors
QList< QColor > mColors
Definition: qgscolorrampimpl.h:482
QgsGradientStopsList
QList< QgsGradientStop > QgsGradientStopsList
List of gradient stops.
Definition: qgscolorrampimpl.h:122
QgsGradientStop::direction
Qgis::AngularDirection direction() const
Returns the direction to traverse the color wheel using when interpolating hue-based color specificat...
Definition: qgscolorrampimpl.h:98
QgsColorBrewerColorRamp::mPalette
QList< QColor > mPalette
Definition: qgscolorrampimpl.h:702
QgsCptCityColorRamp::setVariantName
void setVariantName(const QString &variantName)
Definition: qgscolorrampimpl.h:768
QgsCptCityColorRamp::fileLoaded
bool fileLoaded() const
Definition: qgscolorrampimpl.h:786
QgsStringMap
QMap< QString, QString > QgsStringMap
Definition: qgis.h:2781
QgsGradientStop::operator==
bool operator==(const QgsGradientStop &other) const
Definition: qgscolorrampimpl.h:54
QgsColorScheme
Abstract base class for color schemes.
Definition: qgscolorscheme.h:46
QgsCptCityColorRamp::mVariantName
QString mVariantName
Definition: qgscolorrampimpl.h:794
QgsLimitedRandomColorRamp::hueMax
int hueMax() const
Returns the maximum hue for generated colors.
Definition: qgscolorrampimpl.h:407
QgsLimitedRandomColorRamp::mHueMin
int mHueMin
Definition: qgscolorrampimpl.h:476
QgsLimitedRandomColorRamp::setHueMin
void setHueMin(int val)
Sets the minimum hue for generated colors.
Definition: qgscolorrampimpl.h:442
QgsColorRamp::type
virtual QString type() const =0
Returns a string representing the color ramp type.
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.
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
QgsCptCityColorRamp::hasMultiStops
bool hasMultiStops() const
Definition: qgscolorrampimpl.h:774
QgsGradientColorRamp::mInfo
QgsStringMap mInfo
Definition: qgscolorrampimpl.h:317
QgsColorBrewerColorRamp::setColors
void setColors(int colors)
Sets the number of colors in the ramp.
Definition: qgscolorrampimpl.h:679
QgsLimitedRandomColorRamp::mValMin
int mValMin
Definition: qgscolorrampimpl.h:480
QgsGradientColorRamp::setDiscrete
void setDiscrete(bool discrete)
Sets whether the gradient should use discrete interpolation, rather than smoothly interpolating betwe...
Definition: qgscolorrampimpl.h:216
DEFAULT_RANDOM_HUE_MAX
#define DEFAULT_RANDOM_HUE_MAX
Definition: qgscolorrampimpl.h:328
QgsCptCityColorRamp::loadPalette
void loadPalette()
Definition: qgscolorrampimpl.h:773
QgsCptCityColorRamp::mVariantList
QStringList mVariantList
Definition: qgscolorrampimpl.h:795
QgsColorRamp::invert
virtual void invert()
Inverts the ordering of the color ramp.
Definition: qgscolorramp.h:80
QgsGradientColorRamp::mDiscrete
bool mDiscrete
Definition: qgscolorrampimpl.h:315
QgsGradientColorRamp::colorSpec
QColor::Spec colorSpec() const
Returns the color specification in which the color component interpolation will occur.
Definition: qgscolorrampimpl.h:273
DEFAULT_RANDOM_VAL_MIN
#define DEFAULT_RANDOM_VAL_MIN
Definition: qgscolorrampimpl.h:329
DEFAULT_RANDOM_COUNT
#define DEFAULT_RANDOM_COUNT
Definition: qgscolorrampimpl.h:326
QgsCptCityColorRamp
Definition: qgscolorrampimpl.h:714
QgsGradientColorRamp::mStops
QgsGradientStopsList mStops
Definition: qgscolorrampimpl.h:316
DEFAULT_RANDOM_HUE_MIN
#define DEFAULT_RANDOM_HUE_MIN
Definition: qgscolorrampimpl.h:327
QgsLimitedRandomColorRamp::setValMax
void setValMax(int val)
Sets the maximum value for generated colors.
Definition: qgscolorrampimpl.h:472
QgsColorBrewerColorRamp::mColors
int mColors
Definition: qgscolorrampimpl.h:701
QgsPresetSchemeColorRamp::setColors
bool setColors(const QgsNamedColorList &colors, const QString &=QString(), const QColor &=QColor()) override
Sets the list of colors used by the ramp.
Definition: qgscolorrampimpl.h:572
QgsLimitedRandomColorRamp::typeString
static QString typeString()
Returns the string identifier for QgsLimitedRandomColorRamp.
Definition: qgscolorrampimpl.h:375
QgsGradientStop
Represents a color stop within a QgsGradientColorRamp color ramp.
Definition: qgscolorrampimpl.h:38
QgsGradientColorRamp::isDiscrete
bool isDiscrete() const
Returns true if the gradient is using discrete interpolation, rather than smoothly interpolating betw...
Definition: qgscolorrampimpl.h:207
QgsLimitedRandomColorRamp::valMin
int valMin() const
Returns the minimum value for generated colors.
Definition: qgscolorrampimpl.h:425
QgsGradientStop::offset
double offset
Relative positional offset, between 0 and 1.
Definition: qgscolorrampimpl.h:50
QgsGradientColorRamp::info
QgsStringMap info() const
Returns any additional info attached to the gradient ramp (e.g., authorship notes)
Definition: qgscolorrampimpl.h:246
QgsLimitedRandomColorRamp::mHueMax
int mHueMax
Definition: qgscolorrampimpl.h:477
QgsColorRamp::value
virtual double value(int index) const =0
Returns relative value between [0,1] of color at specified index.
Qgis::AngularDirection
AngularDirection
Angular directions.
Definition: qgis.h:1635
QgsLimitedRandomColorRamp::mValMax
int mValMax
Definition: qgscolorrampimpl.h:481
QgsGradientStop::colorSpec
QColor::Spec colorSpec() const
Returns the color specification in which the color component interpolation will occur.
Definition: qgscolorrampimpl.h:73