Skip to content

Commit

Permalink
Correctly set band number for pseudocolor renderer widget
Browse files Browse the repository at this point in the history
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.
5 changes: 5 additions & 0 deletions python/core/raster/qgssinglebandpseudocolorrenderer.sip
Expand Up @@ -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 );
Expand Down
5 changes: 5 additions & 0 deletions src/core/raster/qgssinglebandpseudocolorrenderer.h
Expand Up @@ -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; }
Expand Down
2 changes: 2 additions & 0 deletions src/gui/raster/qgssinglebandpseudocolorrendererwidget.cpp
Expand Up @@ -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 )
{
Expand Down

0 comments on commit e887d07

Please sign in to comment.