@@ -239,7 +239,7 @@ void QgsAlignRasterDialog::addLayer()
239
239
QgsAlignRaster::List list = mAlign ->rasters ();
240
240
241
241
QgsAlignRaster::Item item ( d.inputFilename (), d.outputFilename () );
242
- item.resampleMethod = ( QgsAlignRaster::ResampleAlg ) d.resampleMethod ();
242
+ item.resampleMethod = d.resampleMethod ();
243
243
item.rescaleValues = d.rescaleValues ();
244
244
list.append ( item );
245
245
@@ -276,7 +276,7 @@ void QgsAlignRasterDialog::editLayer()
276
276
return ;
277
277
278
278
QgsAlignRaster::Item itemNew ( d.inputFilename (), d.outputFilename () );
279
- itemNew.resampleMethod = ( QgsAlignRaster::ResampleAlg ) d.resampleMethod ();
279
+ itemNew.resampleMethod = d.resampleMethod ();
280
280
itemNew.rescaleValues = d.rescaleValues ();
281
281
list[current.row ()] = itemNew;
282
282
mAlign ->setRasters ( list );
@@ -386,11 +386,20 @@ QgsAlignRasterLayerConfigDialog::QgsAlignRasterLayerConfigDialog()
386
386
cboLayers->setFilters ( QgsMapLayerProxyModel::RasterLayer );
387
387
388
388
cboResample = new QComboBox ( this );
389
- QStringList methods;
390
- methods << tr ( " Nearest neighbour" ) << tr ( " Bilinear (2x2 kernel)" )
391
- << tr ( " Cubic (4x4 kernel)" ) << tr ( " Cubic B-Spline (4x4 kernel)" ) << tr ( " Lanczos (6x6 kernel)" )
392
- << tr ( " Average" ) << tr ( " Mode" );
393
- cboResample->addItems ( methods );
389
+ cboResample->addItem ( tr ( " Nearest neighbour" ), QgsAlignRaster::RA_NearestNeighbour );
390
+ cboResample->addItem ( tr ( " Bilinear (2x2 kernel)" ), QgsAlignRaster::RA_Bilinear );
391
+ cboResample->addItem ( tr ( " Cubic (4x4 kernel)" ), QgsAlignRaster::RA_Cubic );
392
+ cboResample->addItem ( tr ( " Cubic B-Spline (4x4 kernel)" ), QgsAlignRaster::RA_CubicSpline );
393
+ cboResample->addItem ( tr ( " Lanczos (6x6 kernel)" ), QgsAlignRaster::RA_Lanczos );
394
+ cboResample->addItem ( tr ( " Average" ), QgsAlignRaster::RA_Average );
395
+ cboResample->addItem ( tr ( " Mode" ), QgsAlignRaster::RA_Mode );
396
+ #if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 2000000
397
+ cboResample->addItem ( tr ( " Maximum" ), QgsAlignRaster::RA_Max );
398
+ cboResample->addItem ( tr ( " Minimum" ), QgsAlignRaster::RA_Min );
399
+ cboResample->addItem ( tr ( " Median" ), QgsAlignRaster::RA_Median );
400
+ cboResample->addItem ( tr ( " First Quartile (Q1)" ), QgsAlignRaster::RA_Q1 );
401
+ cboResample->addItem ( tr ( " Third Quartile (Q3)" ), QgsAlignRaster::RA_Q3 );
402
+ #endif
394
403
395
404
editOutput = new QLineEdit ( this );
396
405
btnBrowse = new QPushButton ( tr ( " Browse..." ), this );
@@ -428,9 +437,9 @@ QString QgsAlignRasterLayerConfigDialog::outputFilename() const
428
437
return editOutput->text ();
429
438
}
430
439
431
- int QgsAlignRasterLayerConfigDialog::resampleMethod () const
440
+ QgsAlignRaster::ResampleAlg QgsAlignRasterLayerConfigDialog::resampleMethod () const
432
441
{
433
- return cboResample->currentIndex ();
442
+ return static_cast < QgsAlignRaster::ResampleAlg >( cboResample->itemData ( cboResample-> currentIndex () ). toInt () );
434
443
}
435
444
436
445
bool QgsAlignRasterLayerConfigDialog::rescaleValues () const
@@ -439,11 +448,11 @@ bool QgsAlignRasterLayerConfigDialog::rescaleValues() const
439
448
}
440
449
441
450
void QgsAlignRasterLayerConfigDialog::setItem ( const QString& inputFilename, const QString& outputFilename,
442
- int resampleMethod, bool rescaleValues )
451
+ QgsAlignRaster::ResampleAlg resampleMethod, bool rescaleValues )
443
452
{
444
453
cboLayers->setLayer ( _rasterLayer ( inputFilename ) );
445
454
editOutput->setText ( outputFilename );
446
- cboResample->setCurrentIndex ( resampleMethod );
455
+ cboResample->setCurrentIndex ( cboResample-> findData ( resampleMethod ) );
447
456
chkRescale->setChecked ( rescaleValues );
448
457
}
449
458
0 commit comments