22
22
// qt includes
23
23
#include < QDomNode>
24
24
#include < QDomElement>
25
- #include < QTextStream>
26
25
#include < QApplication>
27
26
#include " qgslogger.h"
28
27
@@ -227,7 +226,7 @@ QgsPoint QgsCoordinateTransform::transform( const QgsPoint thePoint, TransformDi
227
226
catch ( QgsCsException &cse )
228
227
{
229
228
// rethrow the exception
230
- QgsLogger::warning ( " Throwing exception " + QString ( __FILE__ ) + QString::number ( __LINE__ ) );
229
+ QgsDebugMsg ( " rethrowing exception" );
231
230
throw cse;
232
231
}
233
232
@@ -244,7 +243,7 @@ QgsPoint QgsCoordinateTransform::transform( const double theX, const double theY
244
243
catch ( QgsCsException &cse )
245
244
{
246
245
// rethrow the exception
247
- QgsLogger::warning ( " Throwing exception " + QString ( __FILE__ ) + QString::number ( __LINE__ ) );
246
+ QgsDebugMsg ( " rethrowing exception" );
248
247
throw cse;
249
248
}
250
249
}
@@ -270,7 +269,7 @@ QgsRectangle QgsCoordinateTransform::transform( const QgsRectangle theRect, Tran
270
269
catch ( QgsCsException &cse )
271
270
{
272
271
// rethrow the exception
273
- QgsLogger::warning ( " Throwing exception " + QString ( __FILE__ ) + QString::number ( __LINE__ ) );
272
+ QgsDebugMsg ( " rethrowing exception" );
274
273
throw cse;
275
274
}
276
275
@@ -304,7 +303,7 @@ void QgsCoordinateTransform::transformInPlace( double& x, double& y, double& z,
304
303
catch ( QgsCsException &cse )
305
304
{
306
305
// rethrow the exception
307
- QgsLogger::warning ( " Throwing exception " + QString ( __FILE__ ) + QString::number ( __LINE__ ) );
306
+ QgsDebugMsg ( " rethrowing exception" );
308
307
throw cse;
309
308
}
310
309
}
@@ -330,7 +329,7 @@ void QgsCoordinateTransform::transformInPlace( std::vector<double>& x,
330
329
catch ( QgsCsException &cse )
331
330
{
332
331
// rethrow the exception
333
- QgsLogger::warning ( " Throwing exception " + QString ( __FILE__ ) + QString::number ( __LINE__ ) );
332
+ QgsDebugMsg ( " rethrowing exception" );
334
333
throw cse;
335
334
}
336
335
}
@@ -394,7 +393,7 @@ QgsRectangle QgsCoordinateTransform::transformBoundingBox( const QgsRectangle re
394
393
catch ( QgsCsException &cse )
395
394
{
396
395
// rethrow the exception
397
- QgsLogger::warning ( " Throwing exception " + QString ( __FILE__ ) + QString::number ( __LINE__ ) );
396
+ QgsDebugMsg ( " rethrowing exception" );
398
397
throw cse;
399
398
}
400
399
@@ -454,42 +453,44 @@ void QgsCoordinateTransform::transformCoords( const int& numPoints, double *x, d
454
453
if ( direction == ReverseTransform )
455
454
{
456
455
projResult = pj_transform ( mDestinationProjection , mSourceProjection , numPoints, 0 , x, y, z );
457
- dir = " inverse" ;
456
+ dir = tr ( " inverse" ) ;
458
457
}
459
458
else
460
459
{
461
460
assert ( mSourceProjection != 0 );
462
461
assert ( mDestinationProjection != 0 );
463
462
projResult = pj_transform ( mSourceProjection , mDestinationProjection , numPoints, 0 , x, y, z );
464
- dir = " forward" ;
463
+ dir = tr ( " forward" ) ;
465
464
}
466
465
467
466
if ( projResult != 0 )
468
467
{
469
468
// something bad happened....
470
- QString msg;
471
- QTextStream pjErr ( &msg );
469
+ QString points;
472
470
473
- pjErr << tr ( " Failed" ) << " " << dir << " " << tr ( " transform of" ) << ' \n ' ;
474
471
for ( int i = 0 ; i < numPoints; ++i )
475
472
{
476
473
if ( direction == ForwardTransform )
477
474
{
478
- pjErr << " ( " << x[i] << " , " << y[i] << " ) \n " ;
475
+ points += QString ( " (%1, %2) \n " ). arg ( x[i] ). arg ( y[i] ) ;
479
476
}
480
477
else
481
478
{
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 ) ;
483
480
}
484
481
}
485
482
486
- pjErr << tr ( " with error: " ) << QString::fromUtf8 ( pj_strerrno ( projResult ) ) << ' \n ' ;
483
+ QString msg = tr (" %1 transform of\n %2\n failed with error: %3\n " )
484
+ .arg ( dir )
485
+ .arg ( points )
486
+ .arg ( QString::fromUtf8 ( pj_strerrno ( projResult ) ) ) );
487
487
488
- QgsDebugMsg ( " Projection failed emitting invalid transform signal: " + QString ( msg. toLocal8Bit (). data () ) );
488
+ QgsDebugMsg ( " Projection failed emitting invalid transform signal: " + msg );
489
489
490
490
emit invalidTransformInput ();
491
491
492
- QgsLogger::warning ( " Throwing exception " + QString ( __FILE__ ) + QString::number ( __LINE__ ) );
492
+ QgsDebugMsg ( " throwing exception" );
493
+
493
494
throw QgsCsException ( msg );
494
495
}
495
496
0 commit comments