Skip to content

Commit 08bfd91

Browse files
nirvnnyalldawson
authored andcommittedOct 6, 2016
[pseudocolor renderer] fix invert check box in continous mode
(fixes #15209) (cherry-picked from 1e0e9c2)
1 parent 7c4aa12 commit 08bfd91

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed
 

‎src/gui/raster/qgssinglebandpseudocolorrendererwidget.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,14 +400,23 @@ void QgsSingleBandPseudoColorRendererWidget::on_mClassifyButton_clicked()
400400
{
401401
for ( int i = 0; i < numberOfEntries; ++i )
402402
{
403-
double value = colorRamp->value( i );
404-
entryValues.push_back( min + value * ( max - min ) );
403+
if ( mInvertCheckBox->isChecked() )
404+
{
405+
double value = 1.0 - colorRamp->value( numberOfEntries - i - 1 );
406+
entryValues.push_back( min + value * ( max - min ) );
407+
}
408+
else
409+
{
410+
double value = colorRamp->value( i );
411+
entryValues.push_back( min + value * ( max - min ) );
412+
}
405413
}
406414
}
407415
// for continuous mode take original color map colors
408416
for ( int i = 0; i < numberOfEntries; ++i )
409417
{
410-
entryColors.push_back( colorRamp->color( colorRamp->value( i ) ) );
418+
int idx = mInvertCheckBox->isChecked() ? numberOfEntries - i - 1 : i;
419+
entryColors.push_back( colorRamp->color( colorRamp->value( idx ) ) );
411420
}
412421
}
413422
}

0 commit comments

Comments
 (0)