@@ -64,7 +64,7 @@ QgsGeometryCheckerSetupTab::QgsGeometryCheckerSetupTab( QgisInterface* iface , Q
64
64
65
65
updateLayers ();
66
66
67
- Q_FOREACH ( const QgsGeometryCheckFactory* factory, QgsGeometryCheckFactoryRegistry::getCheckFactories () )
67
+ Q_FOREACH ( const QgsGeometryCheckFactory* factory, QgsGeometryCheckFactoryRegistry::getCheckFactories () )
68
68
{
69
69
factory->restorePrevious ( ui );
70
70
}
@@ -83,7 +83,7 @@ void QgsGeometryCheckerSetupTab::updateLayers()
83
83
// Collect layers
84
84
QgsMapLayer* currentLayer = mIface ->mapCanvas ()->currentLayer ();
85
85
int currIdx = -1 ;
86
- Q_FOREACH ( QgsMapLayer* layer, QgsMapLayerRegistry::instance ()->mapLayers () )
86
+ Q_FOREACH ( QgsMapLayer* layer, QgsMapLayerRegistry::instance ()->mapLayers () )
87
87
{
88
88
if ( qobject_cast<QgsVectorLayer*>( layer ) )
89
89
{
@@ -117,7 +117,7 @@ void QgsGeometryCheckerSetupTab::validateInput()
117
117
int nApplicable = 0 ;
118
118
if ( layer )
119
119
{
120
- Q_FOREACH ( const QgsGeometryCheckFactory* factory, QgsGeometryCheckFactoryRegistry::getCheckFactories () )
120
+ Q_FOREACH ( const QgsGeometryCheckFactory* factory, QgsGeometryCheckFactoryRegistry::getCheckFactories () )
121
121
{
122
122
nApplicable += factory->checkApplicability ( ui, layer->geometryType () );
123
123
}
@@ -130,7 +130,7 @@ void QgsGeometryCheckerSetupTab::selectOutputFile()
130
130
{
131
131
QString filterString = QgsVectorFileWriter::filterForDriver ( " ESRI Shapefile" );
132
132
QMap<QString, QString> filterFormatMap = QgsVectorFileWriter::supportedFiltersAndFormats ();
133
- Q_FOREACH ( const QString& filter, filterFormatMap.keys () )
133
+ Q_FOREACH ( const QString& filter, filterFormatMap.keys () )
134
134
{
135
135
QString driverName = filterFormatMap.value ( filter );
136
136
if ( driverName != " ESRI Shapefile" ) // Default entry, first in list (see above)
@@ -172,6 +172,13 @@ void QgsGeometryCheckerSetupTab::runChecks()
172
172
if ( !layer )
173
173
return ;
174
174
175
+ if ( ui.radioButtonOutputNew ->isChecked () &&
176
+ layer->dataProvider ()->dataSourceUri ().startsWith ( ui.lineEditOutput ->text () ) )
177
+ {
178
+ QMessageBox::critical ( this , tr ( " Invalid Output Layer" ), tr ( " The chosen output layer is the same as the input layer." ) );
179
+ return ;
180
+ }
181
+
175
182
if ( layer->isEditable () )
176
183
{
177
184
QMessageBox::critical ( this , tr ( " Editable Input Layer" ), tr ( " The input layer is not allowed to be in editing mode." ) );
@@ -194,7 +201,7 @@ void QgsGeometryCheckerSetupTab::runChecks()
194
201
195
202
// Remove existing layer with same uri
196
203
QStringList toRemove;
197
- Q_FOREACH ( QgsMapLayer* maplayer, QgsMapLayerRegistry::instance ()->mapLayers () )
204
+ Q_FOREACH ( QgsMapLayer* maplayer, QgsMapLayerRegistry::instance ()->mapLayers () )
198
205
{
199
206
if ( dynamic_cast <QgsVectorLayer*>( maplayer ) &&
200
207
static_cast <QgsVectorLayer*>( maplayer )->dataProvider ()->dataSourceUri ().startsWith ( filename ) )
@@ -269,7 +276,7 @@ void QgsGeometryCheckerSetupTab::runChecks()
269
276
270
277
QList<QgsGeometryCheck*> checks;
271
278
double mapToLayer = 1 . / mIface ->mapCanvas ()->mapSettings ().layerToMapUnits ( layer );
272
- Q_FOREACH ( const QgsGeometryCheckFactory* factory, QgsGeometryCheckFactoryRegistry::getCheckFactories () )
279
+ Q_FOREACH ( const QgsGeometryCheckFactory* factory, QgsGeometryCheckFactoryRegistry::getCheckFactories () )
273
280
{
274
281
QgsGeometryCheck* check = factory->createInstance ( featurePool, ui, mapToLayer );
275
282
if ( check )
0 commit comments