38 connect(
mMinMaxWidget, SIGNAL( load(
int,
double,
double,
int ) ),
39 this, SLOT(
loadMinMax(
int,
double,
double,
int ) ) );
41 connect( mRedBandComboBox, SIGNAL( currentIndexChanged(
int ) ),
43 connect( mGreenBandComboBox, SIGNAL( currentIndexChanged(
int ) ),
45 connect( mBlueBandComboBox, SIGNAL( currentIndexChanged(
int ) ),
49 mRedBandComboBox->addItem(
tr(
"Not set" ), -1 );
50 mGreenBandComboBox->addItem(
tr(
"Not set" ), -1 );
51 mBlueBandComboBox->addItem(
tr(
"Not set" ), -1 );
54 mContrastEnhancementAlgorithmComboBox->addItem(
tr(
"No enhancement" ), 0 );
55 mContrastEnhancementAlgorithmComboBox->addItem(
tr(
"Stretch to MinMax" ), 1 );
56 mContrastEnhancementAlgorithmComboBox->addItem(
tr(
"Stretch and clip to MinMax" ), 2 );
57 mContrastEnhancementAlgorithmComboBox->addItem(
tr(
"Clip to MinMax" ), 3 );
60 for (
int i = 1; i <= nBands; ++i )
63 mRedBandComboBox->addItem( bandName, i );
64 mGreenBandComboBox->addItem( bandName, i );
65 mBlueBandComboBox->addItem( bandName, i );
89 int redBand = mRedBandComboBox->itemData( mRedBandComboBox->currentIndex() ).toInt();
90 int greenBand = mGreenBandComboBox->itemData( mGreenBandComboBox->currentIndex() ).toInt();
91 int blueBand = mBlueBandComboBox->itemData( mBlueBandComboBox->currentIndex() ).toInt();
100 mRedMinLineEdit->setValidator(
new QDoubleValidator( mRedMinLineEdit ) );
101 mRedMaxLineEdit->setValidator(
new QDoubleValidator( mRedMinLineEdit ) );
102 mGreenMinLineEdit->setValidator(
new QDoubleValidator( mGreenMinLineEdit ) );
103 mGreenMaxLineEdit->setValidator(
new QDoubleValidator( mGreenMinLineEdit ) );
104 mBlueMinLineEdit->setValidator(
new QDoubleValidator( mBlueMinLineEdit ) );
105 mBlueMaxLineEdit->setValidator(
new QDoubleValidator( mBlueMinLineEdit ) );
110 int redBand,
int greenBand,
int blueBand )
112 if ( !r || !provider )
117 if ( mContrastEnhancementAlgorithmComboBox->itemData( mContrastEnhancementAlgorithmComboBox->currentIndex() ).toInt() ==
130 bool redMinOk, redMaxOk;
131 double redMin = mRedMinLineEdit->text().toDouble( &redMinOk );
132 double redMax = mRedMaxLineEdit->text().toDouble( &redMaxOk );
133 if ( redMinOk && redMaxOk )
141 bool greenMinOk, greenMaxOk;
142 double greenMin = mGreenMinLineEdit->text().toDouble( &greenMinOk );
143 double greenMax = mGreenMaxLineEdit->text().toDouble( &greenMaxOk );
144 if ( greenMinOk && greenMaxOk )
147 provider->
dataType( greenBand ) ) );
152 bool blueMinOk, blueMaxOk;
153 double blueMin = mBlueMinLineEdit->text().toDouble( &blueMinOk );
154 double blueMax = mBlueMaxLineEdit->text().toDouble( &blueMaxOk );
155 if ( blueMinOk && blueMaxOk )
163 if ( redEnhancement )
166 ( mContrastEnhancementAlgorithmComboBox->itemData( mContrastEnhancementAlgorithmComboBox->currentIndex() ).toInt() ) );
168 if ( greenEnhancement )
171 ( mContrastEnhancementAlgorithmComboBox->itemData( mContrastEnhancementAlgorithmComboBox->currentIndex() ).toInt() ) );
173 if ( blueEnhancement )
176 ( mContrastEnhancementAlgorithmComboBox->itemData( mContrastEnhancementAlgorithmComboBox->currentIndex() ).toInt() ) );
188 myBands.append( mRedBandComboBox->itemData( mRedBandComboBox->currentIndex() ).toInt() );
189 myBands.append( mGreenBandComboBox->itemData( mGreenBandComboBox->currentIndex() ).toInt() );
190 myBands.append( mBlueBandComboBox->itemData( mBlueBandComboBox->currentIndex() ).toInt() );
196 Q_UNUSED( theOrigin );
197 QgsDebugMsg( QString(
"theBandNo = %1 theMin = %2 theMax = %3" ).arg( theBandNo ).arg( theMin ).arg( theMax ) );
199 QLineEdit *myMinLineEdit, *myMaxLineEdit;
201 if ( mRedBandComboBox->itemData( mRedBandComboBox->currentIndex() ).toInt() == theBandNo )
203 myMinLineEdit = mRedMinLineEdit;
204 myMaxLineEdit = mRedMaxLineEdit;
206 else if ( mGreenBandComboBox->itemData( mGreenBandComboBox->currentIndex() ).toInt() == theBandNo )
208 myMinLineEdit = mGreenMinLineEdit;
209 myMaxLineEdit = mGreenMaxLineEdit;
211 else if ( mBlueBandComboBox->itemData( mBlueBandComboBox->currentIndex() ).toInt() == theBandNo )
213 myMinLineEdit = mBlueMinLineEdit;
214 myMaxLineEdit = mBlueMaxLineEdit;
222 if ( qIsNaN( theMin ) )
224 myMinLineEdit->clear();
228 myMinLineEdit->setText( QString::number( theMin ) );
231 if ( qIsNaN( theMax ) )
233 myMaxLineEdit->clear();
237 myMaxLineEdit->setText( QString::number( theMax ) );
243 if ( !minEdit || !maxEdit )
255 minEdit->setText( QString::number( ce->
minimumValue() ) );
256 maxEdit->setText( QString::number( ce->
maximumValue() ) );
260 mContrastEnhancementAlgorithmComboBox->setCurrentIndex( mContrastEnhancementAlgorithmComboBox->findData(
269 mRedBandComboBox->setCurrentIndex( mRedBandComboBox->findData( mbcr->
redBand() ) );
270 mGreenBandComboBox->setCurrentIndex( mGreenBandComboBox->findData( mbcr->
greenBand() ) );
271 mBlueBandComboBox->setCurrentIndex( mBlueBandComboBox->findData( mbcr->
blueBand() ) );
279 mRedBandComboBox->setCurrentIndex( mRedBandComboBox->findText(
tr(
"Red" ) ) );
280 mGreenBandComboBox->setCurrentIndex( mGreenBandComboBox->findText(
tr(
"Green" ) ) );
281 mBlueBandComboBox->setCurrentIndex( mBlueBandComboBox->findText(
tr(
"Blue" ) ) );
290 return mRedMinLineEdit->text();
293 return mGreenMinLineEdit->text();
296 return mBlueMinLineEdit->text();
309 return mRedMaxLineEdit->text();
312 return mGreenMaxLineEdit->text();
315 return mBlueMaxLineEdit->text();
328 mRedMinLineEdit->setText( value );
331 mGreenMinLineEdit->setText( value );
334 mBlueMinLineEdit->setText( value );
346 mRedMaxLineEdit->setText( value );
349 mGreenMaxLineEdit->setText( value );
352 mBlueMaxLineEdit->setText( value );
364 return mRedBandComboBox->currentIndex();
367 return mGreenBandComboBox->currentIndex();
370 return mBlueBandComboBox->currentIndex();