[georef] Add reset menu action to remove GCP and close current

raster (fix #6215)
This commit is contained in:
Nyall Dawson 2015-06-21 21:42:36 +10:00
parent f3d032a32c
commit eaaa98fd45
3 changed files with 35 additions and 3 deletions

View File

@ -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 -------------------------------- // // -------------------------- private slots -------------------------------- //
// File slots // File slots
void QgsGeorefPluginGui::openRaster() void QgsGeorefPluginGui::openRaster()
@ -823,6 +842,8 @@ void QgsGeorefPluginGui::layerWillBeRemoved( QString theLayerId )
void QgsGeorefPluginGui::createActions() void QgsGeorefPluginGui::createActions()
{ {
// File actions // File actions
connect( mActionReset, SIGNAL( triggered() ), this, SLOT( reset() ) );
mActionOpenRaster->setIcon( getThemeIcon( "/mActionAddRasterLayer.svg" ) ); mActionOpenRaster->setIcon( getThemeIcon( "/mActionAddRasterLayer.svg" ) );
connect( mActionOpenRaster, SIGNAL( triggered() ), this, SLOT( openRaster() ) ); connect( mActionOpenRaster, SIGNAL( triggered() ), this, SLOT( openRaster() ) );
@ -1021,8 +1042,6 @@ void QgsGeorefPluginGui::createMenus()
menuSettings->addMenu( mPanelMenu ); menuSettings->addMenu( mPanelMenu );
menuSettings->addMenu( mToolbarMenu ); menuSettings->addMenu( mToolbarMenu );
} }
menuBar()->addAction( tr( "Help" ), this, SLOT( contextHelp() ) );
} }
void QgsGeorefPluginGui::createDockWidgets() void QgsGeorefPluginGui::createDockWidgets()

View File

@ -60,6 +60,7 @@ class QgsGeorefPluginGui : public QMainWindow, private Ui::QgsGeorefPluginGuiBas
private slots: private slots:
// file // file
void reset();
void openRaster(); void openRaster();
void doGeoreference(); void doGeoreference();
void generateGDALScript(); void generateGDALScript();

View File

@ -27,6 +27,7 @@
<property name="title"> <property name="title">
<string>File</string> <string>File</string>
</property> </property>
<addaction name="mActionReset"/>
<addaction name="mActionOpenRaster"/> <addaction name="mActionOpenRaster"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="mActionStartGeoref"/> <addaction name="mActionStartGeoref"/>
@ -375,7 +376,18 @@
<string>Full Histogram Stretch</string> <string>Full Histogram Stretch</string>
</property> </property>
</action> </action>
<action name="mActionReset">
<property name="icon">
<iconset resource="../../../images/images.qrc">
<normaloff>:/images/themes/default/mIconClear.png</normaloff>:/images/themes/default/mIconClear.png</iconset>
</property>
<property name="text">
<string>Reset Georeferencer</string>
</property>
</action>
</widget> </widget>
<resources/> <resources>
<include location="../../../images/images.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>