Skip to content
Permalink
Browse files

[FEATURE] Implement raster pseudocolor updated extent auto classifica…

…tion
  • Loading branch information
nirvn committed Dec 27, 2016
1 parent 181f84b commit 5ece689033cfd448a634e2be7188f6c2b56346bc
Showing with 25 additions and 5 deletions.
  1. +22 −0 src/core/raster/qgsrasterlayer.cpp
  2. +3 −5 src/gui/raster/qgssinglebandpseudocolorrendererwidget.cpp
@@ -1057,8 +1057,30 @@ void QgsRasterLayer::refreshRendererIfNeeded( QgsRasterRenderer* rasterRenderer,
SAMPLE_SIZE, min, max );
sbpcr->setClassificationMin( min );
sbpcr->setClassificationMax( max );

if ( sbpcr->shader() )
{
QgsColorRampShader* colorRampShader = dynamic_cast<QgsColorRampShader*>( sbpcr->shader()->rasterShaderFunction() );
if ( colorRampShader )
{
colorRampShader->classifyColorRamp( sbpcr->band(), theExtent, rasterRenderer->input() );
}
}

QgsSingleBandPseudoColorRenderer* r = dynamic_cast<QgsSingleBandPseudoColorRenderer*>( renderer() );
dynamic_cast<QgsSingleBandPseudoColorRenderer*>( renderer() )->setClassificationMin( min );
dynamic_cast<QgsSingleBandPseudoColorRenderer*>( renderer() )->setClassificationMax( max );

if ( r->shader() )
{
QgsColorRampShader* colorRampShader = dynamic_cast<QgsColorRampShader*>( r->shader()->rasterShaderFunction() );
if ( colorRampShader )
{
colorRampShader->classifyColorRamp( sbpcr->band(), theExtent, rasterRenderer->input() );
}
}

emit repaintRequested();
emit styleChanged();
emit rendererChanged();
return;
@@ -86,11 +86,8 @@ QgsSingleBandPseudoColorRendererWidget::QgsSingleBandPseudoColorRendererWidget(
mMinMaxContainerWidget->setLayout( layout );
layout->addWidget( mMinMaxWidget );

connect( mMinMaxWidget, &QgsRasterMinMaxWidget::widgetChanged,
this, &QgsSingleBandPseudoColorRendererWidget::widgetChanged );

connect( mMinMaxWidget, &QgsRasterMinMaxWidget::load,
this, &QgsSingleBandPseudoColorRendererWidget::loadMinMax );
connect( mMinMaxWidget, &QgsRasterMinMaxWidget::widgetChanged, this, &QgsSingleBandPseudoColorRendererWidget::widgetChanged );
connect( mMinMaxWidget, &QgsRasterMinMaxWidget::load, this, &QgsSingleBandPseudoColorRendererWidget::loadMinMax );

//fill available bands into combo box
int nBands = provider->bandCount();
@@ -775,6 +772,7 @@ void QgsSingleBandPseudoColorRendererWidget::loadMinMax( int theBandNo, double t
mMaxLineEdit->setText( QString::number( theMax ) );
}
mDisableMinMaxWidgetRefresh = false;
classify();
}

void QgsSingleBandPseudoColorRendererWidget::setLineEditValue( QLineEdit * theLineEdit, double theValue )

0 comments on commit 5ece689

Please sign in to comment.
You can’t perform that action at this time.