diff --git a/src/app/georeferencer/qgsgeorefmainwindow.cpp b/src/app/georeferencer/qgsgeorefmainwindow.cpp index a03fd0d0ec7..ef15e84cf76 100644 --- a/src/app/georeferencer/qgsgeorefmainwindow.cpp +++ b/src/app/georeferencer/qgsgeorefmainwindow.cpp @@ -78,7 +78,7 @@ const QgsSettingsEntryEnumFlag *QgsGeoreferencerMainWindow::settingResamplingMethod = new QgsSettingsEntryEnumFlag( QStringLiteral( "resampling-method" ), sTreeGeoreferencer, QgsImageWarper::ResamplingMethod::NearestNeighbour, QObject::tr( "Last used georeferencer resampling method" ) ); -const QgsSettingsEntryString *QgsGeoreferencerMainWindow::settingCompressionMethod = new QgsSettingsEntryString( QStringLiteral( "compression-method" ), sTreeGeoreferencer, QStringLiteral( "NONE" ), QObject::tr( "Last used georeferencer compression method" ) ); +const QgsSettingsEntryStringList *QgsGeoreferencerMainWindow::settingCreationOptions = new QgsSettingsEntryStringList( QStringLiteral( "creation-options" ), sTreeGeoreferencer, QStringList(), QObject::tr( "Last used georeferencer raster creation options" ) ); const QgsSettingsEntryBool *QgsGeoreferencerMainWindow::settingUseZeroForTransparent = new QgsSettingsEntryBool( QStringLiteral( "use-zero-for-transparent" ), sTreeGeoreferencer, false, QObject::tr( "Last used georeferencer use-zero-as-transparent option" ) ); @@ -454,7 +454,7 @@ bool QgsGeoreferencerMainWindow::showTransformSettingsDialog() d.setCreateWorldFileOnly( mCreateWorldFileOnly ); d.setTransformMethod( mTransformMethod ); d.setResamplingMethod( mResamplingMethod ); - d.setCompressionMethod( mCompressionMethod ); + d.setCreationOptions( mCreationOptions.join( ' ' ) ); d.setPdfMapFilename( mPdfOutputMapFile ); d.setPdfReportFilename( mPdfOutputFile ); d.setSaveGcpPoints( mSaveGcp ); @@ -472,7 +472,7 @@ bool QgsGeoreferencerMainWindow::showTransformSettingsDialog() mTargetCrs = d.targetCrs(); mTransformMethod = d.transformMethod(); mResamplingMethod = d.resamplingMethod(); - mCompressionMethod = d.compressionMethod(); + mCreationOptions = d.creationOptions(); mModifiedFileName = d.destinationFilename(); mPdfOutputMapFile = d.pdfMapFilename(); mPdfOutputFile = d.pdfReportFilename(); @@ -534,7 +534,7 @@ void QgsGeoreferencerMainWindow::generateGDALScript() int order = polynomialOrder( mTransformMethod ); if ( order != 0 ) { - gdalwarpCommand = generateGDALwarpCommand( resamplingStr, mCompressionMethod, mUseZeroForTrans, order, mUserResX, mUserResY ); + gdalwarpCommand = generateGDALwarpCommand( resamplingStr, mCreationOptions, mUseZeroForTrans, order, mUserResX, mUserResY ); showGDALScript( QStringList() << translateCommand << gdalwarpCommand ); } else @@ -1440,7 +1440,7 @@ void QgsGeoreferencerMainWindow::readSettings() // warp options mResamplingMethod = settingResamplingMethod->value(); - mCompressionMethod = settingCompressionMethod->value(); + mCreationOptions = settingCreationOptions->value(); mUseZeroForTrans = settingUseZeroForTransparent->value(); mTransformMethod = settingTransformMethod->value(); mSaveGcp = settingSaveGcps->value(); @@ -1455,7 +1455,7 @@ void QgsGeoreferencerMainWindow::writeSettings() settingTransformMethod->setValue( mTransformMethod ); settingResamplingMethod->setValue( mResamplingMethod ); - settingCompressionMethod->setValue( mCompressionMethod ); + settingCreationOptions->setValue( mCreationOptions ); settingUseZeroForTransparent->setValue( mUseZeroForTrans ); settingSaveGcps->setValue( mSaveGcp ); settingLoadInProject->setValue( mLoadInQgis ); @@ -1597,7 +1597,7 @@ bool QgsGeoreferencerMainWindow::georeferenceRaster() mGeorefTransform, mResamplingMethod, mUseZeroForTrans, - mCompressionMethod, + mCreationOptions, mTargetCrs, mUserResX, mUserResY @@ -2267,7 +2267,7 @@ QString QgsGeoreferencerMainWindow::generateGDALogr2ogrCommand() const return gdalCommand.join( QLatin1Char( ' ' ) ); } -QString QgsGeoreferencerMainWindow::generateGDALwarpCommand( const QString &resampling, const QString &compress, bool useZeroForTrans, int order, double targetResX, double targetResY ) +QString QgsGeoreferencerMainWindow::generateGDALwarpCommand( const QString &resampling, const QStringList &options, bool useZeroForTrans, int order, double targetResX, double targetResY ) { QStringList gdalCommand; gdalCommand << QStringLiteral( "gdalwarp" ) << QStringLiteral( "-r" ) << resampling; @@ -2282,7 +2282,12 @@ QString QgsGeoreferencerMainWindow::generateGDALwarpCommand( const QString &resa // Otherwise, use thin plate spline interpolation gdalCommand << QStringLiteral( "-tps" ); } - gdalCommand << "-co COMPRESS=" + compress << ( useZeroForTrans ? "-dstalpha" : "" ); + + for ( const QString &option : options ) + { + gdalCommand << QStringLiteral( "-co %1" ).arg( option ); + } + gdalCommand << ( useZeroForTrans ? "-dstalpha" : "" ); if ( targetResX != 0.0 && targetResY != 0.0 ) { diff --git a/src/app/georeferencer/qgsgeorefmainwindow.h b/src/app/georeferencer/qgsgeorefmainwindow.h index fda7bee22a2..0998f2b5b58 100644 --- a/src/app/georeferencer/qgsgeorefmainwindow.h +++ b/src/app/georeferencer/qgsgeorefmainwindow.h @@ -52,6 +52,7 @@ class QgsMapLayer; class QgsScreenHelper; class QgsSettingsEntryBool; class QgsSettingsEntryString; +class QgsSettingsEntryStringList; template class QgsSettingsEntryEnumFlag; @@ -70,7 +71,7 @@ class APP_EXPORT QgsGeoreferencerMainWindow : public QMainWindow, private Ui::Qg static inline QgsSettingsTreeNode *sTreeGeoreferencer = QgsSettingsTree::sTreeApp->createChildNode( QStringLiteral( "georeferencer" ) ); static const QgsSettingsEntryEnumFlag *settingResamplingMethod; - static const QgsSettingsEntryString *settingCompressionMethod; + static const QgsSettingsEntryStringList *settingCreationOptions; static const QgsSettingsEntryBool *settingUseZeroForTransparent; static const QgsSettingsEntryEnumFlag *settingTransformMethod; static const QgsSettingsEntryBool *settingSaveGcps; @@ -208,7 +209,7 @@ class APP_EXPORT QgsGeoreferencerMainWindow : public QMainWindow, private Ui::Qg * For values in the range 1 to 3, the parameter "order" prescribes the degree of the interpolating polynomials to use, * a value of -1 indicates that thin plate spline interpolation should be used for warping. */ - QString generateGDALwarpCommand( const QString &resampling, const QString &compress, bool useZeroForTrans, int order, double targetResX, double targetResY ); + QString generateGDALwarpCommand( const QString &resampling, const QStringList &options, bool useZeroForTrans, int order, double targetResX, double targetResY ); // utils bool validate(); @@ -268,7 +269,7 @@ class APP_EXPORT QgsGeoreferencerMainWindow : public QMainWindow, private Ui::Qg QgsGcpTransformerInterface::TransformMethod mTransformMethod = QgsGcpTransformerInterface::TransformMethod::InvalidTransform; QgsImageWarper::ResamplingMethod mResamplingMethod; QgsGeorefTransform mGeorefTransform; - QString mCompressionMethod = QStringLiteral( "NONE" ); + QStringList mCreationOptions; bool mCreateWorldFileOnly = false; QgsGCPList mPoints; diff --git a/src/app/georeferencer/qgsimagewarper.cpp b/src/app/georeferencer/qgsimagewarper.cpp index a88c9dc5176..491c444b6b1 100644 --- a/src/app/georeferencer/qgsimagewarper.cpp +++ b/src/app/georeferencer/qgsimagewarper.cpp @@ -123,6 +123,72 @@ bool QgsImageWarper::createDestinationDataset( const QString &outputName, GDALDa return true; } +bool QgsImageWarper::createDestinationDataset( const QString &outputName, GDALDatasetH hSrcDS, gdal::dataset_unique_ptr &hDstDS, uint resX, uint resY, double *adfGeoTransform, bool useZeroAsTrans, const QStringList &options, const QgsCoordinateReferenceSystem &crs ) +{ + // create the output file + GDALDriverH driver = GDALGetDriverByName( "GTiff" ); + if ( !driver ) + { + return false; + } + char **papszOptions = nullptr; + for ( const QString &option : options ) + { + QStringList tokens = option.split( '=', Qt::SkipEmptyParts ); + papszOptions = CSLSetNameValue( papszOptions, tokens.at( 0 ).toUtf8().constData(), tokens.at( 1 ).toUtf8().constData() ); + } + hDstDS.reset( GDALCreate( driver, outputName.toUtf8().constData(), resX, resY, GDALGetRasterCount( hSrcDS ), GDALGetRasterDataType( GDALGetRasterBand( hSrcDS, 1 ) ), papszOptions ) ); + if ( !hDstDS ) + { + return false; + } + + if ( CE_None != GDALSetGeoTransform( hDstDS.get(), adfGeoTransform ) ) + { + return false; + } + + if ( crs.isValid() ) + { + OGRSpatialReference oTargetSRS; + oTargetSRS.importFromWkt( crs.toWkt( Qgis::CrsWktVariant::PreferredGdal ).toUtf8().data() ); + + char *wkt = nullptr; + const OGRErr err = oTargetSRS.exportToWkt( &wkt ); + if ( err != CE_None || GDALSetProjection( hDstDS.get(), wkt ) != CE_None ) + { + CPLFree( wkt ); + return false; + } + CPLFree( wkt ); + } + + for ( int i = 0; i < GDALGetRasterCount( hSrcDS ); ++i ) + { + GDALRasterBandH hSrcBand = GDALGetRasterBand( hSrcDS, i + 1 ); + GDALRasterBandH hDstBand = GDALGetRasterBand( hDstDS.get(), i + 1 ); + GDALColorTableH cTable = GDALGetRasterColorTable( hSrcBand ); + GDALSetRasterColorInterpretation( hDstBand, GDALGetRasterColorInterpretation( hSrcBand ) ); + if ( cTable ) + { + GDALSetRasterColorTable( hDstBand, cTable ); + } + + int success; + const double noData = GDALGetRasterNoDataValue( hSrcBand, &success ); + if ( success ) + { + GDALSetRasterNoDataValue( hDstBand, noData ); + } + else if ( useZeroAsTrans ) + { + GDALSetRasterNoDataValue( hDstBand, 0 ); + } + } + + return true; +} + QgsImageWarper::Result QgsImageWarper::warpFile( const QString &input, const QString &output, const QgsGeorefTransform &georefTransform, ResamplingMethod resampling, bool useZeroAsTrans, const QString &compression, const QgsCoordinateReferenceSystem &crs, QgsFeedback *feedback, double destResX, double destResY ) { if ( !georefTransform.parametersInitialized() ) @@ -208,6 +274,91 @@ QgsImageWarper::Result QgsImageWarper::warpFile( const QString &input, const QSt : QgsImageWarper::Result::WarpFailure; } +QgsImageWarper::Result QgsImageWarper::warpFile( const QString &input, const QString &output, const QgsGeorefTransform &georefTransform, ResamplingMethod resampling, bool useZeroAsTrans, const QStringList &options, const QgsCoordinateReferenceSystem &crs, QgsFeedback *feedback, double destResX, double destResY ) +{ + if ( !georefTransform.parametersInitialized() ) + return QgsImageWarper::Result::InvalidParameters; + + gdal::dataset_unique_ptr hSrcDS; + gdal::dataset_unique_ptr hDstDS; + gdal::warp_options_unique_ptr psWarpOptions; + if ( !openSrcDSAndGetWarpOpt( input, resampling, georefTransform.GDALTransformer(), hSrcDS, psWarpOptions ) ) + { + return QgsImageWarper::Result::SourceError; + } + + double adfGeoTransform[6]; + int destPixels, destLines; + CPLErr eErr = GDALSuggestedWarpOutput( hSrcDS.get(), georefTransform.GDALTransformer(), georefTransform.GDALTransformerArgs(), adfGeoTransform, &destPixels, &destLines ); + if ( eErr != CE_None ) + { + return QgsImageWarper::Result::TransformError; + } + + // If specified, override the suggested resolution with user values + if ( destResX != 0.0 || destResY != 0.0 ) + { + // If only one scale has been specified, fill in the other from the GDAL suggestion + if ( destResX == 0.0 ) + destResX = adfGeoTransform[1]; + if ( destResY == 0.0 ) + destResY = adfGeoTransform[5]; + + // Make sure user-specified coordinate system has canonical orientation + if ( destResX < 0.0 ) + destResX = -destResX; + if ( destResY > 0.0 ) + destResY = -destResY; + + // Assert that the north-up convention is fulfilled by GDALSuggestedWarpOutput (should always be the case) + // Asserts are bad as they just crash out, changed to just return false. TS + if ( adfGeoTransform[0] <= 0.0 || adfGeoTransform[5] >= 0.0 ) + { + QgsDebugError( QStringLiteral( "Image is not north up after GDALSuggestedWarpOutput, bailing out." ) ); + return QgsImageWarper::Result::InvalidParameters; + } + // Find suggested output image extent (in georeferenced units) + const double minX = adfGeoTransform[0]; + const double maxX = adfGeoTransform[0] + adfGeoTransform[1] * destPixels; + const double maxY = adfGeoTransform[3]; + const double minY = adfGeoTransform[3] + adfGeoTransform[5] * destLines; + + // Update line and pixel count to match extent at user-specified resolution + destPixels = ( int ) ( ( ( maxX - minX ) / destResX ) + 0.5 ); + destLines = ( int ) ( ( ( minY - maxY ) / destResY ) + 0.5 ); + adfGeoTransform[0] = minX; + adfGeoTransform[3] = maxY; + adfGeoTransform[1] = destResX; + adfGeoTransform[5] = destResY; + } + + if ( !createDestinationDataset( output, hSrcDS.get(), hDstDS, destPixels, destLines, adfGeoTransform, useZeroAsTrans, options, crs ) ) + { + return QgsImageWarper::Result::DestinationCreationError; + } + + // Set GDAL callbacks for the progress dialog + psWarpOptions->pProgressArg = reinterpret_cast( feedback ); + psWarpOptions->pfnProgress = updateWarpProgress; + + psWarpOptions->hSrcDS = hSrcDS.get(); + psWarpOptions->hDstDS = hDstDS.get(); + + // Create a transformer which transforms from source to destination pixels (and vice versa) + psWarpOptions->pfnTransformer = GeoToPixelTransform; + psWarpOptions->pTransformerArg = addGeoToPixelTransform( georefTransform.GDALTransformer(), georefTransform.GDALTransformerArgs(), adfGeoTransform ); + + // Initialize and execute the warp operation. + GDALWarpOperation oOperation; + oOperation.Initialize( psWarpOptions.get() ); + + eErr = oOperation.ChunkAndWarpImage( 0, 0, destPixels, destLines ); + + destroyGeoToPixelTransform( psWarpOptions->pTransformerArg ); + return feedback->isCanceled() ? QgsImageWarper::Result::Canceled : eErr == CE_None ? QgsImageWarper::Result::Success + : QgsImageWarper::Result::WarpFailure; +} + void *QgsImageWarper::addGeoToPixelTransform( GDALTransformerFunc GDALTransformer, void *GDALTransformerArg, double *padfGeotransform ) const { TransformChain *chain = new TransformChain; @@ -311,14 +462,14 @@ GDALResampleAlg QgsImageWarper::toGDALResampleAlg( const QgsImageWarper::Resampl // QgsImageWarperTask // -QgsImageWarperTask::QgsImageWarperTask( const QString &input, const QString &output, const QgsGeorefTransform &georefTransform, QgsImageWarper::ResamplingMethod resampling, bool useZeroAsTrans, const QString &compression, const QgsCoordinateReferenceSystem &crs, double destResX, double destResY ) +QgsImageWarperTask::QgsImageWarperTask( const QString &input, const QString &output, const QgsGeorefTransform &georefTransform, QgsImageWarper::ResamplingMethod resampling, bool useZeroAsTrans, const QStringList &options, const QgsCoordinateReferenceSystem &crs, double destResX, double destResY ) : QgsTask( tr( "Warping %1" ).arg( input ), QgsTask::CanCancel ) , mInput( input ) , mOutput( output ) , mTransform( qgis::down_cast( georefTransform.clone() ) ) , mResamplingMethod( resampling ) , mUseZeroAsTrans( useZeroAsTrans ) - , mCompression( compression ) + , mCreationOptions( options ) , mDestinationCrs( crs ) , mDestinationResX( destResX ) , mDestinationResY( destResY ) @@ -345,7 +496,7 @@ bool QgsImageWarperTask::run() *mTransform.get(), mResamplingMethod, mUseZeroAsTrans, - mCompression, + mCreationOptions, mDestinationCrs, mFeedback.get(), mDestinationResX, diff --git a/src/app/georeferencer/qgsimagewarper.h b/src/app/georeferencer/qgsimagewarper.h index 398a7cbbd52..12627ee4716 100644 --- a/src/app/georeferencer/qgsimagewarper.h +++ b/src/app/georeferencer/qgsimagewarper.h @@ -76,6 +76,23 @@ class APP_EXPORT QgsImageWarper */ Result warpFile( const QString &input, const QString &output, const QgsGeorefTransform &georefTransform, ResamplingMethod resampling, bool useZeroAsTrans, const QString &compression, const QgsCoordinateReferenceSystem &crs, QgsFeedback *feedback, double destResX = 0.0, double destResY = 0.0 ); + /** + * Warp the file specified by \a input and write the resulting raster to the file \a output. + * \param input input file name + * \param output output file name + * \param georefTransform specifies the warp transformation which should be applied to \a input. + * \param resampling specifies image resampling algorithm to use. + * \param useZeroAsTrans specifies whether to mark transparent areas with a value of "zero". + * \param options raster creation options + * \param crs output file CRS + * \param feedback optional feedback object + * \param destResX The desired horizontal resolution of the output file, in target georeferenced units. A value of zero means automatic selection. + * \param destResY The desired vertical resolution of the output file, in target georeferenced units. A value of zero means automatic selection. + * + * \since QGIS 3.42 + */ + Result warpFile( const QString &input, const QString &output, const QgsGeorefTransform &georefTransform, ResamplingMethod resampling, bool useZeroAsTrans, const QStringList &options, const QgsCoordinateReferenceSystem &crs, QgsFeedback *feedback, double destResX = 0.0, double destResY = 0.0 ); + private: struct TransformChain { @@ -102,6 +119,7 @@ class APP_EXPORT QgsImageWarper bool openSrcDSAndGetWarpOpt( const QString &input, ResamplingMethod resampling, const GDALTransformerFunc &pfnTransform, gdal::dataset_unique_ptr &hSrcDS, gdal::warp_options_unique_ptr &psWarpOptions ) const; bool createDestinationDataset( const QString &outputName, GDALDatasetH hSrcDS, gdal::dataset_unique_ptr &hDstDS, uint resX, uint resY, double *adfGeoTransform, bool useZeroAsTrans, const QString &compression, const QgsCoordinateReferenceSystem &crs ); + bool createDestinationDataset( const QString &outputName, GDALDatasetH hSrcDS, gdal::dataset_unique_ptr &hDstDS, uint resX, uint resY, double *adfGeoTransform, bool useZeroAsTrans, const QStringList &options, const QgsCoordinateReferenceSystem &crs ); //! \brief GDAL progress callback, used to display warping progress via a QProgressDialog static int CPL_STDCALL updateWarpProgress( double dfComplete, const char *pszMessage, void *pProgressArg ); @@ -123,12 +141,12 @@ class QgsImageWarperTask : public QgsTask * \param georefTransform specifies the warp transformation which should be applied to \a input. * \param resampling specifies image resampling algorithm to use. * \param useZeroAsTrans specifies whether to mark transparent areas with a value of "zero". - * \param compression image compression method + * \param options raster creation options * \param crs output file CRS * \param destResX The desired horizontal resolution of the output file, in target georeferenced units. A value of zero means automatic selection. * \param destResY The desired vertical resolution of the output file, in target georeferenced units. A value of zero means automatic selection. */ - QgsImageWarperTask( const QString &input, const QString &output, const QgsGeorefTransform &georefTransform, QgsImageWarper::ResamplingMethod resampling, bool useZeroAsTrans, const QString &compression, const QgsCoordinateReferenceSystem &crs, double destResX = 0.0, double destResY = 0.0 ); + QgsImageWarperTask( const QString &input, const QString &output, const QgsGeorefTransform &georefTransform, QgsImageWarper::ResamplingMethod resampling, bool useZeroAsTrans, const QStringList &options, const QgsCoordinateReferenceSystem &crs, double destResX = 0.0, double destResY = 0.0 ); void cancel() override; @@ -146,7 +164,7 @@ class QgsImageWarperTask : public QgsTask std::unique_ptr mTransform; QgsImageWarper::ResamplingMethod mResamplingMethod = QgsImageWarper::ResamplingMethod::Bilinear; bool mUseZeroAsTrans = false; - QString mCompression; + QStringList mCreationOptions; QgsCoordinateReferenceSystem mDestinationCrs; double mDestinationResX = 0; double mDestinationResY = 0; diff --git a/src/app/georeferencer/qgstransformsettingsdialog.cpp b/src/app/georeferencer/qgstransformsettingsdialog.cpp index 56fad3d9f11..3b1620f5ab3 100644 --- a/src/app/georeferencer/qgstransformsettingsdialog.cpp +++ b/src/app/georeferencer/qgstransformsettingsdialog.cpp @@ -108,11 +108,7 @@ QgsTransformSettingsDialog::QgsTransformSettingsDialog( Qgis::LayerType type, co cmbTransformType->addItem( tr( "Thin Plate Spline" ), static_cast( QgsGcpTransformerInterface::TransformMethod::ThinPlateSpline ) ); cmbTransformType->addItem( tr( "Projective" ), static_cast( QgsGcpTransformerInterface::TransformMethod::Projective ) ); - // Populate CompressionComboBox - cmbCompressionComboBox->addItem( tr( "None" ), QStringLiteral( "None" ) ); - cmbCompressionComboBox->addItem( tr( "LZW" ), QStringLiteral( "LZW" ) ); - cmbCompressionComboBox->addItem( tr( "PACKBITS" ), QStringLiteral( "PACKBITS" ) ); - cmbCompressionComboBox->addItem( tr( "DEFLATE" ), QStringLiteral( "DEFLATE" ) ); + mCreationOptionsWidget->setFormat( "GTiff" ); cmbResampling->addItem( tr( "Nearest Neighbour" ), static_cast( QgsImageWarper::ResamplingMethod::NearestNeighbour ) ); cmbResampling->addItem( tr( "Bilinear (2x2 Kernel)" ), static_cast( QgsImageWarper::ResamplingMethod::Bilinear ) ); @@ -170,14 +166,14 @@ void QgsTransformSettingsDialog::setResamplingMethod( QgsImageWarper::Resampling cmbResampling->setCurrentIndex( cmbResampling->findData( static_cast( method ) ) ); } -QString QgsTransformSettingsDialog::compressionMethod() const +QStringList QgsTransformSettingsDialog::creationOptions() const { - return cmbCompressionComboBox->currentData().toString(); + return mCreationOptionsGroupBox->isChecked() ? mCreationOptionsWidget->options() : QStringList(); } -void QgsTransformSettingsDialog::setCompressionMethod( const QString &method ) +void QgsTransformSettingsDialog::setCreationOptions( const QString &options ) { - cmbCompressionComboBox->setCurrentIndex( cmbCompressionComboBox->findData( method ) ); + mCreationOptionsWidget->setOptions( options ); } QString QgsTransformSettingsDialog::destinationFilename() const @@ -280,6 +276,13 @@ void QgsTransformSettingsDialog::accept() outputFile->setFilePath( outputFileInfo.absoluteFilePath() ); } + const QString message = mCreationOptionsWidget->validateOptions( false ); + if ( !message.isNull() ) + { + QMessageBox::warning( this, tr( "Creation Options" ), tr( "Invalid creation options:\n%1" ).arg( message ) ); + return; + } + QDialog::accept(); } diff --git a/src/app/georeferencer/qgstransformsettingsdialog.h b/src/app/georeferencer/qgstransformsettingsdialog.h index bfa183e5c92..08c80b817f3 100644 --- a/src/app/georeferencer/qgstransformsettingsdialog.h +++ b/src/app/georeferencer/qgstransformsettingsdialog.h @@ -73,14 +73,14 @@ class QgsTransformSettingsDialog : public QDialog, private Ui::QgsTransformSetti void setResamplingMethod( QgsImageWarper::ResamplingMethod method ); /** - * Returns the selected compression method. + * Returns raster creation options. */ - QString compressionMethod() const; + QStringList creationOptions() const; /** - * Sets the selected compression \a method. + * Sets raster creation options. */ - void setCompressionMethod( const QString &method ); + void setCreationOptions( const QString &options ); /** * Returns the destination filename. diff --git a/src/ui/georeferencer/qgstransformsettingsdialogbase.ui b/src/ui/georeferencer/qgstransformsettingsdialogbase.ui index 73021c397dc..941522fc74b 100644 --- a/src/ui/georeferencer/qgstransformsettingsdialogbase.ui +++ b/src/ui/georeferencer/qgstransformsettingsdialogbase.ui @@ -7,7 +7,7 @@ 0 0 438 - 702 + 646 @@ -17,10 +17,10 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok + QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Help|QDialogButtonBox::StandardButton::Ok @@ -49,42 +49,6 @@ 0 - - - - - 0 - 0 - - - - Compression - - - cmbCompressionComboBox - - - - - - - Use 0 for transparency when needed - - - false - - - - - - - - 0 - 0 - - - - @@ -98,9 +62,6 @@ - - - @@ -108,6 +69,22 @@ + + + + + 0 + 0 + + + + Resampling method + + + cmbResampling + + + @@ -175,22 +152,34 @@ - - - - - 0 - 0 - - + + - Resampling method + Use 0 for transparency when needed - - cmbResampling + + false + + + + + + + Raster creation options + + + true + + + + + + + + @@ -250,12 +239,6 @@ Reports - - - - - - @@ -270,6 +253,12 @@ + + + + + + @@ -318,7 +307,7 @@ - Qt::StrongFocus + Qt::FocusPolicy::StrongFocus @@ -328,7 +317,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -365,12 +354,23 @@ QDoubleSpinBox
georeferencer/qgsvalidateddoublespinbox.h
+ + QgsRasterFormatSaveOptionsWidget + QWidget +
qgsrasterformatsaveoptionswidget.h
+ 1 +
+ + QgsCollapsibleGroupBox + QGroupBox +
qgscollapsiblegroupbox.h
+ 1 +
cmbTransformType mCrsSelector cmbResampling - cmbCompressionComboBox mWorldFileCheckBox cbxZeroAsTrans cbxUserResolution