QGIS API Documentation  2.3.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
QgsRasterIterator Class Reference

Iterator for sequentially processing raster cells. More...

#include <qgsrasteriterator.h>

Collaboration diagram for QgsRasterIterator:
Collaboration graph
[legend]

Classes

struct  RasterPartInfo
 

Public Member Functions

 QgsRasterIterator (QgsRasterInterface *input)
 
 ~QgsRasterIterator ()
 
void startRasterRead (int bandNumber, int nCols, int nRows, const QgsRectangle &extent)
 Start reading of raster band. 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...
 
void stopRasterRead (int bandNumber)
 
const QgsRasterInterfaceinput () const
 
void setMaximumTileWidth (int w)
 
int maximumTileWidth () const
 
void setMaximumTileHeight (int h)
 
int maximumTileHeight () const
 

Private Member Functions

void removePartInfo (int bandNumber)
 Remove part into and release memory. More...
 

Private Attributes

QgsRasterInterfacemInput
 
QMap< int, RasterPartInfomRasterPartInfos
 
QgsRectangle mExtent
 
int mMaximumTileWidth
 
int mMaximumTileHeight
 

Detailed Description

Iterator for sequentially processing raster cells.

Definition at line 30 of file qgsrasteriterator.h.

Constructor & Destructor Documentation

QgsRasterIterator::QgsRasterIterator ( QgsRasterInterface input)

Definition at line 20 of file qgsrasteriterator.cpp.

QgsRasterIterator::~QgsRasterIterator ( )

Definition at line 25 of file qgsrasteriterator.cpp.

Member Function Documentation

const QgsRasterInterface* QgsRasterIterator::input ( ) const
inline
int QgsRasterIterator::maximumTileHeight ( ) const
inline
int QgsRasterIterator::maximumTileWidth ( ) const
inline
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 51 of file qgsrasteriterator.cpp.

References QgsRasterInterface::block(), QgsRasterIterator::RasterPartInfo::currentCol, QgsRasterIterator::RasterPartInfo::currentRow, QgsRectangle::height(), mExtent, mInput, mMaximumTileHeight, mMaximumTileWidth, mRasterPartInfos, QgsRasterIterator::RasterPartInfo::nCols, QgsRasterIterator::RasterPartInfo::nRows, QgsRasterIterator::RasterPartInfo::prj, QgsDebugMsg, QgsRectangle::width(), QgsRectangle::xMinimum(), and QgsRectangle::yMaximum().

Referenced by QgsRasterDrawer::draw(), QgsRasterFileWriter::writeDataRaster(), and QgsRasterFileWriter::writeImageRaster().

void QgsRasterIterator::removePartInfo ( int  bandNumber)
private

Remove part into and release memory.

Definition at line 119 of file qgsrasteriterator.cpp.

References mRasterPartInfos, and QgsRasterIterator::RasterPartInfo::prj.

Referenced by startRasterRead(), and stopRasterRead().

void QgsRasterIterator::setMaximumTileHeight ( int  h)
inline
void QgsRasterIterator::setMaximumTileWidth ( int  w)
inline
void QgsRasterIterator::startRasterRead ( int  bandNumber,
int  nCols,
int  nRows,
const QgsRectangle extent 
)

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

Definition at line 29 of file qgsrasteriterator.cpp.

References QgsRasterIterator::RasterPartInfo::currentCol, QgsRasterIterator::RasterPartInfo::currentRow, mExtent, mInput, mRasterPartInfos, QgsRasterIterator::RasterPartInfo::nCols, QgsRasterIterator::RasterPartInfo::nRows, QgsRasterIterator::RasterPartInfo::prj, and removePartInfo().

Referenced by QgsRasterDrawer::draw(), QgsRasterFileWriter::writeDataRaster(), and QgsRasterFileWriter::writeImageRaster().

void QgsRasterIterator::stopRasterRead ( int  bandNumber)

Definition at line 114 of file qgsrasteriterator.cpp.

References removePartInfo().

Member Data Documentation

QgsRectangle QgsRasterIterator::mExtent
private

Definition at line 82 of file qgsrasteriterator.h.

Referenced by readNextRasterPart(), and startRasterRead().

QgsRasterInterface* QgsRasterIterator::mInput
private

Definition at line 80 of file qgsrasteriterator.h.

Referenced by readNextRasterPart(), and startRasterRead().

int QgsRasterIterator::mMaximumTileHeight
private

Definition at line 85 of file qgsrasteriterator.h.

Referenced by readNextRasterPart().

int QgsRasterIterator::mMaximumTileWidth
private

Definition at line 84 of file qgsrasteriterator.h.

Referenced by readNextRasterPart().

QMap<int, RasterPartInfo> QgsRasterIterator::mRasterPartInfos
private

Definition at line 81 of file qgsrasteriterator.h.

Referenced by readNextRasterPart(), removePartInfo(), and startRasterRead().


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