Skip to content

Commit

Permalink
fix srs validation from threads
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n authored and alexbruy committed Apr 7, 2012
1 parent 226c2c6 commit fdb2475
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -321,14 +321,24 @@ static QgsMessageOutput *messageOutputViewer_()
return new QgsMessageViewer( QgisApp::instance() );
}

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

void QgisApp::emitCustomSrsValidation( QgsCoordinateReferenceSystem* srs )
{
emit customSrsValidation( srs );
}

/**
* This function contains forced validation of CRS used in QGIS.
* There are 3 options depending on the settings:
* - ask for CRS using projection selecter
* - use project's CRS
* - use predefined global CRS
*/
static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs )
{
static QString authid = QString::null;
QSettings mySettings;
Expand Down Expand Up @@ -514,6 +524,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 * ) ) );
QgsCoordinateReferenceSystem::setCustomSrsValidation( customSrsValidation_ );

// set graphical message output
Expand Down
7 changes: 7 additions & 0 deletions src/app/qgisapp.h
Expand Up @@ -371,6 +371,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
//! @note added in 1.6
void completeInitialization();

void emitCustomSrsValidation( QgsCoordinateReferenceSystem *crs );

public slots:
//! Zoom to full extent
void zoomFull();
Expand Down Expand Up @@ -487,6 +489,9 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
#endif

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

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

void customSrsValidation( QgsCoordinateReferenceSystem *crs );

private:
/** This method will open a dialog so the user can select the sublayers to load
*/
Expand Down

0 comments on commit fdb2475

Please sign in to comment.