Skip to content

Commit dc3272a

Browse files
committedNov 16, 2013
Consider datum transform in raster projector
1 parent 836e1a8 commit dc3272a

File tree

5 files changed

+144
-49
lines changed

5 files changed

+144
-49
lines changed
 

‎python/core/raster/qgsrasterprojector.sip

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ class QgsRasterProjector : QgsRasterInterface
1313
* it calculates grid of points in source CRS for target CRS + extent
1414
* which are used to calculate affine transformation matrices.
1515
*/
16+
17+
QgsRasterProjector(
18+
QgsCoordinateReferenceSystem theSrcCRS,
19+
QgsCoordinateReferenceSystem theDestCRS,
20+
int theSrcDatumTransform,
21+
int theDestDatumTransform,
22+
QgsRectangle theDestExtent,
23+
int theDestRows, int theDestCols,
24+
double theMaxSrcXRes, double theMaxSrcYRes,
25+
QgsRectangle theExtent
26+
);
27+
1628
QgsRasterProjector(
1729
QgsCoordinateReferenceSystem theSrcCRS,
1830
QgsCoordinateReferenceSystem theDestCRS,
@@ -39,7 +51,7 @@ class QgsRasterProjector : QgsRasterInterface
3951
int dataType( int bandNo ) const;
4052

4153
/** \brief set source and destination CRS */
42-
void setCRS( const QgsCoordinateReferenceSystem & theSrcCRS, const QgsCoordinateReferenceSystem & theDestCRS );
54+
void setCRS( const QgsCoordinateReferenceSystem & theSrcCRS, const QgsCoordinateReferenceSystem & theDestCRS, int srcDatumTransform = -1, int destDatumTransform = -1 );
4355

4456
/** \brief Get source CRS */
4557
QgsCoordinateReferenceSystem srcCrs() const;

‎src/core/raster/qgsrasterlayer.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,11 +333,15 @@ bool QgsRasterLayer::draw( QgsRenderContext& rendererContext )
333333
{
334334
myRasterViewPort->mSrcCRS = crs();
335335
myRasterViewPort->mDestCRS = rendererContext.coordinateTransform()->destCRS();
336+
myRasterViewPort->mSrcDatumTransform = rendererContext.coordinateTransform()->sourceDatumTransform();
337+
myRasterViewPort->mDestDatumTransform = rendererContext.coordinateTransform()->destinationDatumTransform();
336338
}
337339
else
338340
{
339341
myRasterViewPort->mSrcCRS = QgsCoordinateReferenceSystem(); // will be invalid
340342
myRasterViewPort->mDestCRS = QgsCoordinateReferenceSystem(); // will be invalid
343+
myRasterViewPort->mSrcDatumTransform = -1;
344+
myRasterViewPort->mDestDatumTransform = -1;
341345
}
342346

343347
// get dimensions of clipped raster image in device coordinate space (this is the size of the viewport)
@@ -423,7 +427,7 @@ void QgsRasterLayer::draw( QPainter * theQPainter,
423427
// params in QgsRasterProjector
424428
if ( projector )
425429
{
426-
projector->setCRS( theRasterViewPort->mSrcCRS, theRasterViewPort->mDestCRS );
430+
projector->setCRS( theRasterViewPort->mSrcCRS, theRasterViewPort->mDestCRS, theRasterViewPort->mSrcDatumTransform, theRasterViewPort->mDestDatumTransform );
427431
}
428432

429433
// Drawer to pipe?
@@ -1257,6 +1261,8 @@ QPixmap QgsRasterLayer::previewAsPixmap( QSize size, QColor bgColor )
12571261
myRasterViewPort->mDrawnExtent = myExtent;
12581262
myRasterViewPort->mSrcCRS = QgsCoordinateReferenceSystem(); // will be invalid
12591263
myRasterViewPort->mDestCRS = QgsCoordinateReferenceSystem(); // will be invalid
1264+
myRasterViewPort->mSrcDatumTransform = -1;
1265+
myRasterViewPort->mDestDatumTransform = -1;
12601266

12611267
QgsMapToPixel *myMapToPixel = new QgsMapToPixel( myMapUnitsPerPixel );
12621268

‎src/core/raster/qgsrasterprojector.cpp

Lines changed: 93 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,25 @@
1616
***************************************************************************/
1717

1818
#include "qgsrasterdataprovider.h"
19+
#include "qgscrscache.h"
1920
#include "qgslogger.h"
2021
#include "qgsrasterprojector.h"
2122
#include "qgscoordinatetransform.h"
2223

2324
QgsRasterProjector::QgsRasterProjector(
2425
QgsCoordinateReferenceSystem theSrcCRS,
2526
QgsCoordinateReferenceSystem theDestCRS,
27+
int theSrcDatumTransform,
28+
int theDestDatumTransform,
2629
QgsRectangle theDestExtent,
2730
int theDestRows, int theDestCols,
2831
double theMaxSrcXRes, double theMaxSrcYRes,
2932
QgsRectangle theExtent )
3033
: QgsRasterInterface( 0 )
3134
, mSrcCRS( theSrcCRS )
3235
, mDestCRS( theDestCRS )
33-
, mCoordinateTransform( theDestCRS, theSrcCRS )
36+
, mSrcDatumTransform( theSrcDatumTransform )
37+
, mDestDatumTransform( theDestDatumTransform )
3438
, mDestExtent( theDestExtent )
3539
, mExtent( theExtent )
3640
, mDestRows( theDestRows ), mDestCols( theDestCols )
@@ -46,22 +50,46 @@ QgsRasterProjector::QgsRasterProjector(
4650
QgsRasterProjector::QgsRasterProjector(
4751
QgsCoordinateReferenceSystem theSrcCRS,
4852
QgsCoordinateReferenceSystem theDestCRS,
53+
QgsRectangle theDestExtent,
54+
int theDestRows, int theDestCols,
4955
double theMaxSrcXRes, double theMaxSrcYRes,
5056
QgsRectangle theExtent )
5157
: QgsRasterInterface( 0 )
5258
, mSrcCRS( theSrcCRS )
5359
, mDestCRS( theDestCRS )
54-
, mCoordinateTransform( theDestCRS, theSrcCRS )
60+
, mSrcDatumTransform( -1 )
61+
, mDestDatumTransform( -1 )
62+
, mDestExtent( theDestExtent )
5563
, mExtent( theExtent )
64+
, mDestRows( theDestRows ), mDestCols( theDestCols )
5665
, pHelperTop( 0 ), pHelperBottom( 0 )
5766
, mMaxSrcXRes( theMaxSrcXRes ), mMaxSrcYRes( theMaxSrcYRes )
5867
{
5968
QgsDebugMsg( "Entered" );
69+
QgsDebugMsg( "theDestExtent = " + theDestExtent.toString() );
70+
71+
calc();
6072
}
6173

62-
QgsRasterProjector::QgsRasterProjector()
74+
QgsRasterProjector::QgsRasterProjector(
75+
QgsCoordinateReferenceSystem theSrcCRS,
76+
QgsCoordinateReferenceSystem theDestCRS,
77+
double theMaxSrcXRes, double theMaxSrcYRes,
78+
QgsRectangle theExtent )
6379
: QgsRasterInterface( 0 )
80+
, mSrcCRS( theSrcCRS )
81+
, mDestCRS( theDestCRS )
82+
, mSrcDatumTransform( -1 )
83+
, mDestDatumTransform( -1 )
84+
, mExtent( theExtent )
6485
, pHelperTop( 0 ), pHelperBottom( 0 )
86+
, mMaxSrcXRes( theMaxSrcXRes ), mMaxSrcYRes( theMaxSrcYRes )
87+
{
88+
QgsDebugMsg( "Entered" );
89+
}
90+
91+
QgsRasterProjector::QgsRasterProjector()
92+
: QgsRasterInterface( 0 ), mSrcDatumTransform( -1 ), mDestDatumTransform( -1 ) , pHelperTop( 0 ), pHelperBottom( 0 )
6593
{
6694
QgsDebugMsg( "Entered" );
6795
}
@@ -71,11 +99,11 @@ QgsRasterProjector::QgsRasterProjector( const QgsRasterProjector &projector )
7199
{
72100
mSrcCRS = projector.mSrcCRS;
73101
mDestCRS = projector.mDestCRS;
102+
mSrcDatumTransform = projector.mSrcDatumTransform;
103+
mDestDatumTransform = projector.mDestDatumTransform;
74104
mMaxSrcXRes = projector.mMaxSrcXRes;
75105
mMaxSrcYRes = projector.mMaxSrcYRes;
76106
mExtent = projector.mExtent;
77-
mCoordinateTransform.setSourceCrs( mSrcCRS );
78-
mCoordinateTransform.setDestCRS( mDestCRS );
79107
}
80108

81109
QgsRasterProjector & QgsRasterProjector::operator=( const QgsRasterProjector & projector )
@@ -84,11 +112,11 @@ QgsRasterProjector & QgsRasterProjector::operator=( const QgsRasterProjector & p
84112
{
85113
mSrcCRS = projector.mSrcCRS;
86114
mDestCRS = projector.mDestCRS;
115+
mSrcDatumTransform = projector.mSrcDatumTransform;
116+
mDestDatumTransform = projector.mDestDatumTransform;
87117
mMaxSrcXRes = projector.mMaxSrcXRes;
88118
mMaxSrcYRes = projector.mMaxSrcYRes;
89119
mExtent = projector.mExtent;
90-
mCoordinateTransform.setSourceCrs( mSrcCRS );
91-
mCoordinateTransform.setDestCRS( mDestCRS );
92120
}
93121
return *this;
94122
}
@@ -97,6 +125,8 @@ QgsRasterInterface * QgsRasterProjector::clone() const
97125
{
98126
QgsDebugMsg( "Entered" );
99127
QgsRasterProjector * projector = new QgsRasterProjector( mSrcCRS, mDestCRS, mMaxSrcXRes, mMaxSrcYRes, mExtent );
128+
projector->mSrcDatumTransform = mSrcDatumTransform;
129+
projector->mDestDatumTransform = mDestDatumTransform;
100130
return projector;
101131
}
102132

@@ -120,12 +150,12 @@ QGis::DataType QgsRasterProjector::dataType( int bandNo ) const
120150
return QGis::UnknownDataType;
121151
}
122152

123-
void QgsRasterProjector::setCRS( const QgsCoordinateReferenceSystem & theSrcCRS, const QgsCoordinateReferenceSystem & theDestCRS )
153+
void QgsRasterProjector::setCRS( const QgsCoordinateReferenceSystem & theSrcCRS, const QgsCoordinateReferenceSystem & theDestCRS, int srcDatumTransform, int destDatumTransform )
124154
{
125155
mSrcCRS = theSrcCRS;
126156
mDestCRS = theDestCRS;
127-
mCoordinateTransform.setSourceCrs( theDestCRS );
128-
mCoordinateTransform.setDestCRS( theSrcCRS );
157+
mSrcDatumTransform = srcDatumTransform;
158+
mDestDatumTransform = destDatumTransform;
129159
}
130160

131161
void QgsRasterProjector::calc()
@@ -166,6 +196,8 @@ void QgsRasterProjector::calc()
166196
double myDestRes = mDestXRes < mDestYRes ? mDestXRes : mDestYRes;
167197
mSqrTolerance = myDestRes * myDestRes;
168198

199+
const QgsCoordinateTransform* ct = QgsCoordinateTransformCache::instance()->transform( mDestCRS.authid(), mSrcCRS.authid(), mDestDatumTransform, mSrcDatumTransform );
200+
169201
// Initialize the matrix by corners and middle points
170202
mCPCols = mCPRows = 3;
171203
for ( int i = 0; i < mCPRows; i++ )
@@ -184,20 +216,20 @@ void QgsRasterProjector::calc()
184216
}
185217
for ( int i = 0; i < mCPRows; i++ )
186218
{
187-
calcRow( i );
219+
calcRow( i, ct );
188220
}
189221

190222
while ( true )
191223
{
192-
bool myColsOK = checkCols();
224+
bool myColsOK = checkCols( ct );
193225
if ( !myColsOK )
194226
{
195-
insertRows();
227+
insertRows( ct );
196228
}
197-
bool myRowsOK = checkRows();
229+
bool myRowsOK = checkRows( ct );
198230
if ( !myRowsOK )
199231
{
200-
insertCols();
232+
insertCols( ct );
201233
}
202234
if ( myColsOK && myRowsOK )
203235
{
@@ -432,19 +464,19 @@ void QgsRasterProjector::nextHelper()
432464
mHelperTopRow++;
433465
}
434466

435-
void QgsRasterProjector::srcRowCol( int theDestRow, int theDestCol, int *theSrcRow, int *theSrcCol )
467+
void QgsRasterProjector::srcRowCol( int theDestRow, int theDestCol, int *theSrcRow, int *theSrcCol, const QgsCoordinateTransform* ct )
436468
{
437469
if ( mApproximate )
438470
{
439471
approximateSrcRowCol( theDestRow, theDestCol, theSrcRow, theSrcCol );
440472
}
441473
else
442474
{
443-
preciseSrcRowCol( theDestRow, theDestCol, theSrcRow, theSrcCol );
475+
preciseSrcRowCol( theDestRow, theDestCol, theSrcRow, theSrcCol, ct );
444476
}
445477
}
446478

447-
void QgsRasterProjector::preciseSrcRowCol( int theDestRow, int theDestCol, int *theSrcRow, int *theSrcCol )
479+
void QgsRasterProjector::preciseSrcRowCol( int theDestRow, int theDestCol, int *theSrcRow, int *theSrcCol, const QgsCoordinateTransform* ct )
448480
{
449481
#ifdef QGISDEBUG
450482
QgsDebugMsgLevel( QString( "theDestRow = %1" ).arg( theDestRow ), 5 );
@@ -460,7 +492,10 @@ void QgsRasterProjector::preciseSrcRowCol( int theDestRow, int theDestCol, int *
460492
QgsDebugMsgLevel( QString( "x = %1 y = %2" ).arg( x ).arg( y ), 5 );
461493
#endif
462494

463-
mCoordinateTransform.transformInPlace( x, y, z );
495+
if ( ct )
496+
{
497+
ct->transformInPlace( x, y, z );
498+
}
464499

465500
#ifdef QGISDEBUG
466501
QgsDebugMsgLevel( QString( "x = %1 y = %2" ).arg( x ).arg( y ), 5 );
@@ -545,7 +580,7 @@ void QgsRasterProjector::approximateSrcRowCol( int theDestRow, int theDestCol, i
545580
Q_ASSERT( *theSrcCol < mSrcCols );
546581
}
547582

548-
void QgsRasterProjector::insertRows()
583+
void QgsRasterProjector::insertRows( const QgsCoordinateTransform* ct )
549584
{
550585
for ( int r = 0; r < mCPRows - 1; r++ )
551586
{
@@ -563,11 +598,11 @@ void QgsRasterProjector::insertRows()
563598
mCPRows += mCPRows - 1;
564599
for ( int r = 1; r < mCPRows - 1; r += 2 )
565600
{
566-
calcRow( r );
601+
calcRow( r, ct );
567602
}
568603
}
569604

570-
void QgsRasterProjector::insertCols()
605+
void QgsRasterProjector::insertCols( const QgsCoordinateTransform* ct )
571606
{
572607
for ( int r = 0; r < mCPRows; r++ )
573608
{
@@ -582,20 +617,27 @@ void QgsRasterProjector::insertCols()
582617
mCPCols += mCPCols - 1;
583618
for ( int c = 1; c < mCPCols - 1; c += 2 )
584619
{
585-
calcCol( c );
620+
calcCol( c, ct );
586621
}
587622

588623
}
589624

590-
void QgsRasterProjector::calcCP( int theRow, int theCol )
625+
void QgsRasterProjector::calcCP( int theRow, int theCol, const QgsCoordinateTransform* ct )
591626
{
592627
double myDestX, myDestY;
593628
destPointOnCPMatrix( theRow, theCol, &myDestX, &myDestY );
594629
QgsPoint myDestPoint( myDestX, myDestY );
595630
try
596631
{
597-
mCPMatrix[theRow][theCol] = mCoordinateTransform.transform( myDestPoint );
598-
mCPLegalMatrix[theRow][theCol] = true;
632+
if ( ct )
633+
{
634+
mCPMatrix[theRow][theCol] = ct->transform( myDestPoint );
635+
mCPLegalMatrix[theRow][theCol] = true;
636+
}
637+
else
638+
{
639+
mCPLegalMatrix[theRow][theCol] = false;
640+
}
599641
}
600642
catch ( QgsCsException &e )
601643
{
@@ -605,30 +647,35 @@ void QgsRasterProjector::calcCP( int theRow, int theCol )
605647
}
606648
}
607649

608-
bool QgsRasterProjector::calcRow( int theRow )
650+
bool QgsRasterProjector::calcRow( int theRow, const QgsCoordinateTransform* ct )
609651
{
610652
QgsDebugMsgLevel( QString( "theRow = %1" ).arg( theRow ), 3 );
611653
for ( int i = 0; i < mCPCols; i++ )
612654
{
613-
calcCP( theRow, i );
655+
calcCP( theRow, i, ct );
614656
}
615657

616658
return true;
617659
}
618660

619-
bool QgsRasterProjector::calcCol( int theCol )
661+
bool QgsRasterProjector::calcCol( int theCol, const QgsCoordinateTransform* ct )
620662
{
621663
QgsDebugMsgLevel( QString( "theCol = %1" ).arg( theCol ), 3 );
622664
for ( int i = 0; i < mCPRows; i++ )
623665
{
624-
calcCP( i, theCol );
666+
calcCP( i, theCol, ct );
625667
}
626668

627669
return true;
628670
}
629671

630-
bool QgsRasterProjector::checkCols()
672+
bool QgsRasterProjector::checkCols( const QgsCoordinateTransform* ct )
631673
{
674+
if ( !ct )
675+
{
676+
return false;
677+
}
678+
632679
for ( int c = 0; c < mCPCols; c++ )
633680
{
634681
for ( int r = 1; r < mCPRows - 1; r += 2 )
@@ -649,7 +696,7 @@ bool QgsRasterProjector::checkCols()
649696
}
650697
try
651698
{
652-
QgsPoint myDestApprox = mCoordinateTransform.transform( mySrcApprox, QgsCoordinateTransform::ReverseTransform );
699+
QgsPoint myDestApprox = ct->transform( mySrcApprox, QgsCoordinateTransform::ReverseTransform );
653700
double mySqrDist = myDestApprox.sqrDist( myDestPoint );
654701
if ( mySqrDist > mSqrTolerance )
655702
{
@@ -667,8 +714,13 @@ bool QgsRasterProjector::checkCols()
667714
return true;
668715
}
669716

670-
bool QgsRasterProjector::checkRows()
717+
bool QgsRasterProjector::checkRows( const QgsCoordinateTransform* ct )
671718
{
719+
if ( !ct )
720+
{
721+
return false;
722+
}
723+
672724
for ( int r = 0; r < mCPRows; r++ )
673725
{
674726
for ( int c = 1; c < mCPCols - 1; c += 2 )
@@ -689,7 +741,7 @@ bool QgsRasterProjector::checkRows()
689741
}
690742
try
691743
{
692-
QgsPoint myDestApprox = mCoordinateTransform.transform( mySrcApprox, QgsCoordinateTransform::ReverseTransform );
744+
QgsPoint myDestApprox = ct->transform( mySrcApprox, QgsCoordinateTransform::ReverseTransform );
693745
double mySqrDist = myDestApprox.sqrDist( myDestPoint );
694746
if ( mySqrDist > mSqrTolerance )
695747
{
@@ -775,12 +827,18 @@ QgsRasterBlock * QgsRasterProjector::block( int bandNo, QgsRectangle const & ex
775827
// we cannot fill output block with no data because we use memcpy for data, not setValue().
776828
bool doNoData = inputBlock->hasNoData() && !inputBlock->hasNoDataValue();
777829

830+
const QgsCoordinateTransform* ct = 0;
831+
if ( !mApproximate )
832+
{
833+
ct = QgsCoordinateTransformCache::instance()->transform( mDestCRS.authid(), mSrcCRS.authid(), mDestDatumTransform, mSrcDatumTransform );
834+
}
835+
778836
int srcRow, srcCol;
779837
for ( int i = 0; i < height; ++i )
780838
{
781839
for ( int j = 0; j < width; ++j )
782840
{
783-
srcRowCol( i, j, &srcRow, &srcCol );
841+
srcRowCol( i, j, &srcRow, &srcCol, ct );
784842
qgssize srcIndex = ( qgssize )srcRow * mSrcCols + srcCol;
785843
QgsDebugMsgLevel( QString( "row = %1 col = %2 srcRow = %3 srcCol = %4" ).arg( i ).arg( j ).arg( srcRow ).arg( srcCol ), 5 );
786844

‎src/core/raster/qgsrasterprojector.h

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@ class CORE_EXPORT QgsRasterProjector : public QgsRasterInterface
4242
* it calculates grid of points in source CRS for target CRS + extent
4343
* which are used to calculate affine transformation matrices.
4444
*/
45+
46+
QgsRasterProjector(
47+
QgsCoordinateReferenceSystem theSrcCRS,
48+
QgsCoordinateReferenceSystem theDestCRS,
49+
int theSrcDatumTransform,
50+
int theDestDatumTransform,
51+
QgsRectangle theDestExtent,
52+
int theDestRows, int theDestCols,
53+
double theMaxSrcXRes, double theMaxSrcYRes,
54+
QgsRectangle theExtent
55+
);
56+
4557
QgsRasterProjector(
4658
QgsCoordinateReferenceSystem theSrcCRS,
4759
QgsCoordinateReferenceSystem theDestCRS,
@@ -74,7 +86,8 @@ class CORE_EXPORT QgsRasterProjector : public QgsRasterInterface
7486
QGis::DataType dataType( int bandNo ) const;
7587

7688
/** \brief set source and destination CRS */
77-
void setCRS( const QgsCoordinateReferenceSystem & theSrcCRS, const QgsCoordinateReferenceSystem & theDestCRS );
89+
void setCRS( const QgsCoordinateReferenceSystem & theSrcCRS, const QgsCoordinateReferenceSystem & theDestCRS,
90+
int srcDatumTransform = -1, int destDatumTransform = -1 );
7891

7992
/** \brief Get source CRS */
8093
QgsCoordinateReferenceSystem srcCrs() const { return mSrcCRS; }
@@ -101,7 +114,7 @@ class CORE_EXPORT QgsRasterProjector : public QgsRasterInterface
101114
void setSrcCols( int theCols ) { mSrcCols = theCols; mSrcYRes = mSrcExtent.width() / mSrcCols; }
102115

103116
/** \brief Get source row and column indexes for current source extent and resolution */
104-
void srcRowCol( int theDestRow, int theDestCol, int *theSrcRow, int *theSrcCol );
117+
void srcRowCol( int theDestRow, int theDestCol, int *theSrcRow, int *theSrcCol, const QgsCoordinateTransform* ct );
105118

106119
int dstRows() const { return mDestRows; }
107120
int dstCols() const { return mDestCols; }
@@ -117,7 +130,7 @@ class CORE_EXPORT QgsRasterProjector : public QgsRasterInterface
117130
QgsPoint srcPoint( int theRow, int theCol );
118131

119132
/** \brief Get precise source row and column indexes for current source extent and resolution */
120-
inline void preciseSrcRowCol( int theDestRow, int theDestCol, int *theSrcRow, int *theSrcCol );
133+
inline void preciseSrcRowCol( int theDestRow, int theDestCol, int *theSrcRow, int *theSrcCol, const QgsCoordinateTransform* ct );
121134

122135
/** \brief Get approximate source row and column indexes for current source extent and resolution */
123136
inline void approximateSrcRowCol( int theDestRow, int theDestCol, int *theSrcRow, int *theSrcCol );
@@ -126,19 +139,19 @@ class CORE_EXPORT QgsRasterProjector : public QgsRasterInterface
126139
void calc();
127140

128141
/** \brief insert rows to matrix */
129-
void insertRows();
142+
void insertRows( const QgsCoordinateTransform* ct );
130143

131144
/** \brief insert columns to matrix */
132-
void insertCols();
145+
void insertCols( const QgsCoordinateTransform* ct );
133146

134147
/* calculate single control point in current matrix */
135-
void calcCP( int theRow, int theCol );
148+
void calcCP( int theRow, int theCol, const QgsCoordinateTransform* ct );
136149

137150
/** \brief calculate matrix row */
138-
bool calcRow( int theRow );
151+
bool calcRow( int theRow, const QgsCoordinateTransform* ct );
139152

140153
/** \brief calculate matrix column */
141-
bool calcCol( int theCol );
154+
bool calcCol( int theCol, const QgsCoordinateTransform* ct );
142155

143156
/** \brief calculate source extent */
144157
void calcSrcExtent();
@@ -148,11 +161,11 @@ class CORE_EXPORT QgsRasterProjector : public QgsRasterInterface
148161

149162
/** \brief check error along columns
150163
* returns true if within threshold */
151-
bool checkCols();
164+
bool checkCols( const QgsCoordinateTransform* ct );
152165

153166
/** \brief check error along rows
154167
* returns true if within threshold */
155-
bool checkRows();
168+
bool checkRows( const QgsCoordinateTransform* ct );
156169

157170
/** Calculate array of src helper points */
158171
void calcHelper( int theMatrixRow, QgsPoint *thePoints );
@@ -169,8 +182,11 @@ class CORE_EXPORT QgsRasterProjector : public QgsRasterInterface
169182
/** Destination CRS */
170183
QgsCoordinateReferenceSystem mDestCRS;
171184

172-
/** Reverse coordinate transform (from destination to source) */
173-
QgsCoordinateTransform mCoordinateTransform;
185+
/** Source datum transformation id (or -1 if none) */
186+
int mSrcDatumTransform;
187+
188+
/** Destination datum transformation id (or -1 if none) */
189+
int mDestDatumTransform;
174190

175191
/** Destination extent */
176192
QgsRectangle mDestExtent;

‎src/core/raster/qgsrasterviewport.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ struct QgsRasterViewPort
5252

5353
/** \brief Target coordinate system */
5454
QgsCoordinateReferenceSystem mDestCRS;
55+
56+
int mSrcDatumTransform;
57+
int mDestDatumTransform;
5558
};
5659

5760
#endif //QGSRASTERVIEWPORT_H

0 commit comments

Comments
 (0)
Please sign in to comment.