33   if ( qIsNaN( value ) ) 
return c2;
    35   qreal r = ( c1.
redF() + value * ( c2.
redF() - c1.
redF() ) );
    49     , mDiscrete( discrete )
    68     Q_FOREACH ( 
const QString& stop, props[
"stops"].split( 
':' ) )
    80   bool discrete = 
false;
    83     if ( props[
"discrete"] == 
"1" )
    92     if ( it.key().startsWith( 
"info_" ) )
    93       info[ it.key().mid( 5 )] = it.
value();
   113     return mStops[index-1].offset;
   136     double lower = 0, upper = 0;
   140       if ( it->offset > value )
   183     map[
"stops"] = lst.
join( 
":" );
   191     map[
"info_" + it.key()] = it.
value();
   213       if ( i == numStops - 1 )
   229       if ( i == numStops - 3 )
   267     QColor rampColor = it->color;
   272     gradient->
setColorAt( it->offset, rampColor );
   281     int satMin, 
int satMax, 
int valMin, 
int valMax )
   283     , mHueMin( hueMin ), mHueMax( hueMax )
   284     , mSatMin( satMin ), mSatMax( satMax )
   285     , mValMin( valMin ), mValMax( valMax )
   297   if ( props.
contains( 
"count" ) ) count = props[
"count"].toInt();
   298   if ( props.
contains( 
"hueMin" ) ) hueMin = props[
"hueMin"].toInt();
   299   if ( props.
contains( 
"hueMax" ) ) hueMax = props[
"hueMax"].toInt();
   300   if ( props.
contains( 
"satMin" ) ) satMin = props[
"satMin"].toInt();
   301   if ( props.
contains( 
"satMax" ) ) satMax = props[
"satMax"].toInt();
   302   if ( props.
contains( 
"valMin" ) ) valMin = props[
"valMin"].toInt();
   303   if ( props.
contains( 
"valMax" ) ) valMax = props[
"valMax"].toInt();
   316   if ( value < 0 || value > 1 )
   320   int colorIdx = qMin( static_cast< int >( value * colorCnt ), colorCnt - 1 );
   322   if ( colorIdx >= 0 && colorIdx < colorCnt )
   353   int safeHueMax = qMax( hueMin, hueMax );
   354   int safeHueMin = qMin( hueMin, hueMax );
   355   int safeSatMax = qMax( satMin, satMax );
   356   int safeSatMin = qMin( satMin, satMax );
   357   int safeValMax = qMax( valMin, valMax );
   358   int safeValMin = qMin( valMin, valMax );
   361   double currentHueAngle = 360.0 * 
static_cast< double >( qrand() ) / RAND_MAX;
   364   for ( 
int i = 0; i < 
count; ++i )
   369     currentHueAngle += 137.50776;
   371     h = qBound( 0, qRound(( fmod( currentHueAngle, 360.0 ) / 360.0 ) * ( safeHueMax - safeHueMin ) + safeHueMin ), 359 );
   372     s = qBound( 0, ( qrand() % ( safeSatMax - safeSatMin + 1 ) ) + safeSatMin, 255 );
   373     v = qBound( 0, ( qrand() % ( safeValMax - safeValMin + 1 ) ) + safeValMin, 255 );
   387     : mTotalColorCount( 0 )
   421   int h = 
static_cast< int >( 360.0 * qrand() / ( RAND_MAX + 1.0 ) );
   423   int v = ( qrand() % ( maxVal - minVal + 1 ) ) + minVal;
   437   double hueOffset = ( 360.0 * qrand() / ( RAND_MAX + 1.0 ) );
   442   double hueStep = 359.0 / colorCount;
   443   double currentHue = hueOffset;
   446   for ( 
int idx = 0; idx < colorCount; ++ idx )
   448     int h = qRound( currentHue ) % 360;
   452     currentHue += hueStep;
   461   return "randomcolors";
   477     : mSchemeName( schemeName )
   488   if ( props.
contains( 
"schemeName" ) )
   489     schemeName = props[
"schemeName"];
   491     colors = props[
"colors"].toInt();
   522   int paletteEntry = 
static_cast< int >( value * 
mPalette.
count() );
   548     , 
