@@ -319,7 +319,7 @@ static QgsMessageOutput *messageOutputViewer_()
319
319
*/
320
320
static void customSrsValidation_ ( QgsCoordinateReferenceSystem* srs )
321
321
{
322
- QString authid;
322
+ static QString authid = QString::null ;
323
323
QSettings mySettings;
324
324
QString myDefaultProjectionOption = mySettings.value ( " /Projections/defaultBehaviour" ).toString ();
325
325
if ( myDefaultProjectionOption == " prompt" )
@@ -329,7 +329,8 @@ static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
329
329
330
330
QgsGenericProjectionSelector *mySelector = new QgsGenericProjectionSelector ();
331
331
mySelector->setMessage ( srs->validationHint () ); // shows a generic message, if not specified
332
- authid = QgsProject::instance ()->readEntry ( " SpatialRefSys" , " /ProjectCrs" , GEO_EPSG_CRS_AUTHID );
332
+ if ( authid.isNull () )
333
+ authid = QgsProject::instance ()->readEntry ( " SpatialRefSys" , " /ProjectCrs" , GEO_EPSG_CRS_AUTHID );
333
334
QgsCoordinateReferenceSystem defaultCrs;
334
335
if ( defaultCrs.createFromOgcWmsCrs ( authid ) )
335
336
{
@@ -341,6 +342,7 @@ static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
341
342
if ( mySelector->exec () )
342
343
{
343
344
QgsDebugMsg ( " Layer srs set from dialog: " + QString::number ( mySelector->selectedCrsId () ) );
345
+ authid = mySelector->selectedAuthId ();
344
346
srs->createFromOgcWmsCrs ( mySelector->selectedAuthId () );
345
347
}
346
348
@@ -358,8 +360,9 @@ static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
358
360
}
359
361
else // /Projections/defaultBehaviour==useGlobal
360
362
{
361
- srs->createFromOgcWmsCrs ( mySettings.value ( " /Projections/layerDefaultCrs" , GEO_EPSG_CRS_AUTHID ).toString () );
362
- QgisApp::instance ()->statusBar ()->showMessage ( QObject::tr ( " CRS undefined - defaulting to default CRS" ) );
363
+ authid = mySettings.value ( " /Projections/layerDefaultCrs" , GEO_EPSG_CRS_AUTHID ).toString ();
364
+ srs->createFromOgcWmsCrs ( authid );
365
+ QgisApp::instance ()->statusBar ()->showMessage ( QObject::tr ( " CRS undefined - defaulting to default CRS: %1" ).arg ( authid ) );
363
366
}
364
367
}
365
368
0 commit comments