Skip to content

Commit

Permalink
Merge pull request #2163 from carolinux/master
Browse files Browse the repository at this point in the history
Added setBand capability to qgssinglebandpseudocolorrenderer API
  • Loading branch information
nyalldawson committed Jun 24, 2015
2 parents 8656b2d + 028c083 commit 7e8041c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/core/raster/qgssinglebandpseudocolorrenderer.sip
Expand Up @@ -29,6 +29,12 @@ class QgsSingleBandPseudoColorRenderer: QgsRasterRenderer
*/
int band() const;

/** Sets the band used by the renderer.
* @see band
* @note added in QGIS 2.10
*/
void setBand(int bandNo);

double classificationMin() const;
double classificationMax() const;
void setClassificationMin( double min );
Expand Down
9 changes: 9 additions & 0 deletions src/core/raster/qgssinglebandpseudocolorrenderer.cpp
Expand Up @@ -38,6 +38,15 @@ QgsSingleBandPseudoColorRenderer::~QgsSingleBandPseudoColorRenderer()
delete mShader;
}

void QgsSingleBandPseudoColorRenderer::setBand(int bandNo)
{
if ( bandNo > mInput->bandCount() || bandNo <= 0 )
{
return;
}
mBand = bandNo;
}

QgsRasterInterface * QgsSingleBandPseudoColorRenderer::clone() const
{
QgsRasterShader *shader = 0;
Expand Down
6 changes: 6 additions & 0 deletions src/core/raster/qgssinglebandpseudocolorrenderer.h
Expand Up @@ -54,6 +54,12 @@ class CORE_EXPORT QgsSingleBandPseudoColorRenderer: public QgsRasterRenderer
*/
int band() const { return mBand; }

/** Sets the band used by the renderer.
* @see band
* @note added in QGIS 2.10
*/
void setBand( int bandNo );

double classificationMin() const { return mClassificationMin; }
double classificationMax() const { return mClassificationMax; }
void setClassificationMin( double min ) { mClassificationMin = min; }
Expand Down

0 comments on commit 7e8041c

Please sign in to comment.