Skip to content

Commit

Permalink
[raster] Fix pseudocolor clip option (setting was lost in the pipeline)
Browse files Browse the repository at this point in the history
Also disable checkbox for exact and discrete mode, as it isn't used there.
  • Loading branch information
pierstitus authored and nyalldawson committed Jun 2, 2016
1 parent 4fed566 commit 8f667bb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/core/raster/qgssinglebandpseudocolorrenderer.cpp
Expand Up @@ -63,7 +63,7 @@ QgsSingleBandPseudoColorRenderer* QgsSingleBandPseudoColorRenderer::clone() cons
QgsColorRampShader * colorRampShader = new QgsColorRampShader( mShader->minimumValue(), mShader->maximumValue() );

colorRampShader->setColorRampType( origColorRampShader->colorRampType() );

colorRampShader->setClip( origColorRampShader->clip() );
colorRampShader->setColorRampItemList( origColorRampShader->colorRampItemList() );
shader->setRasterShaderFunction( colorRampShader );
}
Expand Down
13 changes: 10 additions & 3 deletions src/gui/raster/qgssinglebandpseudocolorrendererwidget.cpp
Expand Up @@ -513,7 +513,7 @@ void QgsSingleBandPseudoColorRendererWidget::on_mClassifyButton_clicked()

// calculate a reasonable number of decimals to display
double maxabs = log10( qMax( qAbs( max ), qAbs( min ) ) );
int nDecimals = qRound( qMax( 3.0 + maxabs - log10( max - min ), maxabs <= 6.0 ? maxabs + 0.49 : 0.0 ) );
int nDecimals = qRound( qMax( 3.0 + maxabs - log10( max - min ), maxabs <= 16.0 ? maxabs + 0.49 : 0.0 ) );

for ( ; value_it != entryValues.end(); ++value_it, ++color_it )
{
Expand Down Expand Up @@ -561,7 +561,7 @@ void QgsSingleBandPseudoColorRendererWidget::populateColormapTreeWidget( const Q
for ( ; it != colorRampItems.constEnd(); ++it )
{
QgsTreeWidgetItem* newItem = new QgsTreeWidgetItem( mColormapTreeWidget );
newItem->setText( ValueColumn, QString::number( it->value, 'g' ) );
newItem->setText( ValueColumn, QString::number( it->value, 'g', 16 ) );
newItem->setBackground( ColorColumn, QBrush( it->color ) );
newItem->setText( LabelColumn, it->label );
newItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable );
Expand Down Expand Up @@ -830,7 +830,7 @@ void QgsSingleBandPseudoColorRendererWidget::setFromRenderer( const QgsRasterRen
for ( ; it != colorRampItemList.end(); ++it )
{
QgsTreeWidgetItem* newItem = new QgsTreeWidgetItem( mColormapTreeWidget );
newItem->setText( ValueColumn, QString::number( it->value, 'g' ) );
newItem->setText( ValueColumn, QString::number( it->value, 'g', 16 ) );
newItem->setBackground( ColorColumn, QBrush( it->color ) );
newItem->setText( LabelColumn, it->label );
newItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable );
Expand All @@ -855,6 +855,13 @@ void QgsSingleBandPseudoColorRendererWidget::on_mBandComboBox_currentIndexChange
mMinMaxWidget->setBands( bands );
}

void QgsSingleBandPseudoColorRendererWidget::on_mColorInterpolationComboBox_currentIndexChanged( int index )
{
Q_UNUSED( index );
mClipCheckBox->setEnabled( mColorInterpolationComboBox->currentText() == tr( "Linear" ) );
autoLabel();
}

void QgsSingleBandPseudoColorRendererWidget::loadMinMax( int theBandNo, double theMin, double theMax, int theOrigin )
{
Q_UNUSED( theBandNo );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/raster/qgssinglebandpseudocolorrendererwidget.h
Expand Up @@ -71,7 +71,7 @@ class GUI_EXPORT QgsSingleBandPseudoColorRendererWidget: public QgsRasterRendere
void on_mColormapTreeWidget_itemDoubleClicked( QTreeWidgetItem* item, int column );
void mColormapTreeWidget_itemEdited( QTreeWidgetItem* item, int column );
void on_mBandComboBox_currentIndexChanged( int index );
void on_mColorInterpolationComboBox_currentIndexChanged( int index ) { Q_UNUSED( index ); autoLabel(); }
void on_mColorInterpolationComboBox_currentIndexChanged( int index );
void on_mMinLineEdit_textChanged( const QString & text ) { Q_UNUSED( text ); resetClassifyButton(); }
void on_mMaxLineEdit_textChanged( const QString & text ) { Q_UNUSED( text ); resetClassifyButton(); }
void on_mMinLineEdit_textEdited( const QString & text ) { Q_UNUSED( text ); mMinMaxOrigin = QgsRasterRenderer::MinMaxUser; showMinMaxOrigin(); }
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qgssinglebandpseudocolorrendererwidgetbase.ui
Expand Up @@ -251,7 +251,7 @@
<string>If checked, any pixels with a value out of range will not be rendered</string>
</property>
<property name="text">
<string>Clip raster values which are out of range</string>
<string>Clip out of range values</string>
</property>
</widget>
</item>
Expand Down

0 comments on commit 8f667bb

Please sign in to comment.