File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change 30
30
31
31
static QColor _interpolate ( QColor c1, QColor c2, double value )
32
32
{
33
+ if ( isnan ( value ) ) value = 1 ;
33
34
int r = ( int )( c1.red () + value * ( c2.red () - c1.red () ) );
34
35
int g = ( int )( c1.green () + value * ( c2.green () - c1.green () ) );
35
36
int b = ( int )( c1.blue () + value * ( c2.blue () - c1.blue () ) );
@@ -365,11 +366,10 @@ double QgsRandomColorsV2::value( int index ) const
365
366
366
367
QColor QgsRandomColorsV2::color ( double value ) const
367
368
{
368
- Q_UNUSED ( value );
369
369
int minVal = 130 ;
370
370
int maxVal = 255 ;
371
371
372
- int colorIndex = value * ( mTotalColorCount - 1 );
372
+ int colorIndex = ! isnan ( value ) ? value : 1 * ( mTotalColorCount - 1 );
373
373
if ( mTotalColorCount >= 1 && mPrecalculatedColors .length () > colorIndex )
374
374
{
375
375
// use precalculated hue
You can’t perform that action at this time.
0 commit comments