Skip to content

Commit 579ccb3

Browse files
committed
Fill comboboxes in single band gray widget
1 parent 8d415e5 commit 579ccb3

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/gui/raster/qgssinglebandgrayrendererwidget.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,33 @@
1616
***************************************************************************/
1717

1818
#include "qgssinglebandgrayrendererwidget.h"
19+
#include "qgsrasterlayer.h"
1920

2021
QgsSingleBandGrayRendererWidget::QgsSingleBandGrayRendererWidget( QgsRasterLayer* layer ): QgsRasterRendererWidget( layer )
2122
{
2223
setupUi( this );
24+
25+
if ( mRasterLayer )
26+
{
27+
QgsRasterDataProvider* provider = mRasterLayer->dataProvider();
28+
if ( !provider )
29+
{
30+
return;
31+
}
32+
33+
//fill available bands into combo box
34+
int nBands = provider->bandCount();
35+
for ( int i = 1; i <= nBands; ++i ) //band numbering seem to start at 1
36+
{
37+
mGrayBandComboBox->addItem( provider->colorInterpretationName( i ), i );
38+
}
39+
40+
//contrast enhancement algorithms
41+
mContrastEnhancementComboBox->addItem( tr( "No enhancement" ), 0 );
42+
mContrastEnhancementComboBox->addItem( tr( "Stretch to MinMax" ), 1 );
43+
mContrastEnhancementComboBox->addItem( tr( "Stretch and clip to MinMax" ), 2 );
44+
mContrastEnhancementComboBox->addItem( tr( "Clip to MinMax" ), 3 );
45+
}
2346
}
2447

2548
QgsSingleBandGrayRendererWidget::~QgsSingleBandGrayRendererWidget()

0 commit comments

Comments
 (0)