Skip to content

Commit eaaa98f

Browse files
committed
[georef] Add reset menu action to remove GCP and close current
raster (fix #6215)
1 parent f3d032a commit eaaa98f

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

src/plugins/georeferencer/qgsgeorefplugingui.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,25 @@ void QgsGeorefPluginGui::closeEvent( QCloseEvent *e )
200200
}
201201
}
202202

203+
void QgsGeorefPluginGui::reset()
204+
{
205+
if ( QMessageBox::question( this,
206+
tr( "Reset Georeferencer" ),
207+
tr( "Reset georeferencer and clear all GCP points?" ),
208+
QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel ) != QMessageBox::Cancel )
209+
{
210+
mRasterFileName.clear();
211+
mModifiedRasterFileName.clear();
212+
setWindowTitle( tr( "Georeferencer" ) );
213+
214+
//delete old points
215+
clearGCPData();
216+
217+
//delete any old rasterlayers
218+
removeOldLayer();
219+
}
220+
}
221+
203222
// -------------------------- private slots -------------------------------- //
204223
// File slots
205224
void QgsGeorefPluginGui::openRaster()
@@ -823,6 +842,8 @@ void QgsGeorefPluginGui::layerWillBeRemoved( QString theLayerId )
823842
void QgsGeorefPluginGui::createActions()
824843
{
825844
// File actions
845+
connect( mActionReset, SIGNAL( triggered() ), this, SLOT( reset() ) );
846+
826847
mActionOpenRaster->setIcon( getThemeIcon( "/mActionAddRasterLayer.svg" ) );
827848
connect( mActionOpenRaster, SIGNAL( triggered() ), this, SLOT( openRaster() ) );
828849

@@ -1021,8 +1042,6 @@ void QgsGeorefPluginGui::createMenus()
10211042
menuSettings->addMenu( mPanelMenu );
10221043
menuSettings->addMenu( mToolbarMenu );
10231044
}
1024-
1025-
menuBar()->addAction( tr( "Help" ), this, SLOT( contextHelp() ) );
10261045
}
10271046

10281047
void QgsGeorefPluginGui::createDockWidgets()

src/plugins/georeferencer/qgsgeorefplugingui.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class QgsGeorefPluginGui : public QMainWindow, private Ui::QgsGeorefPluginGuiBas
6060

6161
private slots:
6262
// file
63+
void reset();
6364
void openRaster();
6465
void doGeoreference();
6566
void generateGDALScript();

src/plugins/georeferencer/qgsgeorefpluginguibase.ui

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<property name="title">
2828
<string>File</string>
2929
</property>
30+
<addaction name="mActionReset"/>
3031
<addaction name="mActionOpenRaster"/>
3132
<addaction name="separator"/>
3233
<addaction name="mActionStartGeoref"/>
@@ -375,7 +376,18 @@
375376
<string>Full Histogram Stretch</string>
376377
</property>
377378
</action>
379+
<action name="mActionReset">
380+
<property name="icon">
381+
<iconset resource="../../../images/images.qrc">
382+
<normaloff>:/images/themes/default/mIconClear.png</normaloff>:/images/themes/default/mIconClear.png</iconset>
383+
</property>
384+
<property name="text">
385+
<string>Reset Georeferencer</string>
386+
</property>
387+
</action>
378388
</widget>
379-
<resources/>
389+
<resources>
390+
<include location="../../../images/images.qrc"/>
391+
</resources>
380392
<connections/>
381393
</ui>

0 commit comments

Comments
 (0)