[QGIS Commit] r11516 - trunk/qgis/src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Aug 26 15:59:51 EDT 2009


Author: homann
Date: 2009-08-26 15:59:50 -0400 (Wed, 26 Aug 2009)
New Revision: 11516

Modified:
   trunk/qgis/src/core/qgscoordinatereferencesystem.cpp
Log:
First try with EPSG ID, then proj4 matching, when reading CRS from project file

Modified: trunk/qgis/src/core/qgscoordinatereferencesystem.cpp
===================================================================
--- trunk/qgis/src/core/qgscoordinatereferencesystem.cpp	2009-08-26 19:11:01 UTC (rev 11515)
+++ trunk/qgis/src/core/qgscoordinatereferencesystem.cpp	2009-08-26 19:59:50 UTC (rev 11516)
@@ -930,60 +930,73 @@
 
   if ( ! srsNode.isNull() )
   {
-    QDomNode myNode = srsNode.namedItem( "proj4" );
+    QDomNode myNode = srsNode.namedItem( "epsg" );
     QDomElement myElement = myNode.toElement();
 
-    if ( createFromProj4( myElement.text() ) )
+    if ( createFromEpsg( myElement.text().toLong() ) )
     {
-      // createFromProj4() sets everything, inlcuding map units
-      QgsDebugMsg( "Setting from proj4 string" );
+      // createFromEpsg() sets everything, inlcuding map units
+      QgsDebugMsg( "Setting from EPSG id" );
     }
     else
     {
-      QgsDebugMsg( "Setting from elements one by one" );
+      myNode = srsNode.namedItem( "proj4" );
+      myElement = myNode.toElement();
 
-      setProj4String( myElement.text() );
+      if ( createFromProj4( myElement.text() ) )
+      {
+        // createFromProj4() sets everything, inlcuding map units
+        QgsDebugMsg( "Setting from proj4 string" );
+      }
+      else
+      {
+        QgsDebugMsg( "Setting from elements one by one" );
 
-      myNode = srsNode.namedItem( "srsid" );
-      myElement = myNode.toElement();
-      setInternalId( myElement.text().toLong() );
+        myNode = srsNode.namedItem( "proj4" );
+        myElement = myNode.toElement();
+        setProj4String( myElement.text() );
 
-      myNode = srsNode.namedItem( "srid" );
-      myElement = myNode.toElement();
-      setSrid( myElement.text().toLong() );
+        myNode = srsNode.namedItem( "srsid" );
+        myElement = myNode.toElement();
+        setInternalId( myElement.text().toLong() );
 
-      myNode = srsNode.namedItem( "epsg" );
-      myElement = myNode.toElement();
-      setEpsg( myElement.text().toLong() );
+        myNode = srsNode.namedItem( "srid" );
+        myElement = myNode.toElement();
+        setSrid( myElement.text().toLong() );
 
-      myNode = srsNode.namedItem( "description" );
-      myElement = myNode.toElement();
-      setDescription( myElement.text() );
+        myNode = srsNode.namedItem( "epsg" );
+        myElement = myNode.toElement();
+        setEpsg( myElement.text().toLong() );
 
-      myNode = srsNode.namedItem( "projectionacronym" );
-      myElement = myNode.toElement();
-      setProjectionAcronym( myElement.text() );
+        myNode = srsNode.namedItem( "description" );
+        myElement = myNode.toElement();
+        setDescription( myElement.text() );
 
-      myNode = srsNode.namedItem( "ellipsoidacronym" );
-      myElement = myNode.toElement();
-      setEllipsoidAcronym( myElement.text() );
+        myNode = srsNode.namedItem( "projectionacronym" );
+        myElement = myNode.toElement();
+        setProjectionAcronym( myElement.text() );
 
-      myNode = srsNode.namedItem( "geographicflag" );
-      myElement = myNode.toElement();
-      if ( myElement.text().compare( "true" ) )
-      {
-        setGeographicFlag( true );
-      }
-      else
-      {
-        setGeographicFlag( false );
-      }
+        myNode = srsNode.namedItem( "ellipsoidacronym" );
+        myElement = myNode.toElement();
+        setEllipsoidAcronym( myElement.text() );
 
-      //make sure the map units have been set
-      setMapUnits();
+        myNode = srsNode.namedItem( "geographicflag" );
+        myElement = myNode.toElement();
+        if ( myElement.text().compare( "true" ) )
+        {
+          setGeographicFlag( true );
+        }
+        else
+        {
+          setGeographicFlag( false );
+        }
 
-      //@TODO this srs needs to be validated!!!
-      mIsValidFlag = true;//shamelessly hard coded for now
+        //make sure the map units have been set
+        setMapUnits();
+
+        //@TODO this srs needs to be validated!!!
+        mIsValidFlag = true;//shamelessly hard coded for now
+      }
     }
   }
   else



More information about the QGIS-commit mailing list