21 mMaximumTileWidth( 2000 ), mMaximumTileHeight( 2000 )
35 removePartInfo( bandNumber );
44 mRasterPartInfos.
insert( bandNumber, pInfo );
48 int& nCols,
int& nRows,
50 int& topLeftCol,
int& topLeftRow )
56 if ( partIt == mRasterPartInfos.
end() )
61 RasterPartInfo& pInfo = partIt.
value();
64 if ( 0 == pInfo.nCols || 0 == pInfo.nRows )
74 if ( pInfo.currentCol == pInfo.nCols && pInfo.currentRow == pInfo.nRows )
80 nCols = qMin( mMaximumTileWidth, pInfo.nCols - pInfo.currentCol );
81 nRows = qMin( mMaximumTileHeight, pInfo.nRows - pInfo.currentRow );
86 double xmin = viewPortExtent.
xMinimum() + pInfo.currentCol /
static_cast< double >( pInfo.nCols ) * viewPortExtent.
width();
87 double xmax = pInfo.currentCol + nCols == pInfo.nCols ? viewPortExtent.
xMaximum() :
88 viewPortExtent.
xMinimum() + ( pInfo.currentCol + nCols ) / static_cast< double >( pInfo.nCols ) * viewPortExtent.
width();
89 double ymin = pInfo.currentRow + nRows == pInfo.nRows ? viewPortExtent.
yMinimum() :
90 viewPortExtent.
yMaximum() - ( pInfo.currentRow + nRows ) / static_cast< double >( pInfo.nRows ) * viewPortExtent.
height();
91 double ymax = viewPortExtent.
yMaximum() - pInfo.currentRow /
static_cast< double >( pInfo.nRows ) * viewPortExtent.
height();
94 *block = mInput->
block( bandNumber, blockRect, nCols, nRows );
95 topLeftCol = pInfo.currentCol;
96 topLeftRow = pInfo.currentRow;
98 pInfo.currentCol += nCols;
99 if ( pInfo.currentCol == pInfo.nCols && pInfo.currentRow + nRows == pInfo.nRows )
101 pInfo.currentRow = pInfo.nRows;
103 else if ( pInfo.currentCol == pInfo.nCols )
105 pInfo.currentCol = 0;
106 pInfo.currentRow += nRows;
114 removePartInfo( bandNumber );
117 void QgsRasterIterator::removePartInfo(
int bandNumber )
120 if ( partIt != mRasterPartInfos.
end() )
122 RasterPartInfo& pInfo = partIt.
value();
124 mRasterPartInfos.
remove( bandNumber );
A rectangle specified with double values.
void startRasterRead(int bandNumber, int nCols, int nRows, const QgsRectangle &extent)
Start reading of raster band.
double yMaximum() const
Get the y maximum value (top side of rectangle)
QgsRasterIterator(QgsRasterInterface *input)
double yMinimum() const
Get the y minimum value (bottom side of rectangle)
double xMaximum() const
Get the x maximum value (right side of rectangle)
#define QgsDebugMsgLevel(str, level)
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)
virtual QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height)=0
Read block of data using given extent and size.
iterator insert(const Key &key, const T &value)
double width() const
Width of the rectangle.
double xMinimum() const
Get the x minimum value (left side of rectangle)
iterator find(const Key &key)
double height() const
Height of the rectangle.
const T value(const Key &key) const
int remove(const Key &key)