QGIS API Documentation  3.2.0-Bonn (bc43194)
Classes | Public Member Functions | Static Public Attributes | List of all members
QgsRasterIterator Class Reference

Iterator for sequentially processing raster cells. More...

#include <qgsrasteriterator.h>

Public Member Functions

 QgsRasterIterator (QgsRasterInterface *input)
 Constructor for QgsRasterIterator, iterating over the specified input raster source. More...
 
const QgsRasterInterfaceinput () const
 Returns the input raster interface which is being iterated over. More...
 
int maximumTileHeight () const
 Returns the minimum tile width returned during iteration. More...
 
int maximumTileWidth () const
 Returns the maximum tile width returned during iteration. More...
 
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 block. More...
 
bool readNextRasterPart (int bandNumber, int &nCols, int &nRows, std::unique_ptr< QgsRasterBlock > &block, int &topLeftCol, int &topLeftRow, QgsRectangle *blockExtent=nullptr) SIP_SKIP
 Fetches next part of raster data. More...
 
void setMaximumTileHeight (int h)
 Sets the minimum tile height returned during iteration. More...
 
void setMaximumTileWidth (int w)
 Sets the maximum tile width returned during iteration. More...
 
void startRasterRead (int bandNumber, int nCols, int nRows, const QgsRectangle &extent, QgsRasterBlockFeedback *feedback=nullptr)
 Start reading of raster band. More...
 
void stopRasterRead (int bandNumber)
 Cancels the raster iteration and resets the iterator. More...
 

Static Public Attributes

static const int DEFAULT_MAXIMUM_TILE_HEIGHT = 2000
 Default maximum tile height. More...
 
static const int DEFAULT_MAXIMUM_TILE_WIDTH = 2000
 Default maximum tile width. More...
 

Detailed Description

Iterator for sequentially processing raster cells.

Definition at line 33 of file qgsrasteriterator.h.

Constructor & Destructor Documentation

◆ QgsRasterIterator()

QgsRasterIterator::QgsRasterIterator ( QgsRasterInterface input)

Constructor for QgsRasterIterator, iterating over the specified input raster source.

Definition at line 21 of file qgsrasteriterator.cpp.

Member Function Documentation

◆ input()

const QgsRasterInterface* QgsRasterIterator::input ( ) const
inline

Returns the input raster interface which is being iterated over.

Definition at line 95 of file qgsrasteriterator.h.

◆ maximumTileHeight()

int QgsRasterIterator::maximumTileHeight ( ) const
inline

Returns the minimum tile width returned during iteration.

See also
setMaximumTileHeight()
maximumTileWidth()

Definition at line 123 of file qgsrasteriterator.h.

◆ maximumTileWidth()

int QgsRasterIterator::maximumTileWidth ( ) const
inline

Returns the maximum tile width returned during iteration.

See also
setMaximumTileWidth()
maximumTileHeight()

Definition at line 109 of file qgsrasteriterator.h.

◆ readNextRasterPart() [1/2]

bool QgsRasterIterator::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 block.

Parameters
bandNumberband to read
nColsnumber of columns on output device
nRowsnumber of rows on output device
blockaddress of block pointer
topLeftColtop left column
topLeftRowtop left row
Returns
false if the last part was already returned

Definition at line 60 of file qgsrasteriterator.cpp.

◆ readNextRasterPart() [2/2]

bool QgsRasterIterator::readNextRasterPart ( int  bandNumber,
int &  nCols,
int &  nRows,
std::unique_ptr< QgsRasterBlock > &  block,
int &  topLeftCol,
int &  topLeftRow,
QgsRectangle blockExtent = nullptr 
)

Fetches next part of raster data.

Parameters
bandNumberband to read
nColsnumber of columns on output device
nRowsnumber of rows on output device
blockaddress of block pointer
topLeftColtop left column
topLeftRowtop left row
blockExtentoptional storage for exact extent of returned raster block
Returns
false if the last part was already returned
Note
Not available in Python bindings
Since
QGIS 3.2

Definition at line 73 of file qgsrasteriterator.cpp.

◆ setMaximumTileHeight()

void QgsRasterIterator::setMaximumTileHeight ( int  h)
inline

Sets the minimum tile height returned during iteration.

See also
maximumTileHeight()
setMaximumTileWidth()

Definition at line 116 of file qgsrasteriterator.h.

◆ setMaximumTileWidth()

void QgsRasterIterator::setMaximumTileWidth ( int  w)
inline

Sets the maximum tile width returned during iteration.

See also
maximumTileWidth()
setMaximumTileHeight()

Definition at line 102 of file qgsrasteriterator.h.

◆ startRasterRead()

void QgsRasterIterator::startRasterRead ( int  bandNumber,
int  nCols,
int  nRows,
const QgsRectangle extent,
QgsRasterBlockFeedback feedback = nullptr 
)

Start reading of raster band.

Raster data can then be retrieved by calling readNextRasterPart until it returns false.

Parameters
bandNumbernumber of raster band to read
nColsnumber of columns
nRowsnumber of rows
extentarea to read
feedbackoptional raster feedback object for cancelation/preview. Added in QGIS 3.0.

Definition at line 38 of file qgsrasteriterator.cpp.

◆ stopRasterRead()

void QgsRasterIterator::stopRasterRead ( int  bandNumber)

Cancels the raster iteration and resets the iterator.

Definition at line 136 of file qgsrasteriterator.cpp.

Member Data Documentation

◆ DEFAULT_MAXIMUM_TILE_HEIGHT

const int QgsRasterIterator::DEFAULT_MAXIMUM_TILE_HEIGHT = 2000
static

Default maximum tile height.

Definition at line 129 of file qgsrasteriterator.h.

◆ DEFAULT_MAXIMUM_TILE_WIDTH

const int QgsRasterIterator::DEFAULT_MAXIMUM_TILE_WIDTH = 2000
static

Default maximum tile width.

Definition at line 126 of file qgsrasteriterator.h.


The documentation for this class was generated from the following files: