File tree 2 files changed +10
-14
lines changed
2 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -5804,14 +5804,6 @@ void QgisApp::saveMapAsImage()
5804
5804
QPair< QString, QString> myFileNameAndFilter = QgisGui::getSaveAsImageName ( this , tr ( " Choose a file name to save the map image as" ) );
5805
5805
if ( myFileNameAndFilter.first != QLatin1String ( " " ) )
5806
5806
{
5807
- QSize size = mMapCanvas ->size ();
5808
- if ( dlg.extent () != mMapCanvas ->extent () )
5809
- {
5810
- size.setWidth ( mMapCanvas ->size ().width () * dlg.extent ().width () / mMapCanvas ->extent ().width () );
5811
- size.setHeight ( mMapCanvas ->size ().height () * dlg.extent ().height () / mMapCanvas ->extent ().height () );
5812
- }
5813
- size *= dlg.dpi () / qt_defaultDpiX ();
5814
-
5815
5807
QgsMapSettings ms = QgsMapSettings ();
5816
5808
ms.setDestinationCrs ( QgsProject::instance ()->crs () );
5817
5809
ms.setExtent ( dlg.extent () );
Original file line number Diff line number Diff line change @@ -31,19 +31,23 @@ Q_GUI_EXPORT extern int qt_defaultDpiX();
31
31
32
32
QgsMapSaveDialog::QgsMapSaveDialog ( QWidget *parent, QgsMapCanvas *mapCanvas, const QString &activeDecorations )
33
33
: QDialog( parent )
34
- , mExtent( mapCanvas->mapSettings ().visibleExtent() )
35
- , mDpi( mapCanvas->mapSettings ().outputDpi() )
36
- , mSize( mapCanvas->mapSettings ().outputSize() )
37
34
{
38
35
setupUi ( this );
39
36
37
+ // Use unrotated visible extent to insure output size and scale matches canvas
38
+ QgsMapSettings ms = mapCanvas->mapSettings ();
39
+ ms.setRotation ( 0 );
40
+ mExtent = ms.visibleExtent ();
41
+ mDpi = ms.outputDpi ();
42
+ mSize = ms.outputSize ();
43
+
40
44
mResolutionSpinBox ->setValue ( qt_defaultDpiX () );
41
45
42
- mExtentGroupBox ->setOutputCrs ( mapCanvas-> mapSettings () .destinationCrs () );
43
- mExtentGroupBox ->setCurrentExtent ( mExtent , mapCanvas-> mapSettings () .destinationCrs () );
46
+ mExtentGroupBox ->setOutputCrs ( ms .destinationCrs () );
47
+ mExtentGroupBox ->setCurrentExtent ( mExtent , ms .destinationCrs () );
44
48
mExtentGroupBox ->setOutputExtentFromCurrent ();
45
49
46
- mScaleWidget ->setScale ( 1 / mapCanvas-> mapSettings () .scale () );
50
+ mScaleWidget ->setScale ( 1 / ms .scale () );
47
51
mScaleWidget ->setMapCanvas ( mapCanvas );
48
52
mScaleWidget ->setShowCurrentScaleButton ( true );
49
53
You can’t perform that action at this time.
0 commit comments