From eaaa98fd4599aef44237c69f1a54808d66e64b51 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Sun, 21 Jun 2015 21:42:36 +1000 Subject: [PATCH] [georef] Add reset menu action to remove GCP and close current raster (fix #6215) --- .../georeferencer/qgsgeorefplugingui.cpp | 23 +++++++++++++++++-- .../georeferencer/qgsgeorefplugingui.h | 1 + .../georeferencer/qgsgeorefpluginguibase.ui | 14 ++++++++++- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/plugins/georeferencer/qgsgeorefplugingui.cpp b/src/plugins/georeferencer/qgsgeorefplugingui.cpp index 7275a287956..991f4d6e3f4 100644 --- a/src/plugins/georeferencer/qgsgeorefplugingui.cpp +++ b/src/plugins/georeferencer/qgsgeorefplugingui.cpp @@ -200,6 +200,25 @@ void QgsGeorefPluginGui::closeEvent( QCloseEvent *e ) } } +void QgsGeorefPluginGui::reset() +{ + if ( QMessageBox::question( this, + tr( "Reset Georeferencer" ), + tr( "Reset georeferencer and clear all GCP points?" ), + QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel ) != QMessageBox::Cancel ) + { + mRasterFileName.clear(); + mModifiedRasterFileName.clear(); + setWindowTitle( tr( "Georeferencer" ) ); + + //delete old points + clearGCPData(); + + //delete any old rasterlayers + removeOldLayer(); + } +} + // -------------------------- private slots -------------------------------- // // File slots void QgsGeorefPluginGui::openRaster() @@ -823,6 +842,8 @@ void QgsGeorefPluginGui::layerWillBeRemoved( QString theLayerId ) void QgsGeorefPluginGui::createActions() { // File actions + connect( mActionReset, SIGNAL( triggered() ), this, SLOT( reset() ) ); + mActionOpenRaster->setIcon( getThemeIcon( "/mActionAddRasterLayer.svg" ) ); connect( mActionOpenRaster, SIGNAL( triggered() ), this, SLOT( openRaster() ) ); @@ -1021,8 +1042,6 @@ void QgsGeorefPluginGui::createMenus() menuSettings->addMenu( mPanelMenu ); menuSettings->addMenu( mToolbarMenu ); } - - menuBar()->addAction( tr( "Help" ), this, SLOT( contextHelp() ) ); } void QgsGeorefPluginGui::createDockWidgets() diff --git a/src/plugins/georeferencer/qgsgeorefplugingui.h b/src/plugins/georeferencer/qgsgeorefplugingui.h index e5292e15fe3..2d7a3c355e5 100644 --- a/src/plugins/georeferencer/qgsgeorefplugingui.h +++ b/src/plugins/georeferencer/qgsgeorefplugingui.h @@ -60,6 +60,7 @@ class QgsGeorefPluginGui : public QMainWindow, private Ui::QgsGeorefPluginGuiBas private slots: // file + void reset(); void openRaster(); void doGeoreference(); void generateGDALScript(); diff --git a/src/plugins/georeferencer/qgsgeorefpluginguibase.ui b/src/plugins/georeferencer/qgsgeorefpluginguibase.ui index b86c79d5d75..ca1e5346181 100644 --- a/src/plugins/georeferencer/qgsgeorefpluginguibase.ui +++ b/src/plugins/georeferencer/qgsgeorefpluginguibase.ui @@ -27,6 +27,7 @@ File + @@ -375,7 +376,18 @@ Full Histogram Stretch + + + + :/images/themes/default/mIconClear.png:/images/themes/default/mIconClear.png + + + Reset Georeferencer + + - + + +