Skip to content

Commit 049436e

Browse files
committed
[georef] Modernise georeferencer UI
- Standardise capitalisation and formatting of strings - Remove use of old style icons - Use QgsDoubleSpinBox and QgsProjectionSelectionWidgets - Rework dialogs for usability
1 parent d3df4ed commit 049436e

10 files changed

+411
-372
lines changed

src/plugins/georeferencer/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ INCLUDE_DIRECTORIES(
7575
${CMAKE_CURRENT_SOURCE_DIR}
7676
${CMAKE_CURRENT_BINARY_DIR}
7777
../../core ../../core/geometry ../../core/raster ../../core/composer
78-
../../gui
78+
../../gui ../../gui/editorwidgets
7979
..
8080
${GSL_INCLUDE_DIR}
8181
${QGIS_INCLUDE_DIR}

src/plugins/georeferencer/qgsgeorefconfigdialogbase.ui

+41-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<x>0</x>
88
<y>0</y>
99
<width>309</width>
10-
<height>468</height>
10+
<height>443</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -30,7 +30,7 @@
3030
<item row="1" column="0">
3131
<widget class="QCheckBox" name="mShowCoordsCheckBox">
3232
<property name="text">
33-
<string>Show coords</string>
33+
<string>Show coordinates</string>
3434
</property>
3535
</widget>
3636
</item>
@@ -76,13 +76,16 @@
7676
</widget>
7777
</item>
7878
<item>
79-
<widget class="QDoubleSpinBox" name="mLeftMarginSpinBox">
79+
<widget class="QgsDoubleSpinBox" name="mLeftMarginSpinBox">
8080
<property name="prefix">
8181
<string/>
8282
</property>
8383
<property name="suffix">
8484
<string> mm</string>
8585
</property>
86+
<property name="showClearButton" stdset="0">
87+
<bool>true</bool>
88+
</property>
8689
</widget>
8790
</item>
8891
</layout>
@@ -97,10 +100,13 @@
97100
</widget>
98101
</item>
99102
<item>
100-
<widget class="QDoubleSpinBox" name="mRightMarginSpinBox">
103+
<widget class="QgsDoubleSpinBox" name="mRightMarginSpinBox">
101104
<property name="suffix">
102105
<string> mm</string>
103106
</property>
107+
<property name="showClearButton" stdset="0">
108+
<bool>true</bool>
109+
</property>
104110
</widget>
105111
</item>
106112
</layout>
@@ -115,7 +121,7 @@
115121
</property>
116122
</widget>
117123
</item>
118-
<item row="5" column="0">
124+
<item row="6" column="0">
119125
<widget class="QDialogButtonBox" name="buttonBox">
120126
<property name="orientation">
121127
<enum>Qt::Horizontal</enum>
@@ -148,8 +154,38 @@
148154
</layout>
149155
</widget>
150156
</item>
157+
<item row="5" column="0">
158+
<spacer name="verticalSpacer">
159+
<property name="orientation">
160+
<enum>Qt::Vertical</enum>
161+
</property>
162+
<property name="sizeHint" stdset="0">
163+
<size>
164+
<width>20</width>
165+
<height>40</height>
166+
</size>
167+
</property>
168+
</spacer>
169+
</item>
151170
</layout>
152171
</widget>
172+
<customwidgets>
173+
<customwidget>
174+
<class>QgsDoubleSpinBox</class>
175+
<extends>QDoubleSpinBox</extends>
176+
<header location="global">qgsdoublespinbox.h</header>
177+
</customwidget>
178+
</customwidgets>
179+
<tabstops>
180+
<tabstop>mShowIDsCheckBox</tabstop>
181+
<tabstop>mShowCoordsCheckBox</tabstop>
182+
<tabstop>mPixelsButton</tabstop>
183+
<tabstop>mMapUnitsButton</tabstop>
184+
<tabstop>mLeftMarginSpinBox</tabstop>
185+
<tabstop>mRightMarginSpinBox</tabstop>
186+
<tabstop>mPaperSizeComboBox</tabstop>
187+
<tabstop>mShowDockedCheckBox</tabstop>
188+
</tabstops>
153189
<resources/>
154190
<connections/>
155191
</ui>

src/plugins/georeferencer/qgsgeorefplugingui.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "qgsgcplist.h"
2020
#include "qgsmapcoordsdialog.h"
2121
#include "qgsimagewarper.h"
22+
#include "qgscoordinatereferencesystem.h"
2223

2324
#include <QPointer>
2425

@@ -216,7 +217,7 @@ class QgsGeorefPluginGui : public QMainWindow, private Ui::QgsGeorefPluginGuiBas
216217
QString mWorldFileName;
217218
QString mTranslatedRasterFileName;
218219
QString mGCPpointsFileName;
219-
QString mProjection;
220+
QgsCoordinateReferenceSystem mProjection;
220221
QString mPdfOutputFile;
221222
QString mPdfOutputMapFile;
222223
double mUserResX, mUserResY; // User specified target scale

src/plugins/georeferencer/qgsgeorefpluginguibase.ui

+17-14
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179
</widget>
180180
<action name="mActionOpenRaster">
181181
<property name="text">
182-
<string>Open raster</string>
182+
<string>Open Raster...</string>
183183
</property>
184184
<property name="statusTip">
185185
<string>Open raster</string>
@@ -231,15 +231,15 @@
231231
</action>
232232
<action name="mActionTransformSettings">
233233
<property name="text">
234-
<string>Transformation settings</string>
234+
<string>Transformation Settings...</string>
235235
</property>
236236
<property name="statusTip">
237237
<string>Transformation settings</string>
238238
</property>
239239
</action>
240240
<action name="mActionAddPoint">
241241
<property name="text">
242-
<string>Add point</string>
242+
<string>Add Point</string>
243243
</property>
244244
<property name="statusTip">
245245
<string>Add point</string>
@@ -250,7 +250,7 @@
250250
</action>
251251
<action name="mActionDeletePoint">
252252
<property name="text">
253-
<string>Delete point</string>
253+
<string>Delete Point</string>
254254
</property>
255255
<property name="statusTip">
256256
<string>Delete point</string>
@@ -261,15 +261,18 @@
261261
</action>
262262
<action name="mActionQuit">
263263
<property name="text">
264-
<string>Quit</string>
264+
<string>Close Georeferencer</string>
265+
</property>
266+
<property name="toolTip">
267+
<string>Close georeferencer</string>
265268
</property>
266269
<property name="statusTip">
267270
<string>Quit</string>
268271
</property>
269272
</action>
270273
<action name="mActionStartGeoref">
271274
<property name="text">
272-
<string>Start georeferencing</string>
275+
<string>Start Georeferencing</string>
273276
</property>
274277
<property name="statusTip">
275278
<string>Start georeferencing</string>
@@ -280,7 +283,7 @@
280283
</action>
281284
<action name="mActionGDALScript">
282285
<property name="text">
283-
<string>Generate GDAL script</string>
286+
<string>Generate GDAL Script</string>
284287
</property>
285288
<property name="statusTip">
286289
<string>Generate GDAL script</string>
@@ -313,7 +316,7 @@
313316
</action>
314317
<action name="mActionSaveGCPpoints">
315318
<property name="text">
316-
<string>Save GCP points as...</string>
319+
<string>Save GCP Points as...</string>
317320
</property>
318321
<property name="statusTip">
319322
<string>Save GCP points as...</string>
@@ -324,7 +327,7 @@
324327
</action>
325328
<action name="mActionLoadGCPpoints">
326329
<property name="text">
327-
<string>Load GCP points</string>
330+
<string>Load GCP Points...</string>
328331
</property>
329332
<property name="statusTip">
330333
<string>Load GCP points</string>
@@ -335,20 +338,20 @@
335338
</action>
336339
<action name="mActionGeorefConfig">
337340
<property name="text">
338-
<string>Configure Georeferencer</string>
341+
<string>Configure Georeferencer...</string>
339342
</property>
340343
<property name="shortcut">
341344
<string>Ctrl+P</string>
342345
</property>
343346
</action>
344347
<action name="mActionRasterProperties">
345348
<property name="text">
346-
<string>Raster properties</string>
349+
<string>Raster Properties...</string>
347350
</property>
348351
</action>
349352
<action name="mActionMoveGCPPoint">
350353
<property name="text">
351-
<string>Move GCP point</string>
354+
<string>Move GCP Point</string>
352355
</property>
353356
<property name="statusTip">
354357
<string>Move GCP point</string>
@@ -366,12 +369,12 @@
366369
</action>
367370
<action name="mActionLocalHistogramStretch">
368371
<property name="text">
369-
<string>Local histogram stretch</string>
372+
<string>Local Histogram Stretch</string>
370373
</property>
371374
</action>
372375
<action name="mActionFullHistogramStretch">
373376
<property name="text">
374-
<string>Full histogram stretch</string>
377+
<string>Full Histogram Stretch</string>
375378
</property>
376379
</action>
377380
</widget>

src/plugins/georeferencer/qgsimagewarper.cpp

+7-16
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,9 @@ bool QgsImageWarper::openSrcDSAndGetWarpOpt( const QString &input, const Resampl
7272
return true;
7373
}
7474

75-
bool QgsImageWarper::createDestinationDataset(
76-
const QString &outputName, GDALDatasetH hSrcDS, GDALDatasetH &hDstDS,
77-
uint resX, uint resY, double *adfGeoTransform, bool useZeroAsTrans,
78-
const QString& compression, const QString &projection )
75+
bool QgsImageWarper::createDestinationDataset( const QString &outputName, GDALDatasetH hSrcDS, GDALDatasetH &hDstDS,
76+
uint resX, uint resY, double *adfGeoTransform, bool useZeroAsTrans,
77+
const QString& compression, const QgsCoordinateReferenceSystem& crs )
7978
{
8079
// create the output file
8180
GDALDriverH driver = GDALGetDriverByName( "GTiff" );
@@ -100,18 +99,10 @@ bool QgsImageWarper::createDestinationDataset(
10099
return false;
101100
}
102101

103-
if ( !projection.isEmpty() )
102+
if ( crs.isValid() )
104103
{
105104
OGRSpatialReference oTargetSRS;
106-
if ( projection.startsWith( "EPSG", Qt::CaseInsensitive ) )
107-
{
108-
QString epsg = projection.mid( projection.indexOf( ":" ) + 1 );
109-
oTargetSRS.importFromEPSG( epsg.toInt() );
110-
}
111-
else
112-
{
113-
oTargetSRS.importFromProj4( projection.toLatin1().data() );
114-
}
105+
oTargetSRS.importFromProj4( crs.toProj4().toLatin1().data() );
115106

116107
char *wkt = NULL;
117108
OGRErr err = oTargetSRS.exportToWkt( &wkt );
@@ -155,7 +146,7 @@ int QgsImageWarper::warpFile( const QString& input,
155146
ResamplingMethod resampling,
156147
bool useZeroAsTrans,
157148
const QString& compression,
158-
const QString &projection,
149+
const QgsCoordinateReferenceSystem& crs,
159150
double destResX, double destResY )
160151
{
161152
if ( !georefTransform.parametersInitialized() )
@@ -221,7 +212,7 @@ int QgsImageWarper::warpFile( const QString& input,
221212

222213
if ( !createDestinationDataset( output, hSrcDS, hDstDS, destPixels, destLines,
223214
adfGeoTransform, useZeroAsTrans, compression,
224-
projection ) )
215+
crs ) )
225216
{
226217
GDALClose( hSrcDS );
227218
GDALDestroyWarpOptions( psWarpOptions );

src/plugins/georeferencer/qgsimagewarper.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <gdalwarper.h>
2222
#include <vector>
2323
#include "qgspoint.h"
24+
#include "qgscoordinatereferencesystem.h"
2425

2526
class QgsGeorefTransform;
2627
class QProgressDialog;
@@ -56,7 +57,7 @@ class QgsImageWarper
5657
ResamplingMethod resampling,
5758
bool useZeroAsTrans,
5859
const QString& compression,
59-
const QString& projection,
60+
const QgsCoordinateReferenceSystem& crs,
6061
double destResX = 0.0, double destResY = 0.0 );
6162
private:
6263
struct TransformChain
@@ -87,7 +88,7 @@ class QgsImageWarper
8788
GDALWarpOptions *&psWarpOptions );
8889

8990
bool createDestinationDataset( const QString &outputName, GDALDatasetH hSrcDS, GDALDatasetH &hDstDS, uint resX, uint resY,
90-
double *adfGeoTransform, bool useZeroAsTrans, const QString& compression, const QString &projection );
91+
double *adfGeoTransform, bool useZeroAsTrans, const QString& compression, const QgsCoordinateReferenceSystem& crs );
9192

9293
QWidget *mParent;
9394
void *createWarpProgressArg( QProgressDialog *progressDialog ) const;

0 commit comments

Comments
 (0)