Skip to content

Commit

Permalink
fix #5251
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Dec 29, 2012
1 parent e2f7adf commit ce6aab7
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
4 changes: 4 additions & 0 deletions python/plugins/fTools/tools/doMergeShapes.py
Expand Up @@ -139,6 +139,10 @@ def accept( self ):
baseDir = self.leInputDir.text()
# look for shapes with specified geometry type
self.inputFiles = ftools_utils.getShapesByGeometryType( baseDir, self.inputFiles, self.cmbGeometry.currentIndex() )
if self.inputFiles is None:
QMessageBox.warning( self, self.tr( "No shapefiles found" ),
self.tr( "There are no shapefiles with the given geometry type. Please select an available geometry type." ) )
return
self.progressFiles.setRange( 0, self.inputFiles.count() )

outFile = QFile( self.outFileName )
Expand Down
20 changes: 11 additions & 9 deletions src/app/qgisapp.cpp
Expand Up @@ -344,12 +344,12 @@ static QgsMessageOutput *messageOutputViewer_()
return new QgsMessageOutputConsole();
}

static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
static void customSrsValidation_( QgsCoordinateReferenceSystem &srs )
{
QgisApp::instance()->emitCustomSrsValidation( srs );
}

void QgisApp::emitCustomSrsValidation( QgsCoordinateReferenceSystem* srs )
void QgisApp::emitCustomSrsValidation( QgsCoordinateReferenceSystem &srs )
{
emit customSrsValidation( srs );
}
Expand All @@ -361,7 +361,7 @@ void QgisApp::emitCustomSrsValidation( QgsCoordinateReferenceSystem* srs )
* - use project's CRS
* - use predefined global CRS
*/
void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs )
void QgisApp::validateSrs( QgsCoordinateReferenceSystem &srs )
{
static QString authid = QString::null;
QSettings mySettings;
Expand All @@ -372,9 +372,10 @@ void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs )
//it in the ctor of the layer projection selector

QgsGenericProjectionSelector *mySelector = new QgsGenericProjectionSelector();
mySelector->setMessage( srs->validationHint() ); //shows a generic message, if not specified
mySelector->setMessage( srs.validationHint() ); //shows a generic message, if not specified
if ( authid.isNull() )
authid = QgisApp::instance()->mapCanvas()->mapRenderer()->destinationCrs().authid();

QgsCoordinateReferenceSystem defaultCrs;
if ( defaultCrs.createFromOgcWmsCrs( authid ) )
{
Expand All @@ -389,7 +390,7 @@ void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs )
{
QgsDebugMsg( "Layer srs set from dialog: " + QString::number( mySelector->selectedCrsId() ) );
authid = mySelector->selectedAuthId();
srs->createFromOgcWmsCrs( mySelector->selectedAuthId() );
srs.createFromOgcWmsCrs( mySelector->selectedAuthId() );
}

//QApplication::restoreOverrideCursor();
Expand All @@ -402,12 +403,12 @@ void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs )
authid = QgisApp::instance()->mapCanvas()->mapRenderer()->destinationCrs().authid();
QgsDebugMsg( "Layer srs set from project: " + authid );
QgisApp::instance()->statusBar()->showMessage( QObject::tr( "CRS undefined - defaulting to project CRS" ) );
srs->createFromOgcWmsCrs( authid );
srs.createFromOgcWmsCrs( authid );
}
else ///Projections/defaultBehaviour==useGlobal
{
authid = mySettings.value( "/Projections/layerDefaultCrs", GEO_EPSG_CRS_AUTHID ).toString();
srs->createFromOgcWmsCrs( authid );
srs.createFromOgcWmsCrs( authid );
QgisApp::instance()->statusBar()->showMessage( QObject::tr( "CRS undefined - defaulting to default CRS: %1" ).arg( authid ) );
}
}
Expand Down Expand Up @@ -566,8 +567,8 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
QgsMessageLog::logMessage( tr( "QGIS starting..." ) );

// set QGIS specific srs validation
connect( this, SIGNAL( customSrsValidation( QgsCoordinateReferenceSystem * ) ),
this, SLOT( validateSrs( QgsCoordinateReferenceSystem * ) ) );
connect( this, SIGNAL( customSrsValidation( QgsCoordinateReferenceSystem& ) ),
this, SLOT( validateSrs( QgsCoordinateReferenceSystem& ) ) );
QgsCoordinateReferenceSystem::setCustomSrsValidation( customSrsValidation_ );

// set graphical message output
Expand Down Expand Up @@ -7020,6 +7021,7 @@ void QgisApp::markDirty()
// notify the project that there was a change
QgsProject::instance()->dirty( true );
}

//changed from layerWasAdded to layersWereAdded in 1.8
void QgisApp::layersWereAdded( QList<QgsMapLayer *> theLayers )
{
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgisapp.h
Expand Up @@ -404,7 +404,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
//! @note added in 1.6
void completeInitialization();

void emitCustomSrsValidation( QgsCoordinateReferenceSystem *crs );
void emitCustomSrsValidation( QgsCoordinateReferenceSystem &crs );

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

private slots:
//! validate a SRS
void validateSrs( QgsCoordinateReferenceSystem *crs );
void validateSrs( QgsCoordinateReferenceSystem &crs );

//! QGis Sponsors
void sponsors();
Expand Down Expand Up @@ -1008,7 +1008,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
@note added in version 1.6*/
void initializationCompleted();

void customSrsValidation( QgsCoordinateReferenceSystem *crs );
void customSrsValidation( QgsCoordinateReferenceSystem &crs );

private:
/** This method will open a dialog so the user can select GDAL sublayers to load
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgscoordinatereferencesystem.cpp
Expand Up @@ -283,7 +283,7 @@ void QgsCoordinateReferenceSystem::validate()

// try to validate using custom validation routines
if ( mCustomSrsValidation )
mCustomSrsValidation( this );
mCustomSrsValidation( *this );

if ( !mIsValidFlag )
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgscoordinatereferencesystem.h
Expand Up @@ -42,7 +42,7 @@ typedef void *OGRSpatialReferenceH;
#endif

class QgsCoordinateReferenceSystem;
typedef void ( *CUSTOM_CRS_VALIDATION )( QgsCoordinateReferenceSystem* );
typedef void ( *CUSTOM_CRS_VALIDATION )( QgsCoordinateReferenceSystem& );

/** \ingroup core
* Class for storing a coordinate reference system (CRS)
Expand Down

0 comments on commit ce6aab7

Please sign in to comment.