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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Mar 5 16:51:59 EST 2011


Author: timlinux
Date: 2011-03-05 13:51:59 -0800 (Sat, 05 Mar 2011)
New Revision: 15345

Modified:
   trunk/qgis/src/app/qgsoptions.cpp
   trunk/qgis/src/app/qgsoptions.h
Log:
Show more user friendly projection name for qgis default project CRS (relates to #393)

Modified: trunk/qgis/src/app/qgsoptions.cpp
===================================================================
--- trunk/qgis/src/app/qgsoptions.cpp	2011-03-05 21:51:45 UTC (rev 15344)
+++ trunk/qgis/src/app/qgsoptions.cpp	2011-03-05 21:51:59 UTC (rev 15345)
@@ -188,12 +188,14 @@
   {
     radUseGlobalProjection->setChecked( true );
   }
-
   txtGlobalWkt->setText( settings.value( "/Projections/defaultProjectionString", GEOPROJ4 ).toString() );
-
   //on the fly CRS transformation settings
   grpOtfTransform->setChecked( settings.value( "/Projections/otfTransformEnabled", 0 ).toBool() );
-  leGlobalOtfProjString->setText( settings.value( "/Projections/defaultOTFProjectionString", GEOPROJ4 ).toString() );
+  QString myDefaultSrsString = settings.value( "/Projections/defaultOTFProjectionString", GEOPROJ4 ).toString();
+  mDefaultCrs.createFromProj4( myDefaultSrsString );
+  //display the crs as friendly text rather than in wkt
+  leGlobalOtfProjString->setText( mDefaultCrs.authid() + " - " +
+      mDefaultCrs.description() );
 
   // populate combo box with ellipsoids
   getEllipsoidList();
@@ -637,7 +639,7 @@
 
   // save 'on the fly' CRS transformation settings
   settings.setValue( "/Projections/otfTransformEnabled", grpOtfTransform->isChecked() );
-  settings.setValue( "/Projections/defaultOTFProjectionString", leGlobalOtfProjString->text() );
+  settings.setValue( "/Projections/defaultOTFProjectionString", mDefaultCrs.toProj4() );
 
   settings.setValue( "/qgis/measure/ellipsoid", getEllipsoidAcronym( cmbEllipsoid->currentText() ) );
 
@@ -774,15 +776,14 @@
   QgsGenericProjectionSelector * mySelector = new QgsGenericProjectionSelector( this );
 
   //find out srs id of current proj4 string
-  QgsCoordinateReferenceSystem refSys;
-  if ( refSys.createFromProj4( leGlobalOtfProjString->text() ) )
-  {
-    mySelector->setSelectedCrsId( refSys.srsid() );
-  }
+  mySelector->setSelectedCrsId( mDefaultCrs.srsid() );
 
   if ( mySelector->exec() )
   {
-    leGlobalOtfProjString->setText( mySelector->selectedProj4String() );
+    mDefaultCrs.createFromProj4( mySelector->selectedProj4String() );
+    QgsDebugMsg( QString( "Setting default project CRS to : %1").arg( mySelector->selectedProj4String() ) );
+    leGlobalOtfProjString->setText( mDefaultCrs.authid() + " - " +
+      mDefaultCrs.description() );
     QgsDebugMsg( QString( "------ Global OTF Projection Selection set to ----------\n%1" ).arg( leGlobalOtfProjString->text() ) );
   }
   else

Modified: trunk/qgis/src/app/qgsoptions.h
===================================================================
--- trunk/qgis/src/app/qgsoptions.h	2011-03-05 21:51:45 UTC (rev 15344)
+++ trunk/qgis/src/app/qgsoptions.h	2011-03-05 21:51:59 UTC (rev 15345)
@@ -23,7 +23,9 @@
 #include "qgisgui.h"
 #include "qgscontexthelp.h"
 
+#include <qgscoordinatereferencesystem.h>
 
+
 /**
  * \class QgsOptions
  * \brief Set user options and preferences
@@ -128,6 +130,7 @@
 
   private:
     QStringList i18nList();
+    QgsCoordinateReferenceSystem mDefaultCrs;
 };
 
 #endif // #ifndef QGSOPTIONS_H



More information about the QGIS-commit mailing list