Skip to content
Permalink
Browse files

catch more transformation errors

  • Loading branch information
jef-n committed Jan 26, 2012
1 parent e39e766 commit 3091149a98e10c2bf7b89f3112f4f75708005b7c
Showing with 14 additions and 14 deletions.
  1. +11 −8 src/core/qgscoordinatetransform.cpp
  2. +3 −6 src/core/qgsmaprenderer.cpp
@@ -15,7 +15,7 @@
* *
***************************************************************************/
#include "qgscoordinatetransform.h"
#include "qgsmessageoutput.h"
#include "qgsmessagelog.h"
#include "qgslogger.h"

//qt includes
@@ -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;
}

@@ -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;
}

9 src/core/qgsmaprenderer.cpp 100644 → 100755
@@ -18,6 +18,7 @@

#include "qgscoordinatetransform.h"
#include "qgslogger.h"
#include "qgsmessagelog.h"
#include "qgsmaprenderer.h"
#include "qgsscalecalculator.h"
#include "qgsmaptopixel.h"
@@ -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;

0 comments on commit 3091149

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