mSchemeName( schemeName ), mVariantName( variantName )
   549     , mVariantList( 
QStringList() ), mFileLoaded( false ), mMultiStops( false )
   576   if ( props.
contains( 
"schemeName" ) )
   577     schemeName = props[
"schemeName"];
   578   if ( props.
contains( 
"variantName" ) )
   579     variantName = props[
"variantName"];
   615   info[
"cpt-city-license"] = 
"<cpt-city>" + copyingFilename;
   694       if ( it.
value().first == prev.
value().second )
   723           ( it.
key() != 0.0 && it.
key() != 1.0 ) )
 static QgsVectorColorRampV2 * create(const QgsStringMap &properties=QgsStringMap())
 
static QgsVectorColorRampV2 * create(const QgsStringMap &properties=QgsStringMap())
 
virtual QColor color(double value) const override
Returns the color corresponding to a specified value. 
 
QString schemeName() const
 
QgsStringMap copyingInfo() const
 
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
 
int count() const override
Returns number of defined colors, or -1 if undefined. 
 
QgsRandomColorsV2 * clone() const override
Creates a clone of the color ramp. 
 
bool contains(const Key &key) const
 
#define DEFAULT_CPTCITY_VARIANTNAME
 
virtual QgsVectorRandomColorRampV2 * clone() const override
Creates a clone of the color ramp. 
 
Represents a color stop within a gradient color ramp. 
 
void copy(const QgsCptCityColorRampV2 *other)
 
int count() const override
Returns number of defined colors, or -1 if undefined. 
 
virtual QgsVectorColorBrewerColorRampV2 * clone() const override
Creates a clone of the color ramp. 
 
void setColorAt(qreal position, const QColor &color)
 
static QString defaultBaseDir()
 
static QString encodeColor(const QColor &color)
 
#define DEFAULT_COLORBREWER_SCHEMENAME
 
#define DEFAULT_RANDOM_HUE_MIN
 
QColor color2() const
Returns the gradient end color. 
 
const_iterator constBegin() const
 
const T & at(int i) const
 
void setInfo(const QgsStringMap &info)
Sets additional info to attach to the gradient ramp (eg authorship notes) 
 
QColor color1() const
Returns the gradient start color. 
 
bool stopLessThan(const QgsGradientStop &s1, const QgsGradientStop &s2)
 
virtual QgsVectorGradientColorRampV2 * clone() const override
Creates a clone of the color ramp. 
 
virtual QgsCptCityColorRampV2 * clone() const override
Creates a clone of the color ramp. 
 
bool isDiscrete() const
Returns true if the gradient is using discrete interpolation, rather than smoothly interpolating betw...
 
virtual void setTotalColorCount(const int colorCount)
Sets the desired total number of unique colors for the resultant ramp. 
 
QgsVectorGradientColorRampV2 * cloneGradientRamp() const
 
QString join(const QString &separator) const
 
QString & remove(int position, int n)
 
QString descFileName() const
 
#define DEFAULT_CPTCITY_SCHEMENAME
 
QgsGradientStopsList stops() const
Returns the list of intermediate gradient stops for the ramp. 
 
double toDouble(bool *ok) const
 
static QList< QColor > listSchemeColors(const QString &schemeName, int colors)
 
QMap< QString, QString > QgsStringMap
 
#define DEFAULT_RANDOM_SAT_MAX
 
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
Compare two doubles (but allow some difference) 
 
QgsCptCityColorRampV2(const QString &schemeName=DEFAULT_CPTCITY_SCHEMENAME, const QString &variantName=DEFAULT_CPTCITY_VARIANTNAME, bool doLoadFile=true)
 
QColor fromHsv(int h, int s, int v, int a)
 
static QList< int > listSchemeVariants(const QString &schemeName)
 
virtual QgsStringMap properties() const override
Returns a string map containing all the color ramp's properties. 
 
virtual int count() const override
Returns number of defined colors, or -1 if undefined. 
 
QString number(int n, int base)
 
int count(const T &value) const
 
void append(const T &value)
 
QgsStringMap info() const
Returns any additional info attached to the gradient ramp (eg authorship notes) 
 
#define DEFAULT_GRADIENT_COLOR2
 
virtual QgsStringMap properties() const override
Returns a string map containing all the color ramp's properties. 
 
QgsVectorRandomColorRampV2(int count=DEFAULT_RANDOM_COUNT, int hueMin=DEFAULT_RANDOM_HUE_MIN, int hueMax=DEFAULT_RANDOM_HUE_MAX, int satMin=DEFAULT_RANDOM_SAT_MIN, int satMax=DEFAULT_RANDOM_SAT_MAX, int valMin=DEFAULT_RANDOM_VAL_MIN, int valMax=DEFAULT_RANDOM_VAL_MAX)
 
