Skip to content
Permalink
Browse files
avoid fragile pointer
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15646 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Mar 31, 2011
1 parent 01ebf04 commit b138d2cdb6132d5eabd87dd9aa20897b3c52029d
Showing with 6 additions and 9 deletions.
  1. +5 −7 src/core/qgsrasterprojector.cpp
  2. +1 −2 src/core/qgsrasterprojector.h
@@ -35,13 +35,11 @@ QgsRasterProjector::QgsRasterProjector(
, mExtent( theExtent )
, mDestRows( theDestRows ), mDestCols( theDestCols )
, mMaxSrcXRes( theMaxSrcXRes ), mMaxSrcYRes( theMaxSrcYRes )
, mCoordinateTransform( theDestCRS, theSrcCRS )
{
QgsDebugMsg( "Entered" );
QgsDebugMsg( "theDestExtent = " + theDestExtent.toString() );

// reverse transformation
mCoordinateTransform = new QgsCoordinateTransform( theDestCRS, theSrcCRS );

mDestXRes = mDestExtent.width() / ( mDestCols );
mDestYRes = mDestExtent.height() / ( mDestRows );

@@ -115,7 +113,7 @@ QgsRasterProjector::QgsRasterProjector(

QgsRasterProjector::~QgsRasterProjector()
{
delete mCoordinateTransform;
//delete mCoordinateTransform;
}

void QgsRasterProjector::calcSrcExtent()
@@ -381,7 +379,7 @@ void QgsRasterProjector::calcCP( int theRow, int theCol )
destPointOnCPMatrix( theRow, theCol, &myDestX, &myDestY );
QgsPoint myDestPoint( myDestX, myDestY );

mCPMatrix[theRow][theCol] = mCoordinateTransform->transform( myDestPoint );
mCPMatrix[theRow][theCol] = mCoordinateTransform.transform( myDestPoint );
}

bool QgsRasterProjector::calcRow( int theRow )
@@ -421,7 +419,7 @@ 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 );
QgsPoint myDestApprox = mCoordinateTransform.transform( mySrcApprox, QgsCoordinateTransform::ReverseTransform );
double mySqrDist = myDestApprox.sqrDist( myDestPoint );
if ( mySqrDist > mSqrTolerance ) { return false; }
}
@@ -444,7 +442,7 @@ 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 );
QgsPoint myDestApprox = mCoordinateTransform.transform( mySrcApprox, QgsCoordinateTransform::ReverseTransform );
double mySqrDist = myDestApprox.sqrDist( myDestPoint );
if ( mySqrDist > mSqrTolerance ) { return false; }
}
@@ -128,8 +128,7 @@ class QgsRasterProjector
QgsCoordinateReferenceSystem mDestCRS;

/** Coordinate transform */
/* QgsCoordinateTransform inherits from QObject and that is not copyable */
QgsCoordinateTransform *mCoordinateTransform;
QgsCoordinateTransform mCoordinateTransform;

/** Destination extent */
QgsRectangle mDestExtent;

0 comments on commit b138d2c

Please sign in to comment.