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)
  • Loading branch information
nirvn authored and nyalldawson committed Oct 5, 2016
1 parent bc32b1f commit 1e0e9c2
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/gui/raster/qgssinglebandpseudocolorrendererwidget.cpp
Expand Up @@ -369,14 +369,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 1e0e9c2

Please sign in to comment.