@@ -70,16 +70,6 @@ QgsGeorefDockWidget::QgsGeorefDockWidget( const QString & title, QWidget * paren
70
70
setObjectName ( " GeorefDockWidget" ); // set object name so the position can be saved
71
71
}
72
72
73
- void QgsGeorefDockWidget::closeEvent ( QCloseEvent * ev )
74
- {
75
- if ( widget () && !widget ()->close () )
76
- {
77
- ev->ignore ();
78
- return ;
79
- }
80
- deleteLater ();
81
- }
82
-
83
73
QgsGeorefPluginGui::QgsGeorefPluginGui ( QgisInterface* theQgisInterface, QWidget* parent, Qt::WFlags fl )
84
74
: QMainWindow( parent, fl )
85
75
, mTransformParam( QgsGeorefTransform::InvalidTransform )
@@ -145,12 +135,7 @@ QgsGeorefPluginGui::~QgsGeorefPluginGui()
145
135
{
146
136
clearGCPData ();
147
137
148
- // delete layer (and don't signal it as it's our private layer)
149
- if ( mLayer )
150
- {
151
- QgsMapLayerRegistry::instance ()->removeMapLayers (
152
- ( QStringList () << mLayer ->id () ), false );
153
- }
138
+ removeOldLayer ();
154
139
155
140
delete mToolZoomIn ;
156
141
delete mToolZoomOut ;
@@ -173,14 +158,23 @@ void QgsGeorefPluginGui::closeEvent( QCloseEvent *e )
173
158
else
174
159
saveGCPs ();
175
160
writeSettings ();
161
+ clearGCPData ();
162
+ removeOldLayer ();
163
+ mRasterFileName = " " ;
176
164
e->accept ();
177
165
return ;
178
166
case QgsGeorefPluginGui::GCPSILENTSAVE:
179
167
if ( !mGCPpointsFileName .isEmpty () )
180
168
saveGCPs ();
169
+ clearGCPData ();
170
+ removeOldLayer ();
171
+ mRasterFileName = " " ;
181
172
return ;
182
173
case QgsGeorefPluginGui::GCPDISCARD:
183
174
writeSettings ();
175
+ clearGCPData ();
176
+ removeOldLayer ();
177
+ mRasterFileName = " " ;
184
178
e->accept ();
185
179
return ;
186
180
case QgsGeorefPluginGui::GCPCANCEL:
@@ -253,9 +247,7 @@ void QgsGeorefPluginGui::openRaster()
253
247
clearGCPData ();
254
248
255
249
// delete any old rasterlayers
256
- if ( mLayer )
257
- QgsMapLayerRegistry::instance ()->removeMapLayers (
258
- QStringList () << mLayer ->id (), false );
250
+ removeOldLayer ();
259
251
260
252
// Add raster
261
253
addRaster ( mRasterFileName );
@@ -1036,6 +1028,18 @@ void QgsGeorefPluginGui::setupConnections()
1036
1028
connect ( mCanvas , SIGNAL ( extentsChanged () ), this , SLOT ( extentsChanged () ) );
1037
1029
}
1038
1030
1031
+ void QgsGeorefPluginGui::removeOldLayer ()
1032
+ {
1033
+ // delete layer (and don't signal it as it's our private layer)
1034
+ if ( mLayer )
1035
+ {
1036
+ QgsMapLayerRegistry::instance ()->removeMapLayers (
1037
+ ( QStringList () << mLayer ->id () ), false );
1038
+ mLayer = NULL ;
1039
+ }
1040
+ mCanvas ->refresh ();
1041
+ }
1042
+
1039
1043
void QgsGeorefPluginGui::updateIconTheme ( QString theme )
1040
1044
{
1041
1045
// File actions
0 commit comments