22 , mFeedback( nullptr )
23 , mMaximumTileWidth( 2000 )
24 , mMaximumTileHeight( 2000 )
39 removePartInfo( bandNumber );
48 mRasterPartInfos.
insert( bandNumber, pInfo );
52 int& nCols,
int& nRows,
54 int& topLeftCol,
int& topLeftRow )
60 if ( partIt == mRasterPartInfos.
end() )
65 RasterPartInfo& pInfo = partIt.
value();
68 if ( 0 == pInfo.nCols || 0 == pInfo.nRows )
78 if ( pInfo.currentCol == pInfo.nCols && pInfo.currentRow == pInfo.nRows )
84 nCols = qMin( mMaximumTileWidth, pInfo.nCols - pInfo.currentCol );
85 nRows = qMin( mMaximumTileHeight, pInfo.nRows - pInfo.currentRow );
90 double xmin = viewPortExtent.
xMinimum() + pInfo.currentCol /
static_cast< double >( pInfo.nCols ) * viewPortExtent.
width();
91 double xmax = pInfo.currentCol + nCols == pInfo.nCols ? viewPortExtent.
xMaximum() :
92 viewPortExtent.
xMinimum() + ( pInfo.currentCol + nCols ) / static_cast< double >( pInfo.nCols ) * viewPortExtent.
width();
93 double ymin = pInfo.currentRow + nRows == pInfo.nRows ? viewPortExtent.
yMinimum() :
94 viewPortExtent.
yMaximum() - ( pInfo.currentRow + nRows ) / static_cast< double >( pInfo.nRows ) * viewPortExtent.
height();
95 double ymax = viewPortExtent.
yMaximum() - pInfo.currentRow /
static_cast< double >( pInfo.nRows ) * viewPortExtent.
height();
98 *block = mInput->
block2( bandNumber, blockRect, nCols, nRows, mFeedback );
99 topLeftCol = pInfo.currentCol;
100 topLeftRow = pInfo.currentRow;
102 pInfo.currentCol += nCols;
103 if ( pInfo.currentCol == pInfo.nCols && pInfo.currentRow + nRows == pInfo.nRows )
105 pInfo.currentRow = pInfo.nRows;
107 else if ( pInfo.currentCol == pInfo.nCols )
109 pInfo.currentCol = 0;
110 pInfo.currentRow += nRows;
118 removePartInfo( bandNumber );
121 void QgsRasterIterator::removePartInfo(
int bandNumber )
124 if ( partIt != mRasterPartInfos.
end() )
126 RasterPartInfo& pInfo = partIt.
value();
128 mRasterPartInfos.
remove( bandNumber );
A rectangle specified with double values.
QgsRasterIterator(QgsRasterInterface *input)
virtual QgsRasterBlock * block2(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr)
Read block of data using given extent and size.
#define QgsDebugMsgLevel(str, level)
double width() const
Width of the rectangle.
bool readNextRasterPart(int bandNumber, int &nCols, int &nRows, QgsRasterBlock **block, int &topLeftCol, int &topLeftRow)
Fetches next part of raster data, caller takes ownership of the block and caller should delete the bl...
Base class for processing filters like renderers, reprojector, resampler etc.
void stopRasterRead(int bandNumber)
double yMinimum() const
Get the y minimum value (bottom side of rectangle)
double xMaximum() const
Get the x maximum value (right side of rectangle)
double xMinimum() const
Get the x minimum value (left side of rectangle)
double yMaximum() const
Get the y maximum value (top side of rectangle)
iterator insert(const Key &key, const T &value)
Feedback object tailored for raster block reading.
iterator find(const Key &key)
void startRasterRead(int bandNumber, int nCols, int nRows, const QgsRectangle &extent, QgsRasterBlockFeedback *feedback=nullptr)
Start reading of raster band.
double height() const
Height of the rectangle.
const T value(const Key &key) const
int remove(const Key &key)