[QGIS Commit] r15498 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Mar 15 10:38:16 EDT 2011


Author: jef
Date: 2011-03-15 07:38:16 -0700 (Tue, 15 Mar 2011)
New Revision: 15498

Modified:
   trunk/qgis/src/app/qgisapp.cpp
Log:
[FEATURE] default to last selection when prompting for CRS

Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2011-03-15 14:21:29 UTC (rev 15497)
+++ trunk/qgis/src/app/qgisapp.cpp	2011-03-15 14:38:16 UTC (rev 15498)
@@ -319,7 +319,7 @@
  */
 static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
 {
-  QString authid;
+  static QString authid = QString::null;
   QSettings mySettings;
   QString myDefaultProjectionOption = mySettings.value( "/Projections/defaultBehaviour" ).toString();
   if ( myDefaultProjectionOption == "prompt" )
@@ -329,7 +329,8 @@
 
     QgsGenericProjectionSelector *mySelector = new QgsGenericProjectionSelector();
     mySelector->setMessage( srs->validationHint() ); //shows a generic message, if not specified
-    authid = QgsProject::instance()->readEntry( "SpatialRefSys", "/ProjectCrs", GEO_EPSG_CRS_AUTHID );
+    if ( authid.isNull() )
+      authid = QgsProject::instance()->readEntry( "SpatialRefSys", "/ProjectCrs", GEO_EPSG_CRS_AUTHID );
     QgsCoordinateReferenceSystem defaultCrs;
     if ( defaultCrs.createFromOgcWmsCrs( authid ) )
     {
@@ -341,6 +342,7 @@
     if ( mySelector->exec() )
     {
       QgsDebugMsg( "Layer srs set from dialog: " + QString::number( mySelector->selectedCrsId() ) );
+      authid = mySelector->selectedAuthId();
       srs->createFromOgcWmsCrs( mySelector->selectedAuthId() );
     }
 
@@ -358,8 +360,9 @@
   }
   else ///Projections/defaultBehaviour==useGlobal
   {
-    srs->createFromOgcWmsCrs( mySettings.value( "/Projections/layerDefaultCrs", GEO_EPSG_CRS_AUTHID ).toString() );
-    QgisApp::instance()->statusBar()->showMessage( QObject::tr( "CRS undefined - defaulting to default CRS" ) );
+    authid = mySettings.value( "/Projections/layerDefaultCrs", GEO_EPSG_CRS_AUTHID ).toString();
+    srs->createFromOgcWmsCrs( authid );
+    QgisApp::instance()->statusBar()->showMessage( QObject::tr( "CRS undefined - defaulting to default CRS: %1" ).arg( authid ) );
   }
 }
 



More information about the QGIS-commit mailing list