Skip to content

Commit a13c99d

Browse files
author
jef
committed
fix #2315
git-svn-id: http://svn.osgeo.org/qgis/trunk@12640 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent c122111 commit a13c99d

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

src/core/qgscoordinatetransform.cpp

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
//qt includes
2323
#include <QDomNode>
2424
#include <QDomElement>
25-
#include <QTextStream>
2625
#include <QApplication>
2726
#include "qgslogger.h"
2827

@@ -227,7 +226,7 @@ QgsPoint QgsCoordinateTransform::transform( const QgsPoint thePoint, TransformDi
227226
catch ( QgsCsException &cse )
228227
{
229228
// rethrow the exception
230-
QgsLogger::warning( "Throwing exception " + QString( __FILE__ ) + QString::number( __LINE__ ) );
229+
QgsDebugMsg( "rethrowing exception" );
231230
throw cse;
232231
}
233232

@@ -244,7 +243,7 @@ QgsPoint QgsCoordinateTransform::transform( const double theX, const double theY
244243
catch ( QgsCsException &cse )
245244
{
246245
// rethrow the exception
247-
QgsLogger::warning( "Throwing exception " + QString( __FILE__ ) + QString::number( __LINE__ ) );
246+
QgsDebugMsg( "rethrowing exception" );
248247
throw cse;
249248
}
250249
}
@@ -270,7 +269,7 @@ QgsRectangle QgsCoordinateTransform::transform( const QgsRectangle theRect, Tran
270269
catch ( QgsCsException &cse )
271270
{
272271
// rethrow the exception
273-
QgsLogger::warning( "Throwing exception " + QString( __FILE__ ) + QString::number( __LINE__ ) );
272+
QgsDebugMsg( "rethrowing exception" );
274273
throw cse;
275274
}
276275

@@ -304,7 +303,7 @@ void QgsCoordinateTransform::transformInPlace( double& x, double& y, double& z,
304303
catch ( QgsCsException &cse )
305304
{
306305
// rethrow the exception
307-
QgsLogger::warning( "Throwing exception " + QString( __FILE__ ) + QString::number( __LINE__ ) );
306+
QgsDebugMsg( "rethrowing exception" );
308307
throw cse;
309308
}
310309
}
@@ -330,7 +329,7 @@ void QgsCoordinateTransform::transformInPlace( std::vector<double>& x,
330329
catch ( QgsCsException &cse )
331330
{
332331
// rethrow the exception
333-
QgsLogger::warning( "Throwing exception " + QString( __FILE__ ) + QString::number( __LINE__ ) );
332+
QgsDebugMsg( "rethrowing exception" );
334333
throw cse;
335334
}
336335
}
@@ -394,7 +393,7 @@ QgsRectangle QgsCoordinateTransform::transformBoundingBox( const QgsRectangle re
394393
catch ( QgsCsException &cse )
395394
{
396395
// rethrow the exception
397-
QgsLogger::warning( "Throwing exception " + QString( __FILE__ ) + QString::number( __LINE__ ) );
396+
QgsDebugMsg( "rethrowing exception" );
398397
throw cse;
399398
}
400399

@@ -454,42 +453,44 @@ void QgsCoordinateTransform::transformCoords( const int& numPoints, double *x, d
454453
if ( direction == ReverseTransform )
455454
{
456455
projResult = pj_transform( mDestinationProjection, mSourceProjection, numPoints, 0, x, y, z );
457-
dir = "inverse";
456+
dir = tr( "inverse" );
458457
}
459458
else
460459
{
461460
assert( mSourceProjection != 0 );
462461
assert( mDestinationProjection != 0 );
463462
projResult = pj_transform( mSourceProjection, mDestinationProjection, numPoints, 0, x, y, z );
464-
dir = "forward";
463+
dir = tr( "forward" );
465464
}
466465

467466
if ( projResult != 0 )
468467
{
469468
//something bad happened....
470-
QString msg;
471-
QTextStream pjErr( &msg );
469+
QString points;
472470

473-
pjErr << tr( "Failed" ) << " " << dir << " " << tr( "transform of" ) << '\n';
474471
for ( int i = 0; i < numPoints; ++i )
475472
{
476473
if ( direction == ForwardTransform )
477474
{
478-
pjErr << "(" << x[i] << ", " << y[i] << ")\n";
475+
points += QString("(%1, %2)\n").arg( x[i] ).arg( y[i] );
479476
}
480477
else
481478
{
482-
pjErr << "(" << x[i] * RAD_TO_DEG << ", " << y[i] * RAD_TO_DEG << ")\n";
479+
points += QString("(%1, %2)\n").arg( x[i]*RAD_TO_DEG ).arg( y[i]*RAD_TO_DEG );
483480
}
484481
}
485482

486-
pjErr << tr( "with error: " ) << QString::fromUtf8( pj_strerrno( projResult ) ) << '\n';
483+
QString msg = tr("%1 transform of\n%2\nfailed with error: %3\n")
484+
.arg( dir )
485+
.arg( points )
486+
.arg( QString::fromUtf8( pj_strerrno( projResult ) ) ) );
487487

488-
QgsDebugMsg( "Projection failed emitting invalid transform signal: " + QString( msg.toLocal8Bit().data() ) );
488+
QgsDebugMsg( "Projection failed emitting invalid transform signal: " + msg );
489489

490490
emit invalidTransformInput();
491491

492-
QgsLogger::warning( "Throwing exception " + QString( __FILE__ ) + QString::number( __LINE__ ) );
492+
QgsDebugMsg( "throwing exception" );
493+
493494
throw QgsCsException( msg );
494495
}
495496

0 commit comments

Comments
 (0)