bool QgsRasterProjector::checkRows() { for ( int r = 0; r < mCPRows; r++ ) { for ( int c = 1; c < mCPCols - 1; c += 2 ) { double myDestX, myDestY; destPointOnCPMatrix( r, c, &myDestX, &myDestY ); QgsPoint myDestPoint( myDestX, myDestY ); QgsPoint mySrcPoint1 = mCPMatrix[r][c-1]; QgsPoint mySrcPoint2 = mCPMatrix[r][c]; QgsPoint mySrcPoint3 = mCPMatrix[r][c+1]; QgsPoint mySrcApprox(( mySrcPoint1.x() + mySrcPoint3.x() ) / 2, ( mySrcPoint1.y() + mySrcPoint3.y() ) / 2 ); 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; }
bool ProjectorData::checkRows( const QgsCoordinateTransform &ct ) { if ( !ct.isValid() ) { return false; } for ( int r = 0; r < mCPRows; r++ ) { for ( int c = 1; c < mCPCols - 1; c += 2 ) { double myDestX, myDestY; destPointOnCPMatrix( r, c, &myDestX, &myDestY ); QgsPointXY myDestPoint( myDestX, myDestY ); QgsPointXY mySrcPoint1 = mCPMatrix[r][c - 1]; QgsPointXY mySrcPoint2 = mCPMatrix[r][c]; QgsPointXY mySrcPoint3 = mCPMatrix[r][c + 1]; QgsPointXY mySrcApprox( ( mySrcPoint1.x() + mySrcPoint3.x() ) / 2, ( mySrcPoint1.y() + mySrcPoint3.y() ) / 2 ); if ( !mCPLegalMatrix[r][c - 1] || !mCPLegalMatrix[r][c] || !mCPLegalMatrix[r][c + 1] ) { // There was an error earlier in transform, just abort return false; } try { QgsPointXY myDestApprox = ct.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; }
bool QgsRasterProjector::checkCols() { for ( int c = 0; c < mCPCols; c++ ) { for ( int r = 1; r < mCPRows - 1; r += 2 ) { double myDestX, myDestY; destPointOnCPMatrix( r, c, &myDestX, &myDestY ); QgsPoint myDestPoint( myDestX, myDestY ); QgsPoint mySrcPoint1 = mCPMatrix[r-1][c]; QgsPoint mySrcPoint2 = mCPMatrix[r][c]; QgsPoint mySrcPoint3 = mCPMatrix[r+1][c]; QgsPoint mySrcApprox(( mySrcPoint1.x() + mySrcPoint3.x() ) / 2, ( mySrcPoint1.y() + mySrcPoint3.y() ) / 2 ); if ( !mCPLegalMatrix[r-1][c] || !mCPLegalMatrix[r][c] || !mCPLegalMatrix[r+1][c] ) { // There was an error earlier in transform, just abort 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; }
bool QgsRasterProjector::checkCols() { for ( int c = 0; c < mCPCols; c++ ) { for ( int r = 1; r < mCPRows - 1; r += 2 ) { double myDestX, myDestY; destPointOnCPMatrix( r, c, &myDestX, &myDestY ); QgsPoint myDestPoint( myDestX, myDestY ); QgsPoint mySrcPoint1 = mCPMatrix[r-1][c]; QgsPoint mySrcPoint2 = mCPMatrix[r][c]; 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; } } return true; }