Skip to content

Commit

Permalink
[georef] Add reset menu action to remove GCP and close current
Browse files Browse the repository at this point in the history
raster (fix #6215)
  • Loading branch information
nyalldawson committed Jun 21, 2015
1 parent f3d032a commit eaaa98f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
23 changes: 21 additions & 2 deletions src/plugins/georeferencer/qgsgeorefplugingui.cpp
Expand Up @@ -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()
Expand Down Expand Up @@ -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() ) );

Expand Down Expand Up @@ -1021,8 +1042,6 @@ void QgsGeorefPluginGui::createMenus()
menuSettings->addMenu( mPanelMenu );
menuSettings->addMenu( mToolbarMenu );
}

menuBar()->addAction( tr( "Help" ), this, SLOT( contextHelp() ) );
}

void QgsGeorefPluginGui::createDockWidgets()
Expand Down
1 change: 1 addition & 0 deletions src/plugins/georeferencer/qgsgeorefplugingui.h
Expand Up @@ -60,6 +60,7 @@ class QgsGeorefPluginGui : public QMainWindow, private Ui::QgsGeorefPluginGuiBas

private slots:
// file
void reset();
void openRaster();
void doGeoreference();
void generateGDALScript();
Expand Down
14 changes: 13 additions & 1 deletion src/plugins/georeferencer/qgsgeorefpluginguibase.ui
Expand Up @@ -27,6 +27,7 @@
<property name="title">
<string>File</string>
</property>
<addaction name="mActionReset"/>
<addaction name="mActionOpenRaster"/>
<addaction name="separator"/>
<addaction name="mActionStartGeoref"/>
Expand Down Expand Up @@ -375,7 +376,18 @@
<string>Full Histogram Stretch</string>
</property>
</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>
<resources/>
<resources>
<include location="../../../images/images.qrc"/>
</resources>
<connections/>
</ui>

0 comments on commit eaaa98f

Please sign in to comment.