33#include " qgsrasterprojector.h"
44#include " qgsrasterviewport.h"
55
6- QgsRasterIterator::QgsRasterIterator ( QgsRasterInterface* input ): mInput( input )
6+ QgsRasterIterator::QgsRasterIterator ( QgsRasterInterface* input ): mInput( input ),
7+ mMaximumTileWidth( 2000 ), mMaximumTileHeight( 2000 )
78{
89}
910
@@ -27,18 +28,6 @@ void QgsRasterIterator::startRasterRead( int bandNumber, int nCols, int nRows, c
2728 RasterPartInfo pInfo;
2829 pInfo.nCols = nCols;
2930 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;
4231 pInfo.currentCol = 0 ;
4332 pInfo.currentRow = 0 ;
4433 pInfo.data = 0 ;
@@ -74,8 +63,8 @@ bool QgsRasterIterator::readNextRasterPart( int bandNumber,
7463 }
7564
7665 // 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 );
7968
8069 // get subrectangle
8170 QgsRectangle viewPortExtent = mExtent ;
@@ -99,7 +88,7 @@ bool QgsRasterIterator::readNextRasterPart( int bandNumber,
9988 else if ( pInfo.currentCol == pInfo.nCols ) // start new row
10089 {
10190 pInfo.currentCol = 0 ;
102- pInfo.currentRow += pInfo. nRowsPerPart ;
91+ pInfo.currentRow += nRows ;
10392 }
10493
10594 return true ;
0 commit comments