16 #ifndef QGSVECTORCOLORRAMPV2_H
17 #define QGSVECTORCOLORRAMPV2_H
32 virtual int count()
const = 0;
35 virtual double value(
int index )
const = 0;
37 virtual QColor color(
double value )
const = 0;
39 virtual QString type()
const = 0;
56 #define DEFAULT_GRADIENT_COLOR1 QColor(0,0,255)
57 #define DEFAULT_GRADIENT_COLOR2 QColor(0,255,0)
64 bool discrete =
false,
69 virtual int count()
const override {
return mStops.count() + 2; }
71 virtual double value(
int index )
const override;
73 virtual QColor
color(
double value )
const override;
75 virtual QString
type()
const override {
return "gradient"; }
81 QColor
color1()
const {
return mColor1; }
82 QColor
color2()
const {
return mColor2; }
88 void convertToDiscrete(
bool discrete );
98 void addStopsToGradient( QGradient* gradient,
double alpha = 1 );
107 #define DEFAULT_RANDOM_COUNT 10
108 #define DEFAULT_RANDOM_HUE_MIN 0
109 #define DEFAULT_RANDOM_HUE_MAX 359
110 #define DEFAULT_RANDOM_VAL_MIN 200
111 #define DEFAULT_RANDOM_VAL_MAX 240
112 #define DEFAULT_RANDOM_SAT_MIN 100
113 #define DEFAULT_RANDOM_SAT_MAX 240
125 virtual double value(
int index )
const override;
127 virtual QColor
color(
double value )
const override;
129 virtual QString
type()
const override {
return "random"; }
137 static QList<QColor> randomColors(
int count,
143 int count()
const override {
return mCount; }
161 int mHueMin, mHueMax, mSatMin, mSatMax,
mValMin, mValMax;
171 int count()
const override;
175 QColor
color(
double value )
const override;
183 virtual void setTotalColorCount(
const int colorCount );
185 QString
type()
const override;
199 #define DEFAULT_COLORBREWER_SCHEMENAME "Spectral"
200 #define DEFAULT_COLORBREWER_COLORS 5
210 virtual double value(
int index )
const override;
212 virtual QColor
color(
double value )
const override;
214 virtual QString
type()
const override {
return "colorbrewer"; }
221 virtual int count()
const override {
return mColors; }
224 void setSchemeName( QString schemeName ) { mSchemeName = schemeName; loadPalette(); }
225 void setColors(
int colors ) { mColors = colors; loadPalette(); }
227 static QStringList listSchemeNames();
228 static QList<int> listSchemeVariants( QString schemeName );
240 #define DEFAULT_CPTCITY_SCHEMENAME "cb/div/BrBG_" //change this
241 #define DEFAULT_CPTCITY_VARIANTNAME "05"
248 bool doLoadFile =
true );
250 QString variantName = QString(),
bool doLoadFile =
true );
254 virtual QString
type()
const override {
return "cpt-city"; }
267 void setSchemeName( QString schemeName ) { mSchemeName = schemeName; mFileLoaded =
false; }
268 void setVariantName( QString variantName ) { mVariantName = variantName; mFileLoaded =
false; }
270 void setName( QString schemeName, QString variantName =
"", QStringList variantList = QStringList() )
271 { mSchemeName = schemeName; mVariantName = variantName; mVariantList = variantList; mFileLoaded =
false; }
276 QString fileName()
const;
280 QString copyingFileName()
const;
281 QString descFileName()
const;