Skip to content
Permalink
Browse files

[georef] Modernise georeferencer UI

- Standardise capitalisation and formatting of strings
- Remove use of old style icons
- Use QgsDoubleSpinBox and QgsProjectionSelectionWidgets
- Rework dialogs for usability
  • Loading branch information
nyalldawson committed Jun 16, 2015
1 parent d3df4ed commit 049436ef835a1b672d5055ae9652bd1e06b88267
@@ -75,7 +75,7 @@ INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
../../core ../../core/geometry ../../core/raster ../../core/composer
../../gui
../../gui ../../gui/editorwidgets
..
${GSL_INCLUDE_DIR}
${QGIS_INCLUDE_DIR}
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>309</width>
<height>468</height>
<height>443</height>
</rect>
</property>
<property name="windowTitle">
@@ -30,7 +30,7 @@
<item row="1" column="0">
<widget class="QCheckBox" name="mShowCoordsCheckBox">
<property name="text">
<string>Show coords</string>
<string>Show coordinates</string>
</property>
</widget>
</item>
@@ -76,13 +76,16 @@
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="mLeftMarginSpinBox">
<widget class="QgsDoubleSpinBox" name="mLeftMarginSpinBox">
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string> mm</string>
</property>
<property name="showClearButton" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
@@ -97,10 +100,13 @@
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="mRightMarginSpinBox">
<widget class="QgsDoubleSpinBox" name="mRightMarginSpinBox">
<property name="suffix">
<string> mm</string>
</property>
<property name="showClearButton" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
@@ -115,7 +121,7 @@
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -148,8 +154,38 @@
</layout>
</widget>
</item>
<item row="5" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QgsDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global">qgsdoublespinbox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>mShowIDsCheckBox</tabstop>
<tabstop>mShowCoordsCheckBox</tabstop>
<tabstop>mPixelsButton</tabstop>
<tabstop>mMapUnitsButton</tabstop>
<tabstop>mLeftMarginSpinBox</tabstop>
<tabstop>mRightMarginSpinBox</tabstop>
<tabstop>mPaperSizeComboBox</tabstop>
<tabstop>mShowDockedCheckBox</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
@@ -19,6 +19,7 @@
#include "qgsgcplist.h"
#include "qgsmapcoordsdialog.h"
#include "qgsimagewarper.h"
#include "qgscoordinatereferencesystem.h"

#include <QPointer>

