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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Dec 28 16:33:39 EST 2009


Author: jef
Date: 2009-12-28 16:33:39 -0500 (Mon, 28 Dec 2009)
New Revision: 12640

Modified:
   trunk/qgis/src/core/qgscoordinatetransform.cpp
Log:
fix #2315

Modified: trunk/qgis/src/core/qgscoordinatetransform.cpp
===================================================================
--- trunk/qgis/src/core/qgscoordinatetransform.cpp	2009-12-28 21:32:09 UTC (rev 12639)
+++ trunk/qgis/src/core/qgscoordinatetransform.cpp	2009-12-28 21:33:39 UTC (rev 12640)
@@ -22,7 +22,6 @@
 //qt includes
 #include <QDomNode>
 #include <QDomElement>
-#include <QTextStream>
 #include <QApplication>
 #include "qgslogger.h"
 
@@ -227,7 +226,7 @@
   catch ( QgsCsException &cse )
   {
     // rethrow the exception
-    QgsLogger::warning( "Throwing exception " + QString( __FILE__ ) + QString::number( __LINE__ ) );
+    QgsDebugMsg( "rethrowing exception" );
     throw cse;
   }
 
@@ -244,7 +243,7 @@
   catch ( QgsCsException &cse )
   {
     // rethrow the exception
-    QgsLogger::warning( "Throwing exception " + QString( __FILE__ ) + QString::number( __LINE__ ) );
+    QgsDebugMsg( "rethrowing exception" );
     throw cse;
   }
 }
@@ -270,7 +269,7 @@
   catch ( QgsCsException &cse )
   {
     // rethrow the exception
-    QgsLogger::warning( "Throwing exception " + QString( __FILE__ ) + QString::number( __LINE__ ) );
+    QgsDebugMsg( "rethrowing exception" );
     throw cse;
   }
 
@@ -304,7 +303,7 @@
   catch ( QgsCsException &cse )
   {
     // rethrow the exception
-    QgsLogger::warning( "Throwing exception " + QString( __FILE__ ) + QString::number( __LINE__ ) );
+    QgsDebugMsg( "rethrowing exception" );
     throw cse;
   }
 }
@@ -330,7 +329,7 @@
   catch ( QgsCsException &cse )
   {
     // rethrow the exception
-    QgsLogger::warning( "Throwing exception " + QString( __FILE__ ) + QString::number( __LINE__ ) );
+    QgsDebugMsg( "rethrowing exception" );
     throw cse;
   }
 }
@@ -394,7 +393,7 @@
   catch ( QgsCsException &cse )
   {
     // rethrow the exception
-    QgsLogger::warning( "Throwing exception " + QString( __FILE__ ) + QString::number( __LINE__ ) );
+    QgsDebugMsg( "rethrowing exception" );
     throw cse;
   }
 
@@ -454,42 +453,44 @@
   if ( direction == ReverseTransform )
   {
     projResult = pj_transform( mDestinationProjection, mSourceProjection, numPoints, 0, x, y, z );
-    dir = "inverse";
+    dir = tr( "inverse" );
   }
   else
   {
     assert( mSourceProjection != 0 );
     assert( mDestinationProjection != 0 );
     projResult = pj_transform( mSourceProjection, mDestinationProjection, numPoints, 0, x, y, z );
-    dir = "forward";
+    dir = tr( "forward" );
   }
 
   if ( projResult != 0 )
   {
     //something bad happened....
-    QString msg;
-    QTextStream pjErr( &msg );
+    QString points;
 
-    pjErr << tr( "Failed" ) << " " << dir << " " << tr( "transform of" ) << '\n';
     for ( int i = 0; i < numPoints; ++i )
     {
       if ( direction == ForwardTransform )
       {
-        pjErr << "(" << x[i] << ", " << y[i] << ")\n";
+        points += QString("(%1, %2)\n").arg( x[i] ).arg( y[i] );
       }
       else
       {
-        pjErr << "(" << x[i] * RAD_TO_DEG << ", " << y[i] * RAD_TO_DEG << ")\n";
+        points += QString("(%1, %2)\n").arg( x[i]*RAD_TO_DEG ).arg( y[i]*RAD_TO_DEG );
       }
     }
 
-    pjErr << tr( "with error: " ) << QString::fromUtf8( pj_strerrno( projResult ) ) << '\n';
+    QString msg = tr("%1 transform of\n%2\nfailed with error: %3\n")
+	                  .arg( dir )
+	                  .arg( points )
+	                  .arg( QString::fromUtf8( pj_strerrno( projResult ) ) ) );
 
-    QgsDebugMsg( "Projection failed emitting invalid transform signal: " + QString( msg.toLocal8Bit().data() ) );
+    QgsDebugMsg( "Projection failed emitting invalid transform signal: " + msg );
 
     emit invalidTransformInput();
 
-    QgsLogger::warning( "Throwing exception " + QString( __FILE__ ) + QString::number( __LINE__ ) );
+    QgsDebugMsg( "throwing exception" );
+
     throw  QgsCsException( msg );
   }
 



More information about the QGIS-commit mailing list