17
17
#include < QSizeF>
18
18
19
19
#include " qgsgeorefconfigdialog.h"
20
+ #include " qgis.h"
20
21
21
22
QgsGeorefConfigDialog::QgsGeorefConfigDialog ( QWidget *parent ) :
22
23
QDialog( parent )
@@ -26,8 +27,6 @@ QgsGeorefConfigDialog::QgsGeorefConfigDialog( QWidget *parent ) :
26
27
QSettings s;
27
28
restoreGeometry ( s.value ( " /Plugin-GeoReferencer/ConfigWindow/geometry" ).toByteArray () );
28
29
29
- readSettings ();
30
-
31
30
mPaperSizeComboBox ->addItem ( tr ( " A5 (148x210 mm)" ), QSizeF ( 148 , 210 ) );
32
31
mPaperSizeComboBox ->addItem ( tr ( " A4 (210x297 mm)" ), QSizeF ( 210 , 297 ) );
33
32
mPaperSizeComboBox ->addItem ( tr ( " A3 (297x420 mm)" ), QSizeF ( 297 , 420 ) );
@@ -54,8 +53,7 @@ QgsGeorefConfigDialog::QgsGeorefConfigDialog( QWidget *parent ) :
54
53
mPaperSizeComboBox ->addItem ( tr ( " Arch E (36x48 inches)" ), QSizeF ( 914.4 , 1219.2 ) );
55
54
mPaperSizeComboBox ->addItem ( tr ( " Arch E1 (30x42 inches)" ), QSizeF ( 762 , 1066.8 ) );
56
55
57
- mPaperSizeComboBox ->setCurrentIndex ( 2 ); // A3
58
-
56
+ readSettings ();
59
57
}
60
58
61
59
QgsGeorefConfigDialog::~QgsGeorefConfigDialog ()
@@ -129,6 +127,22 @@ void QgsGeorefConfigDialog::readSettings()
129
127
130
128
mLeftMarginSpinBox ->setValue ( s.value ( " /Plugin-GeoReferencer/Config/LeftMarginPDF" , " 2.0" ).toDouble () );
131
129
mRightMarginSpinBox ->setValue ( s.value ( " /Plugin-GeoReferencer/Config/RightMarginPDF" , " 2.0" ).toDouble () );
130
+
131
+ double currentWidth = s.value ( " /Plugin-GeoReferencer/Config/WidthPDFMap" , " 297" ).toDouble ();
132
+ double currentHeight = s.value ( " /Plugin-GeoReferencer/Config/HeightPDFMap" , " 420" ).toDouble ();
133
+
134
+ int paperIndex = 2 ; // default to A3
135
+ for ( int i = 0 ; i < mPaperSizeComboBox ->count (); ++i )
136
+ {
137
+ double itemWidth = mPaperSizeComboBox ->itemData ( i ).toSizeF ().width ();
138
+ double itemHeight = mPaperSizeComboBox ->itemData ( i ).toSizeF ().height ();
139
+ if ( qgsDoubleNear ( itemWidth, currentWidth ) && qgsDoubleNear ( itemHeight, currentHeight ) )
140
+ {
141
+ paperIndex = i;
142
+ break ;
143
+ }
144
+ }
145
+ mPaperSizeComboBox ->setCurrentIndex ( paperIndex );
132
146
}
133
147
134
148
void QgsGeorefConfigDialog::writeSettings ()
0 commit comments