@@ -216,7 +217,7 @@ class QgsGeorefPluginGui : public QMainWindow, private Ui::QgsGeorefPluginGuiBas
QString mWorldFileName;
QString mTranslatedRasterFileName;
QString mGCPpointsFileName;
QString mProjection;
QgsCoordinateReferenceSystem mProjection;
QString mPdfOutputFile;
QString mPdfOutputMapFile;
double mUserResX, mUserResY; // User specified target scale
@@ -179,7 +179,7 @@
</widget>
<action name="mActionOpenRaster">
<property name="text">
<string>Open raster</string>
<string>Open Raster...</string>
</property>
<property name="statusTip">
<string>Open raster</string>
@@ -231,15 +231,15 @@
</action>
<action name="mActionTransformSettings">
<property name="text">
<string>Transformation settings</string>
<string>Transformation Settings...</string>
</property>
<property name="statusTip">
<string>Transformation settings</string>
</property>
</action>
<action name="mActionAddPoint">
<property name="text">
<string>Add point</string>
<string>Add Point</string>
</property>
<property name="statusTip">
<string>Add point</string>
@@ -250,7 +250,7 @@
</action>
<action name="mActionDeletePoint">
<property name="text">
<string>Delete point</string>
<string>Delete Point</string>
</property>
<property name="statusTip">
<string>Delete point</string>
@@ -261,15 +261,18 @@
</action>
<action name="mActionQuit">
<property name="text">
<string>Quit</string>
<string>Close Georeferencer</string>
</property>
<property name="toolTip">
<string>Close georeferencer</string>
</property>
<property name="statusTip">
<string>Quit</string>
</property>
</action>
<action name="mActionStartGeoref">
<property name="text">
<string>Start georeferencing</string>
<string>Start Georeferencing</string>
</property>
<property name="statusTip">
<string>Start georeferencing</string>
@@ -280,7 +283,7 @@
</action>
<action name="mActionGDALScript">
<property name="text">
<string>Generate GDAL script</string>
<string>Generate GDAL Script</string>
</property>
<property name="statusTip">
<string>Generate GDAL script</string>
@@ -313,7 +316,7 @@
</action>
<action name="mActionSaveGCPpoints">
<property name="text">
<string>Save GCP points as...</string>
<string>Save GCP Points as...</string>
</property>
<property name="statusTip">
<string>Save GCP points as...</string>
@@ -324,7 +327,7 @@
</action>
<action name="mActionLoadGCPpoints">
<property name="text">
<string>Load GCP points</string>
<string>Load GCP Points...</string>
</property>
<property name="statusTip">
<string>Load GCP points</string>
@@ -335,20 +338,20 @@
</action>
<action name="mActionGeorefConfig">
<property name="text">
<string>Configure Georeferencer</string>
<string>Configure Georeferencer...</string>
</property>
<property name="shortcut">
<string>Ctrl+P</string>
</property>
</action>
<action name="mActionRasterProperties">
<property name="text">
<string>Raster properties</string>
<string>Raster Properties...</string>
</property>
</action>
<action name="mActionMoveGCPPoint">
<property name="text">
<string>Move GCP point</string>
<string>Move GCP Point</string>
</property>
<property name="statusTip">
<string>Move GCP point</string>
@@ -366,12 +369,12 @@
</action>
<action name="mActionLocalHistogramStretch">
<property name="text">
<string>Local histogram stretch</string>
<string>Local Histogram Stretch</string>
</property>
</action>
<action name="mActionFullHistogramStretch">
<property name="text">
<string>Full histogram stretch</string>
<string>Full Histogram Stretch</string>
</property>
</action>
</widget>
@@ -72,10 +72,9 @@ bool QgsImageWarper::openSrcDSAndGetWarpOpt( const QString &input, const Resampl
return true;
}

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

if ( !projection.isEmpty() )
if ( crs.isValid() )
{
OGRSpatialReference oTargetSRS;
if ( projection.startsWith( "EPSG", Qt::CaseInsensitive ) )
{
QString epsg = projection.mid( projection.indexOf( ":" ) + 1 );
oTargetSRS.importFromEPSG( epsg.toInt() );
}
else
{
oTargetSRS.importFromProj4( projection.toLatin1().data() );
}
oTargetSRS.importFromProj4( crs.toProj4().toLatin1().data() );

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

if ( !createDestinationDataset( output, hSrcDS, hDstDS, destPixels, destLines,
adfGeoTransform, useZeroAsTrans, compression,
projection ) )
crs ) )
{
GDALClose( hSrcDS );
GDALDestroyWarpOptions( psWarpOptions );
@@ -21,6 +21,7 @@
#include <gdalwarper.h>
#include <vector>
#include "qgspoint.h"
#include "qgscoordinatereferencesystem.h"

class QgsGeorefTransform;
class QProgressDialog;
@@ -56,7 +57,7 @@ class QgsImageWarper
ResamplingMethod resampling,
bool useZeroAsTrans,
const QString& compression,
const QString& projection,
const QgsCoordinateReferenceSystem& crs,
double destResX = 0.0, double destResY = 0.0 );
private:
struct TransformChain
@@ -87,7 +88,7 @@ class QgsImageWarper
GDALWarpOptions *&psWarpOptions );

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

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

0 comments on commit 049436e

Please sign in to comment.
You can’t perform that action at this time.