diff --git a/src/qgscoordinatetransform.h b/src/qgscoordinatetransform.h index 72c156df485..be2874ea10b 100644 --- a/src/qgscoordinatetransform.h +++ b/src/qgscoordinatetransform.h @@ -157,7 +157,7 @@ inline QgsPoint QgsCoordinateTransform::transform(QgsPoint thePoint) if ( ! mSourceToDestXForm->Transform( 1, &x, &y ) ) { //something bad happened.... - throw QgsCsException(QString("Coordinate transform failed")); + //throw QgsCsException(QString("Coordinate transform failed")); } else { @@ -182,7 +182,7 @@ inline QgsRect QgsCoordinateTransform::transform(QgsRect theRect) if ( ! mSourceToDestXForm->Transform( 1, &x1, &y1 ) || ! mSourceToDestXForm->Transform( 1, &x2, &y2 ) ) { //something bad happened.... - throw QgsCsException(QString("Coordinate transform failed")); + //throw QgsCsException(QString("Coordinate transform failed")); } else { @@ -220,7 +220,7 @@ inline QgsRect QgsCoordinateTransform::transform(QgsRect * theRect) if ( ! mSourceToDestXForm->Transform( 1, &x1, &y1 ) || ! mSourceToDestXForm->Transform( 1, &x2, &y2 ) ) { //something bad happened.... - throw QgsCsException(QString("Coordinate transform failed")); + //throw QgsCsException(QString("Coordinate transform failed")); } else { @@ -254,7 +254,7 @@ inline QgsPoint QgsCoordinateTransform::transform(double theX, double theY) if ( ! mSourceToDestXForm->Transform( 1, &x, &y ) ) { //something bad happened.... - throw QgsCsException(QString("Coordinate transform failed")); + //throw QgsCsException(QString("Coordinate transform failed")); } else { @@ -300,21 +300,33 @@ inline QgsPoint QgsCoordinateTransform::inverseTransform(QgsPoint thePoint) inline QgsRect QgsCoordinateTransform::inverseTransform(QgsRect theRect) { if (mShortCircuit || !mInitialisedFlag) return theRect; -#ifdef QGISDEBUG - std::cout << "Rect inverse projection..." << std::endl; -#endif - // transform x + // transform x double x1 = theRect.xMin(); double y1 = theRect.yMin(); double x2 = theRect.xMax(); double y2 = theRect.yMax(); - // Number of points to reproject------+ - // | - // V - if ( ! mDestToSourceXForm->Transform( 1, &x1, &y1 ) || ! mDestToSourceXForm->Transform( 1, &x2, &y2 ) ) +#ifdef QGISDEBUG + + std::cout << "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv"<< std::endl; + std::cout << "Rect inverse projection..." << std::endl; + std::cout << "INPUT: " << std::endl << mSourceWKT << std::endl; + std::cout << "OUTPUT: " << std::endl << mDestWKT << std::endl; + std::cout << "INPUT RECT: " << std::endl << x1 << "," << y1 << ":" << x2 << "," << y2 << std::endl; + std::cout << "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" << std::endl; +#endif + + CPLPushErrorHandler( CPLQuietErrorHandler ); + // Number of points to reproject---------------+ + // | + // V + int myResult1 = mDestToSourceXForm->Transform( 1, &x1, &y1 ); + int myResult2 = mDestToSourceXForm->Transform( 1, &x2, &y2 ); + CPLPopErrorHandler(); + + if ( ! myResult1 || ! myResult2 ) { //something bad happened.... - throw QgsCsException(QString("Coordinate inverse transform failed")); + // throw QgsCsException(QString("Coordinate inverse transform failed")); } else { @@ -351,12 +363,12 @@ inline QgsRect QgsCoordinateTransform::inverseTransform(QgsRect * theRect) if ( ! mDestToSourceXForm->Transform( 1, &x1, &y1 ) || ! mDestToSourceXForm->Transform( 1, &x2, &y2 ) ) { //something bad happened.... - throw QgsCsException(QString("Inverse Coordinate transform failed")); + //throw QgsCsException(QString("Inverse Coordinate transform failed")); } else { #ifdef QGISDEBUG - std::cout << "Rect inverse projection..." + std::cout << "Rect pointer inverse projection..." << "Xmin : " << theRect->xMin() << "-->" << x1 @@ -384,7 +396,7 @@ inline QgsPoint QgsCoordinateTransform::inverseTransform(double theX, double the if ( ! mDestToSourceXForm->Transform( 1, &x, &y ) ) { //something bad happened.... - throw QgsCsException(QString("Coordinate inverseTransform failed")); + //throw QgsCsException(QString("Coordinate inverseTransform failed")); } else {