Skip to content
Permalink
Browse files

fix #2315

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12640 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Dec 28, 2009
1 parent b179a59 commit d2d9cf9a08e03d3bfc5d2320aea009bdbfb5c0ba
Showing with 18 additions and 17 deletions.
  1. +18 −17 src/core/qgscoordinatetransform.cpp
@@ -22,7 +22,6 @@
//qt includes
#include <QDomNode>
#include <QDomElement>
#include <QTextStream>
#include <QApplication>
#include "qgslogger.h"

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

@@ -244,7 +243,7 @@ QgsPoint QgsCoordinateTransform::transform( const double theX, const double theY
catch ( QgsCsException &cse )
{
// rethrow the exception
QgsLogger::warning( "Throwing exception " + QString( __FILE__ ) + QString::number( __LINE__ ) );
QgsDebugMsg( "rethrowing exception" );
throw cse;
}
}
@@ -270,7 +269,7 @@ QgsRectangle QgsCoordinateTransform::transform( const QgsRectangle theRect, Tran
catch ( QgsCsException &cse )
{
// rethrow the exception
QgsLogger::warning( "Throwing exception " + QString( __FILE__ ) + QString::number( __LINE__ ) );
QgsDebugMsg( "rethrowing exception" );
throw cse;
}

@@ -304,7 +303,7 @@ void QgsCoordinateTransform::transformInPlace( double& x, double& y, double& z,
catch ( QgsCsException &cse )
{
// rethrow the exception
QgsLogger::warning( "Throwing exception " + QString( __FILE__ ) + QString::number( __LINE__ ) );
QgsDebugMsg( "rethrowing exception" );
throw cse;
}
}
@@ -330,7 +329,7 @@ void QgsCoordinateTransform::transformInPlace( std::vector<double>& x,
catch ( QgsCsException &cse )
{
// rethrow the exception
QgsLogger::warning( "Throwing exception " + QString( __FILE__ ) + QString::number( __LINE__ ) );
QgsDebugMsg( "rethrowing exception" );
throw cse;
}
}
@@ -394,7 +393,7 @@ QgsRectangle QgsCoordinateTransform::transformBoundingBox( const QgsRectangle re
catch ( QgsCsException &cse )
{
// rethrow the exception
QgsLogger::warning( "Throwing exception " + QString( __FILE__ ) + QString::number( __LINE__ ) );
QgsDebugMsg( "rethrowing exception" );
throw cse;
}

@@ -454,42 +453,44 @@ void QgsCoordinateTransform::transformCoords( const int& numPoints, double *x, d
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 );
}

0 comments on commit d2d9cf9

Please sign in to comment.
You can’t perform that action at this time.