From 0f9aaf4c44b567ab68ffa202448c7f2bb86d27f9 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 11 Dec 2017 14:54:25 +1000 Subject: [PATCH] Expose world file option in image settings dialog --- src/app/layout/qgslayoutdesignerdialog.cpp | 3 ++- src/app/layout/qgslayoutimageexportoptionsdialog.cpp | 10 ++++++++++ src/app/layout/qgslayoutimageexportoptionsdialog.h | 12 ++++++++++++ src/ui/layout/qgslayoutimageexportoptions.ui | 12 +++++++++++- 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/app/layout/qgslayoutdesignerdialog.cpp b/src/app/layout/qgslayoutdesignerdialog.cpp index 6bde426765d..831a1d77089 100644 --- a/src/app/layout/qgslayoutdesignerdialog.cpp +++ b/src/app/layout/qgslayoutdesignerdialog.cpp @@ -1456,6 +1456,7 @@ void QgsLayoutDesignerDialog::exportToRaster() imageDlg.setResolution( dpi ); imageDlg.setCropToContents( cropToContents ); imageDlg.setCropMargins( marginTop, marginRight, marginBottom, marginLeft ); + imageDlg.setGenerateWorldFile( mLayout->customProperty( QStringLiteral( "exportWorldFile" ), false ).toBool() ); #if 0 //TODO QgsAtlasComposition *atlasMap = &mComposition->atlasComposition(); @@ -1505,7 +1506,7 @@ void QgsLayoutDesignerDialog::exportToRaster() { settings.imageSize = QSize( imageDlg.imageWidth(), imageDlg.imageHeight() ); } - settings.generateWorldFile = mLayout->customProperty( QStringLiteral( "exportWorldFile" ), false ).toBool(); + settings.generateWorldFile = imageDlg.generateWorldFile(); switch ( exporter.exportToImage( fileNExt.first, settings ) ) { diff --git a/src/app/layout/qgslayoutimageexportoptionsdialog.cpp b/src/app/layout/qgslayoutimageexportoptionsdialog.cpp index 40932229fb0..64f76159ca7 100644 --- a/src/app/layout/qgslayoutimageexportoptionsdialog.cpp +++ b/src/app/layout/qgslayoutimageexportoptionsdialog.cpp @@ -95,6 +95,16 @@ bool QgsLayoutImageExportOptionsDialog::cropToContents() const return mClipToContentGroupBox->isChecked(); } +void QgsLayoutImageExportOptionsDialog::setGenerateWorldFile( bool generate ) +{ + mGenerateWorldFile->setChecked( generate ); +} + +bool QgsLayoutImageExportOptionsDialog::generateWorldFile() const +{ + return mGenerateWorldFile->isChecked(); +} + void QgsLayoutImageExportOptionsDialog::getCropMargins( int &topMargin, int &rightMargin, int &bottomMargin, int &leftMargin ) const { topMargin = mTopMarginSpinBox->value(); diff --git a/src/app/layout/qgslayoutimageexportoptionsdialog.h b/src/app/layout/qgslayoutimageexportoptionsdialog.h index c7fb9b9904a..b24f8ee2ff1 100644 --- a/src/app/layout/qgslayoutimageexportoptionsdialog.h +++ b/src/app/layout/qgslayoutimageexportoptionsdialog.h @@ -84,6 +84,18 @@ class QgsLayoutImageExportOptionsDialog: public QDialog, private Ui::QgsLayoutIm */ bool cropToContents() const; + /** + * Sets whether the generate world file option should be checked. + * \see generateWorldFile() + */ + void setGenerateWorldFile( bool generate ); + + /** + * Returns whether the generate world file option is checked in the dialog. + * \see setGenerateWorldFile() + */ + bool generateWorldFile() const; + /** * Fetches the current crop to contents margin values, in pixels. * \param topMargin destination for top margin diff --git a/src/ui/layout/qgslayoutimageexportoptions.ui b/src/ui/layout/qgslayoutimageexportoptions.ui index 3165933c9d5..5267c0963d9 100644 --- a/src/ui/layout/qgslayoutimageexportoptions.ui +++ b/src/ui/layout/qgslayoutimageexportoptions.ui @@ -7,7 +7,7 @@ 0 0 533 - 651 + 394 @@ -234,6 +234,16 @@ + + + + If checked, a separate world file which georeferences exported images will be created + + + Generate world file + + +