Skip to content

Commit ce6aab7

Browse files
committed
fix #5251
1 parent e2f7adf commit ce6aab7

File tree

5 files changed

+20
-14
lines changed

5 files changed

+20
-14
lines changed

python/plugins/fTools/tools/doMergeShapes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ def accept( self ):
139139
baseDir = self.leInputDir.text()
140140
# look for shapes with specified geometry type
141141
self.inputFiles = ftools_utils.getShapesByGeometryType( baseDir, self.inputFiles, self.cmbGeometry.currentIndex() )
142+
if self.inputFiles is None:
143+
QMessageBox.warning( self, self.tr( "No shapefiles found" ),
144+
self.tr( "There are no shapefiles with the given geometry type. Please select an available geometry type." ) )
145+
return
142146
self.progressFiles.setRange( 0, self.inputFiles.count() )
143147

144148
outFile = QFile( self.outFileName )

src/app/qgisapp.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -344,12 +344,12 @@ static QgsMessageOutput *messageOutputViewer_()
344344
return new QgsMessageOutputConsole();
345345
}
346346

347-
static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
347+
static void customSrsValidation_( QgsCoordinateReferenceSystem &srs )
348348
{
349349
QgisApp::instance()->emitCustomSrsValidation( srs );
350350
}
351351

352-
void QgisApp::emitCustomSrsValidation( QgsCoordinateReferenceSystem* srs )
352+
void QgisApp::emitCustomSrsValidation( QgsCoordinateReferenceSystem &srs )
353353
{
354354
emit customSrsValidation( srs );
355355
}
@@ -361,7 +361,7 @@ void QgisApp::emitCustomSrsValidation( QgsCoordinateReferenceSystem* srs )
361361
* - use project's CRS
362362
* - use predefined global CRS
363363
*/
364-
void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs )
364+
void QgisApp::validateSrs( QgsCoordinateReferenceSystem &srs )
365365
{
366366
static QString authid = QString::null;
367367
QSettings mySettings;
@@ -372,9 +372,10 @@ void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs )
372372
//it in the ctor of the layer projection selector
373373

374374
QgsGenericProjectionSelector *mySelector = new QgsGenericProjectionSelector();
375-
mySelector->setMessage( srs->validationHint() ); //shows a generic message, if not specified
375+
mySelector->setMessage( srs.validationHint() ); //shows a generic message, if not specified
376376
if ( authid.isNull() )
377377
authid = QgisApp::instance()->mapCanvas()->mapRenderer()->destinationCrs().authid();
378+
378379
QgsCoordinateReferenceSystem defaultCrs;
379380
if ( defaultCrs.createFromOgcWmsCrs( authid ) )
380381
{
@@ -389,7 +390,7 @@ void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs )
389390
{
390391
QgsDebugMsg( "Layer srs set from dialog: " + QString::number( mySelector->selectedCrsId() ) );
391392
authid = mySelector->selectedAuthId();
392-
srs->createFromOgcWmsCrs( mySelector->selectedAuthId() );
393+
srs.createFromOgcWmsCrs( mySelector->selectedAuthId() );
393394
}
394395

395396
//QApplication::restoreOverrideCursor();
@@ -402,12 +403,12 @@ void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs )
402403
authid = QgisApp::instance()->mapCanvas()->mapRenderer()->destinationCrs().authid();
403404
QgsDebugMsg( "Layer srs set from project: " + authid );
404405
QgisApp::instance()->statusBar()->showMessage( QObject::tr( "CRS undefined - defaulting to project CRS" ) );
405-
srs->createFromOgcWmsCrs( authid );
406+
srs.createFromOgcWmsCrs( authid );
406407
}
407408
else ///Projections/defaultBehaviour==useGlobal
408409
{
409410
authid = mySettings.value( "/Projections/layerDefaultCrs", GEO_EPSG_CRS_AUTHID ).toString();
410-
srs->createFromOgcWmsCrs( authid );
411+
srs.createFromOgcWmsCrs( authid );
411412
QgisApp::instance()->statusBar()->showMessage( QObject::tr( "CRS undefined - defaulting to default CRS: %1" ).arg( authid ) );
412413
}
413414
}
@@ -566,8 +567,8 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
566567
QgsMessageLog::logMessage( tr( "QGIS starting..." ) );
567568

568569
// set QGIS specific srs validation
569-
connect( this, SIGNAL( customSrsValidation( QgsCoordinateReferenceSystem * ) ),
570-
this, SLOT( validateSrs( QgsCoordinateReferenceSystem * ) ) );
570+
connect( this, SIGNAL( customSrsValidation( QgsCoordinateReferenceSystem& ) ),
571+
this, SLOT( validateSrs( QgsCoordinateReferenceSystem& ) ) );
571572
QgsCoordinateReferenceSystem::setCustomSrsValidation( customSrsValidation_ );
572573

573574
// set graphical message output
@@ -7020,6 +7021,7 @@ void QgisApp::markDirty()
70207021
// notify the project that there was a change
70217022
QgsProject::instance()->dirty( true );
70227023
}
7024+
70237025
//changed from layerWasAdded to layersWereAdded in 1.8
70247026
void QgisApp::layersWereAdded( QList<QgsMapLayer *> theLayers )
70257027
{

src/app/qgisapp.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
404404
//! @note added in 1.6
405405
void completeInitialization();
406406

407-
void emitCustomSrsValidation( QgsCoordinateReferenceSystem *crs );
407+
void emitCustomSrsValidation( QgsCoordinateReferenceSystem &crs );
408408

409409
QList<QgsDecorationItem*> decorationItems() { return mDecorationItems; }
410410
void addDecorationItem( QgsDecorationItem* item ) { mDecorationItems.append( item ); }
@@ -533,7 +533,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
533533

534534
private slots:
535535
//! validate a SRS
536-
void validateSrs( QgsCoordinateReferenceSystem *crs );
536+
void validateSrs( QgsCoordinateReferenceSystem &crs );
537537

538538
//! QGis Sponsors
539539
void sponsors();
@@ -1008,7 +1008,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
10081008
@note added in version 1.6*/
10091009
void initializationCompleted();
10101010

1011-
void customSrsValidation( QgsCoordinateReferenceSystem *crs );
1011+
void customSrsValidation( QgsCoordinateReferenceSystem &crs );
10121012

10131013
private:
10141014
/** This method will open a dialog so the user can select GDAL sublayers to load

src/core/qgscoordinatereferencesystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ void QgsCoordinateReferenceSystem::validate()
283283

284284
// try to validate using custom validation routines
285285
if ( mCustomSrsValidation )
286-
mCustomSrsValidation( this );
286+
mCustomSrsValidation( *this );
287287

288288
if ( !mIsValidFlag )
289289
{

src/core/qgscoordinatereferencesystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ typedef void *OGRSpatialReferenceH;
4242
#endif
4343

4444
class QgsCoordinateReferenceSystem;
45-
typedef void ( *CUSTOM_CRS_VALIDATION )( QgsCoordinateReferenceSystem* );
45+
typedef void ( *CUSTOM_CRS_VALIDATION )( QgsCoordinateReferenceSystem& );
4646

4747
/** \ingroup core
4848
* Class for storing a coordinate reference system (CRS)

0 commit comments

Comments
 (0)