Skip to content

Commit

Permalink
Fill comboboxes in single band gray widget
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Mar 5, 2012
1 parent 8d415e5 commit 579ccb3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/gui/raster/qgssinglebandgrayrendererwidget.cpp
Expand Up @@ -16,10 +16,33 @@
***************************************************************************/

#include "qgssinglebandgrayrendererwidget.h"
#include "qgsrasterlayer.h"

QgsSingleBandGrayRendererWidget::QgsSingleBandGrayRendererWidget( QgsRasterLayer* layer ): QgsRasterRendererWidget( layer )
{
setupUi( this );

if ( mRasterLayer )
{
QgsRasterDataProvider* provider = mRasterLayer->dataProvider();
if ( !provider )
{
return;
}

//fill available bands into combo box
int nBands = provider->bandCount();
for ( int i = 1; i <= nBands; ++i ) //band numbering seem to start at 1
{
mGrayBandComboBox->addItem( provider->colorInterpretationName( i ), i );
}

//contrast enhancement algorithms
mContrastEnhancementComboBox->addItem( tr( "No enhancement" ), 0 );
mContrastEnhancementComboBox->addItem( tr( "Stretch to MinMax" ), 1 );
mContrastEnhancementComboBox->addItem( tr( "Stretch and clip to MinMax" ), 2 );
mContrastEnhancementComboBox->addItem( tr( "Clip to MinMax" ), 3 );
}
}

QgsSingleBandGrayRendererWidget::~QgsSingleBandGrayRendererWidget()
Expand Down

0 comments on commit 579ccb3

Please sign in to comment.