Skip to content

Commit

Permalink
[pseudocolor renderer] fix invert check box in continous mode
Browse files Browse the repository at this point in the history
(fixes #15209)

(cherry-picked from 1e0e9c2)
  • Loading branch information
nirvn authored and nyalldawson committed Oct 6, 2016
1 parent 7c4aa12 commit 08bfd91
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/gui/raster/qgssinglebandpseudocolorrendererwidget.cpp
Expand Up @@ -400,14 +400,23 @@ void QgsSingleBandPseudoColorRendererWidget::on_mClassifyButton_clicked()
{
for ( int i = 0; i < numberOfEntries; ++i )
{
double value = colorRamp->value( i );
entryValues.push_back( min + value * ( max - min ) );
if ( mInvertCheckBox->isChecked() )
{
double value = 1.0 - colorRamp->value( numberOfEntries - i - 1 );
entryValues.push_back( min + value * ( max - min ) );
}
else
{
double value = colorRamp->value( i );
entryValues.push_back( min + value * ( max - min ) );
}
}
}
// for continuous mode take original color map colors
for ( int i = 0; i < numberOfEntries; ++i )
{
entryColors.push_back( colorRamp->color( colorRamp->value( i ) ) );
int idx = mInvertCheckBox->isChecked() ? numberOfEntries - i - 1 : i;
entryColors.push_back( colorRamp->color( colorRamp->value( idx ) ) );
}
}
}
Expand Down

0 comments on commit 08bfd91

Please sign in to comment.