3
3
#include " qgsrasterprojector.h"
4
4
#include " qgsrasterviewport.h"
5
5
6
- QgsRasterIterator::QgsRasterIterator ( QgsRasterInterface* input ): mInput( input )
6
+ QgsRasterIterator::QgsRasterIterator ( QgsRasterInterface* input ): mInput( input ),
7
+ mMaximumTileWidth( 2000 ), mMaximumTileHeight( 2000 )
7
8
{
8
9
}
9
10
@@ -27,18 +28,6 @@ void QgsRasterIterator::startRasterRead( int bandNumber, int nCols, int nRows, c
27
28
RasterPartInfo pInfo;
28
29
pInfo.nCols = nCols;
29
30
pInfo.nRows = nRows;
30
-
31
- // effective oversampling factors are different to global one because of rounding
32
- // oversamplingX = (( double )pInfo.nCols * oversampling ) / viewPort->drawableAreaXDim;
33
- // oversamplingY = (( double )pInfo.nRows * oversampling ) / viewPort->drawableAreaYDim;
34
-
35
- // TODO : we dont know oversampling (grid size) here - how to get totalMemoryUsage ?
36
- // int totalMemoryUsage = pInfo.nCols * oversamplingX * pInfo.nRows * oversamplingY * mInput->dataTypeSize( bandNumber );
37
- int totalMemoryUsage = pInfo.nCols * pInfo.nRows * mInput ->dataTypeSize ( bandNumber );
38
- int parts = totalMemoryUsage / 100000000 + 1 ;
39
- int nPartsPerDimension = sqrt ( parts );
40
- pInfo.nColsPerPart = pInfo.nCols / nPartsPerDimension;
41
- pInfo.nRowsPerPart = pInfo.nRows / nPartsPerDimension;
42
31
pInfo.currentCol = 0 ;
43
32
pInfo.currentRow = 0 ;
44
33
pInfo.data = 0 ;
@@ -74,8 +63,8 @@ bool QgsRasterIterator::readNextRasterPart( int bandNumber,
74
63
}
75
64
76
65
// read data block
77
- nCols = qMin ( pInfo. nColsPerPart , pInfo.nCols - pInfo.currentCol );
78
- nRows = qMin ( pInfo. nRowsPerPart , pInfo.nRows - pInfo.currentRow );
66
+ nCols = qMin ( mMaximumTileWidth , pInfo.nCols - pInfo.currentCol );
67
+ nRows = qMin ( mMaximumTileHeight , pInfo.nRows - pInfo.currentRow );
79
68
80
69
// get subrectangle
81
70
QgsRectangle viewPortExtent = mExtent ;
@@ -99,7 +88,7 @@ bool QgsRasterIterator::readNextRasterPart( int bandNumber,
99
88
else if ( pInfo.currentCol == pInfo.nCols ) // start new row
100
89
{
101
90
pInfo.currentCol = 0 ;
102
- pInfo.currentRow += pInfo. nRowsPerPart ;
91
+ pInfo.currentRow += nRows ;
103
92
}
104
93
105
94
return true ;
0 commit comments