Skip to content
Permalink
Browse files
Correctly set band number for pseudocolor renderer widget
Previously the band was always reset to the first band when opening
the raster layer properties.
  • Loading branch information
nyalldawson committed Dec 4, 2014
1 parent 486d408 commit e887d07
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
@@ -24,6 +24,11 @@ class QgsSingleBandPseudoColorRenderer: QgsRasterRenderer

QList<int> usesBands() const;

/**Returns the band used by the renderer
* @note added in QGIS 2.7
*/
int band() const;

double classificationMin() const;
double classificationMax() const;
void setClassificationMin( double min );
@@ -49,6 +49,11 @@ class CORE_EXPORT QgsSingleBandPseudoColorRenderer: public QgsRasterRenderer

QList<int> usesBands() const;

/**Returns the band used by the renderer
* @note added in QGIS 2.7
*/
int band() const { return mBand; }

double classificationMin() const { return mClassificationMin; }
double classificationMax() const { return mClassificationMax; }
void setClassificationMin( double min ) { mClassificationMin = min; }
@@ -561,6 +561,8 @@ void QgsSingleBandPseudoColorRendererWidget::setFromRenderer( const QgsRasterRen
const QgsSingleBandPseudoColorRenderer* pr = dynamic_cast<const QgsSingleBandPseudoColorRenderer*>( r );
if ( pr )
{
mBandComboBox->setCurrentIndex( mBandComboBox->findData( pr->band() ) );

const QgsRasterShader* rasterShader = pr->shader();
if ( rasterShader )
{

0 comments on commit e887d07

Please sign in to comment.