Expose world file option in image settings dialog

This commit is contained in:
Nyall Dawson 2017-12-11 14:54:25 +10:00
parent 953d2c437d
commit 0f9aaf4c44
4 changed files with 35 additions and 2 deletions

View File

@ -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 ) )
{

View File

@ -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();

View File

@ -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

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>533</width>
<height>651</height>
<height>394</height>
</rect>
</property>
<property name="windowTitle">
@ -234,6 +234,16 @@
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="mGenerateWorldFile">
<property name="toolTip">
<string>If checked, a separate world file which georeferences exported images will be created</string>
</property>
<property name="text">
<string>Generate world file</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">