454 |
454 |
if ( direction == ReverseTransform )
|
455 |
455 |
{
|
456 |
456 |
projResult = pj_transform( mDestinationProjection, mSourceProjection, numPoints, 0, x, y, z );
|
457 |
|
dir = "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";
|
465 |
463 |
}
|
466 |
464 |
|
467 |
465 |
if ( projResult != 0 )
|
468 |
466 |
{
|
469 |
467 |
//something bad happened....
|
470 |
|
QString msg;
|
471 |
|
QTextStream pjErr( &msg );
|
|
468 |
QString msg, coords;
|
472 |
469 |
|
473 |
|
pjErr << tr( "Failed" ) << " " << dir << " " << tr( "transform of" ) << '\n';
|
474 |
470 |
for ( int i = 0; i < numPoints; ++i )
|
475 |
471 |
{
|
476 |
472 |
if ( direction == ForwardTransform )
|
477 |
473 |
{
|
478 |
|
pjErr << "(" << x[i] << ", " << y[i] << ")\n";
|
|
474 |
coords.append(QString("(%1, %2)\n").arg(x[i]).arg(y[i]));
|
479 |
475 |
}
|
480 |
476 |
else
|
481 |
477 |
{
|
482 |
|
pjErr << "(" << x[i] * RAD_TO_DEG << ", " << y[i] * RAD_TO_DEG << ")\n";
|
|
478 |
coords.append(QString("(%1, %2)\n").arg(x[i] * RAD_TO_DEG).arg(y[i] * RAD_TO_DEG));
|
483 |
479 |
}
|
484 |
480 |
}
|
|
481 |
|
|
482 |
if ( direction == ReverseTransform ) {
|
|
483 |
msg = QString(tr( "Failed inverse transform of %1 with error %2" )).arg(coords).arg(pj_strerrno( projResult ));
|
|
484 |
}
|
|
485 |
else
|
|
486 |
{
|
|
487 |
msg = QString(tr( "Failed inverse transform of %1 with error %2" )).arg(coords).arg(pj_strerrno( projResult ));
|
|
488 |
}
|
485 |
489 |
|
486 |
|
pjErr << tr( "with error: " ) << QString::fromUtf8( pj_strerrno( projResult ) ) << '\n';
|
487 |
|
|
488 |
490 |
QgsDebugMsg( "Projection failed emitting invalid transform signal: " + QString( msg.toLocal8Bit().data() ) );
|
489 |
491 |
|
490 |
492 |
emit invalidTransformInput();
|