Skip to content

Commit

Permalink
catch more transformation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jan 26, 2012
1 parent e39e766 commit 3091149
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
19 changes: 11 additions & 8 deletions src/core/qgscoordinatetransform.cpp 100644 → 100755
Expand Up @@ -15,7 +15,7 @@
* *
***************************************************************************/
#include "qgscoordinatetransform.h"
#include "qgsmessageoutput.h"
#include "qgsmessagelog.h"
#include "qgslogger.h"

//qt includes
Expand Down Expand Up @@ -496,6 +496,11 @@ QgsRectangle QgsCoordinateTransform::transformBoundingBox( const QgsRectangle re

QgsDebugMsg( "Projected extent: " + QString(( bb_rect.toString() ).toLocal8Bit().data() ) );

if ( bb_rect.isEmpty() )
{
QgsMessageLog::logMessage( tr( "Reprojected extent is empty. Original extent: %1" ).arg( rect.toString() ), tr( "CRS" ) );
}

return bb_rect;
}

Expand All @@ -504,17 +509,15 @@ void QgsCoordinateTransform::transformCoords( const int& numPoints, double *x, d
// Refuse to transform the points if the srs's are invalid
if ( !mSourceCRS.isValid() )
{
QgsLogger::critical( tr( "The source spatial reference system (CRS) is not valid. " )
+ tr( "The coordinates can not be reprojected."
" The CRS is: %1" )
.arg( mSourceCRS.toProj4() ) );
QgsMessageLog::logMessage( tr( "The source spatial reference system (CRS) is not valid. "
"The coordinates can not be reprojected. The CRS is: %1" )
.arg( mSourceCRS.toProj4() ), tr( "CRS" ) );
return;
}
if ( !mDestCRS.isValid() )
{
QgsLogger::critical( tr( "The destination spatial reference system (CRS) is not valid. " )
+ tr( "The coordinates can not be reprojected."
" The CRS is: %1" ).arg( mDestCRS.toProj4() ) );
QgsMessageLog::logMessage( tr( "The destination spatial reference system (CRS) is not valid. "
"The coordinates can not be reprojected. The CRS is: %1" ).arg( mDestCRS.toProj4() ), tr( "CRS" ) );
return;
}

Expand Down
9 changes: 3 additions & 6 deletions src/core/qgsmaprenderer.cpp 100644 → 100755
Expand Up @@ -18,6 +18,7 @@

#include "qgscoordinatetransform.h"
#include "qgslogger.h"
#include "qgsmessagelog.h"
#include "qgsmaprenderer.h"
#include "qgsscalecalculator.h"
#include "qgsmaptopixel.h"
Expand Down Expand Up @@ -766,14 +767,10 @@ QgsRectangle QgsMapRenderer::layerExtentToOutputExtent( QgsMapLayer* theLayer, Q
}
catch ( QgsCsException &cse )
{
Q_UNUSED( cse );
QgsDebugMsg( QString( "Transform error caught: " ).arg( cse.what() ) );
QgsMessageLog::logMessage( tr( "Transform error caught: %1" ).arg( cse.what() ), tr( "CRS" ) );
}
}
else
{
// leave extent unchanged
}

QgsDebugMsg( QString( "proj extent = " + extent.toString() ) );

return extent;
Expand Down

0 comments on commit 3091149

Please sign in to comment.