virtual QColor color(double value) const override
Returns the color corresponding to a specified value. 
 
static QColor _interpolate(const QColor &c1, const QColor &c2, const double value)
 
double offset
Relative positional offset, between 0 and 1. 
 
#define DEFAULT_GRADIENT_COLOR1
 
const_iterator constEnd() const
 
void setStops(const QgsGradientStopsList &stops)
Sets the list of intermediate gradient stops for the ramp. 
 
#define DEFAULT_RANDOM_VAL_MAX
 
static QStringList listSchemeNames()
 
virtual QgsStringMap properties() const override
Returns a string map containing all the color ramp's properties. 
 
static QMap< QString, QString > copyingInfo(const QString &fileName)
 
static QList< QColor > randomColors(int count, int hueMax=DEFAULT_RANDOM_HUE_MAX, int hueMin=DEFAULT_RANDOM_HUE_MIN, int satMax=DEFAULT_RANDOM_SAT_MAX, int satMin=DEFAULT_RANDOM_SAT_MIN, int valMax=DEFAULT_RANDOM_VAL_MAX, int valMin=DEFAULT_RANDOM_VAL_MIN)
Get a list of random colors. 
 
QString copyingFileName() const
 
QgsVectorGradientColorRampV2(const QColor &color1=DEFAULT_GRADIENT_COLOR1, const QColor &color2=DEFAULT_GRADIENT_COLOR2, bool discrete=false, const QgsGradientStopsList &stops=QgsGradientStopsList())
Constructor for QgsVectorGradientColorRampV2. 
 
virtual QgsStringMap properties() const override
Returns a string map containing all the color ramp's properties. 
 
QString type() const override
Returns a string representing the color ramp type. 
 
void convertToDiscrete(bool discrete)
Converts a gradient with existing color stops to or from discrete interpolation. 
 
QColor fromRgbF(qreal r, qreal g, qreal b, qreal a)
 
#define DEFAULT_RANDOM_SAT_MIN
 
virtual double value(int index) const override
Returns relative value between [0,1] of color at specified index. 
 
static QgsVectorColorRampV2 * create(const QgsStringMap &properties=QgsStringMap())
Creates a new QgsVectorColorRampV2 from a map of properties. 
 
QgsStringMap properties() const override
Returns a string map containing all the color ramp's properties. 
 
virtual QColor color(double value) const override
Returns the color corresponding to a specified value. 
 
const Key key(const T &value) const
 
Random color ramp, which returns random colors based on preset parameters. 
 
QString schemeName() const
 
int ANALYSIS_EXPORT lower(int n, int i)
Lower function. 
 
QString mid(int position, int n) const
 
virtual double value(int index) const override
Returns relative value between [0,1] of color at specified index. 
 
#define DEFAULT_COLORBREWER_COLORS
 
static QStringList listSchemes()
 
QColor color(double value) const override
Returns the color corresponding to a specified value. 
 
double value(int index) const override
Returns relative value between [0,1] of color at specified index. 
 
static QgsVectorColorRampV2 * create(const QgsStringMap &properties=QgsStringMap())
 
QList< QColor > mPrecalculatedColors
 
#define DEFAULT_RANDOM_HUE_MAX
 
QString left(int n) const
 
QgsVectorColorBrewerColorRampV2(const QString &schemeName=DEFAULT_COLORBREWER_SCHEMENAME, int colors=DEFAULT_COLORBREWER_COLORS)
 
QString variantName() const
 
static QColor decodeColor(const QString &str)
 
static QList< int > listSchemeVariants(const QString &schemeName)
 
virtual double value(int index) const override
Returns relative value between [0,1] of color at specified index. 
 
static QMap< double, QPair< QColor, QColor > > gradientColorMap(const QString &fileName)
 
const_iterator constEnd() const
 
const_iterator constBegin() const
 
#define DEFAULT_RANDOM_VAL_MIN
 
void addStopsToGradient(QGradient *gradient, double alpha=1)
Copy color ramp stops to a QGradient. 
 
Abstract base class for color ramps. 
 
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
 
Gradient color ramp, which smoothly interpolates between two colors and also supports optional extra ...
 
QgsGradientStopsList mStops
 
#define DEFAULT_RANDOM_COUNT
 
static QString findFileName(const QString &target, const QString &startDir, const QString &baseDir)
 
QStringList variantList() const
 
const T value(const Key &key) const