Skip to content

Commit 7e8041c

Browse files
committedJun 24, 2015
Merge pull request #2163 from carolinux/master
Added setBand capability to qgssinglebandpseudocolorrenderer API
2 parents 8656b2d + 028c083 commit 7e8041c

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed
 

‎python/core/raster/qgssinglebandpseudocolorrenderer.sip

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ class QgsSingleBandPseudoColorRenderer: QgsRasterRenderer
2929
*/
3030
int band() const;
3131

32+
/** Sets the band used by the renderer.
33+
* @see band
34+
* @note added in QGIS 2.10
35+
*/
36+
void setBand(int bandNo);
37+
3238
double classificationMin() const;
3339
double classificationMax() const;
3440
void setClassificationMin( double min );

‎src/core/raster/qgssinglebandpseudocolorrenderer.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ QgsSingleBandPseudoColorRenderer::~QgsSingleBandPseudoColorRenderer()
3838
delete mShader;
3939
}
4040

41+
void QgsSingleBandPseudoColorRenderer::setBand(int bandNo)
42+
{
43+
if ( bandNo > mInput->bandCount() || bandNo <= 0 )
44+
{
45+
return;
46+
}
47+
mBand = bandNo;
48+
}
49+
4150
QgsRasterInterface * QgsSingleBandPseudoColorRenderer::clone() const
4251
{
4352
QgsRasterShader *shader = 0;

‎src/core/raster/qgssinglebandpseudocolorrenderer.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ class CORE_EXPORT QgsSingleBandPseudoColorRenderer: public QgsRasterRenderer
5454
*/
5555
int band() const { return mBand; }
5656

57+
/** Sets the band used by the renderer.
58+
* @see band
59+
* @note added in QGIS 2.10
60+
*/
61+
void setBand( int bandNo );
62+
5763
double classificationMin() const { return mClassificationMin; }
5864
double classificationMax() const { return mClassificationMax; }
5965
void setClassificationMin( double min ) { mClassificationMin = min; }

0 commit comments

Comments
 (0)
Please sign in to comment.