You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow QgsRasterIterator to iterate over a raster layer, WITHOUT
actually fetching the raster block data
This allows for efficient iteration over a "reference" layer, where
you require the block extent/origin/pixel size/etc (but not the
reference layer block data itself!), in order to fetch a block from
a DIFFERENT set of rasters (but keeping these pixel-aligned to the
reference raster).
boolQgsRasterIterator::readNextRasterPart( int bandNumber,
61
66
int &nCols, int &nRows,
62
67
QgsRasterBlock **block,
@@ -71,9 +76,15 @@ bool QgsRasterIterator::readNextRasterPart( int bandNumber,
71
76
}
72
77
73
78
boolQgsRasterIterator::readNextRasterPart( int bandNumber, int &nCols, int &nRows, std::unique_ptr<QgsRasterBlock> &block, int &topLeftCol, int &topLeftRow, QgsRectangle *blockExtent )
boolQgsRasterIterator::readNextRasterPartInternal( int bandNumber, int &nCols, int &nRows, std::unique_ptr<QgsRasterBlock> *block, int &topLeftCol, int &topLeftRow, QgsRectangle *blockExtent )
Copy file name to clipboardExpand all lines: src/core/raster/qgsrasteriterator.h
+22Lines changed: 22 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,27 @@ class CORE_EXPORT QgsRasterIterator
49
49
*/
50
50
voidstartRasterRead( int bandNumber, int nCols, int nRows, const QgsRectangle &extent, QgsRasterBlockFeedback *feedback = nullptr );
51
51
52
+
/**
53
+
* Fetches details of the next part of the raster data. This method does NOT actually fetch the raster
54
+
* data itself, rather it calculates and iterates over the details of the raster alone.
55
+
*
56
+
* It's useful for iterating over several layers using a target "reference" layer. E.g. summing
57
+
* the pixels in n rasters whilst aligning the result to a reference layer which is not being summed.
58
+
*
59
+
* Note that calling this method also advances the iterator, just like calling readNextRasterPart().
60
+
*
61
+
* \param bandNumber band to read
62
+
* \param columns number of columns on output device
63
+
* \param rows number of rows on output device
64
+
* \param topLeftColumn top left column
65
+
* \param topLeftRow top left row
66
+
* \param blockExtent exact extent of returned raster block
67
+
* \returns false if the last part was already returned
68
+
*
69
+
* \since QGIS 3.6
70
+
*/
71
+
boolnext( int bandNumber, int &columns SIP_OUT, int &rows SIP_OUT, int &topLeftColumn SIP_OUT, int &topLeftRow SIP_OUT, QgsRectangle &blockExtent SIP_OUT );
72
+
52
73
/**
53
74
* Fetches next part of raster data, caller takes ownership of the block and
54
75
* caller should delete the block.
@@ -148,6 +169,7 @@ class CORE_EXPORT QgsRasterIterator
148
169
149
170
//! Remove part into and release memory
150
171
voidremovePartInfo( int bandNumber );
172
+
boolreadNextRasterPartInternal( int bandNumber, int &nCols, int &nRows, std::unique_ptr<QgsRasterBlock> *block, int &topLeftCol, int &topLeftRow, QgsRectangle *blockExtent );
0 commit comments