Skip to content
Permalink
Browse files

Catch inverse transform failures in raster reprojector. Fix for #5895

  • Loading branch information
homann committed Sep 12, 2012
1 parent b890e1f commit 87b9b5dd8a2769e52722d378df88e865f01306b3
Showing with 30 additions and 8 deletions.
  1. +30 −8 src/core/qgsrasterprojector.cpp
@@ -594,10 +594,21 @@ bool QgsRasterProjector::checkCols()
QgsPoint mySrcPoint3 = mCPMatrix[r+1][c];

QgsPoint mySrcApprox(( mySrcPoint1.x() + mySrcPoint3.x() ) / 2, ( mySrcPoint1.y() + mySrcPoint3.y() ) / 2 );
QgsPoint myDestApprox = mCoordinateTransform.transform( mySrcApprox, QgsCoordinateTransform::ReverseTransform );
double mySqrDist = myDestApprox.sqrDist( myDestPoint );
if ( mySqrDist > mSqrTolerance )
return false;
try
{
QgsPoint myDestApprox = mCoordinateTransform.transform( mySrcApprox, QgsCoordinateTransform::ReverseTransform );
double mySqrDist = myDestApprox.sqrDist( myDestPoint );
if ( mySqrDist > mSqrTolerance )
{
return false;
}
}
catch ( QgsCsException &e )
{
Q_UNUSED( e );
// Caught an error in transform
return false;
}
}
}
return true;
@@ -618,10 +629,21 @@ bool QgsRasterProjector::checkRows()
QgsPoint mySrcPoint3 = mCPMatrix[r][c+1];

QgsPoint mySrcApprox(( mySrcPoint1.x() + mySrcPoint3.x() ) / 2, ( mySrcPoint1.y() + mySrcPoint3.y() ) / 2 );
QgsPoint myDestApprox = mCoordinateTransform.transform( mySrcApprox, QgsCoordinateTransform::ReverseTransform );
double mySqrDist = myDestApprox.sqrDist( myDestPoint );
if ( mySqrDist > mSqrTolerance )
return false;
try
{
QgsPoint myDestApprox = mCoordinateTransform.transform( mySrcApprox, QgsCoordinateTransform::ReverseTransform );
double mySqrDist = myDestApprox.sqrDist( myDestPoint );
if ( mySqrDist > mSqrTolerance )
{
return false;
}
}
catch ( QgsCsException &e )
{
Q_UNUSED( e );
// Caught an error in transform
return false;
}
}
}
return true;

0 comments on commit 87b9b5d

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