[raster] Fix pseudocolor clip option (setting was lost in the pipeline)

Also disable checkbox for exact and discrete mode, as it isn't used there.
This commit is contained in:
Piers Titus van der Torren 2016-04-15 16:50:39 +02:00 committed by Nyall Dawson
parent 4fed5667b2
commit 8f667bbdca
4 changed files with 13 additions and 6 deletions

View File

@ -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 );
}

View File

@ -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 )
{
@ -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 );
@ -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 );
@ -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 );

View File

@ -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(); }

View File

@ -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>