[QGIS Commit] r15646 - trunk/qgis/src/core
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Thu Mar 31 04:02:01 EDT 2011
Author: rblazek
Date: 2011-03-31 01:02:01 -0700 (Thu, 31 Mar 2011)
New Revision: 15646
Modified:
trunk/qgis/src/core/qgsrasterprojector.cpp
trunk/qgis/src/core/qgsrasterprojector.h
Log:
avoid fragile pointer
Modified: trunk/qgis/src/core/qgsrasterprojector.cpp
===================================================================
--- trunk/qgis/src/core/qgsrasterprojector.cpp 2011-03-30 20:12:49 UTC (rev 15645)
+++ trunk/qgis/src/core/qgsrasterprojector.cpp 2011-03-31 08:02:01 UTC (rev 15646)
@@ -35,13 +35,11 @@
, 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()
{
- delete mCoordinateTransform;
+ //delete mCoordinateTransform;
}
void QgsRasterProjector::calcSrcExtent()
@@ -381,7 +379,7 @@
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 @@
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 @@
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; }
}
Modified: trunk/qgis/src/core/qgsrasterprojector.h
===================================================================
--- trunk/qgis/src/core/qgsrasterprojector.h 2011-03-30 20:12:49 UTC (rev 15645)
+++ trunk/qgis/src/core/qgsrasterprojector.h 2011-03-31 08:02:01 UTC (rev 15646)
@@ -128,8 +128,7 @@
QgsCoordinateReferenceSystem mDestCRS;
/** Coordinate transform */
- /* QgsCoordinateTransform inherits from QObject and that is not copyable */
- QgsCoordinateTransform *mCoordinateTransform;
+ QgsCoordinateTransform mCoordinateTransform;
/** Destination extent */
QgsRectangle mDestExtent;
More information about the QGIS-commit
mailing list