QGIS API Documentation 4.3.0-Master (0de80482b60)
Loading...
Searching...
No Matches
QgsSortedRasterBlockIndex Class Reference

Creates a flat index over a QgsRasterBlock, sorted by cell values. More...

#include <qgssortedrasterblockindex.h>

Public Member Functions

 QgsSortedRasterBlockIndex (const QgsRasterBlock *block)
 Constructor for QgsSortedRasterBlockIndex, indexing the specified raster block.
const QgsRasterBlockblock () const
 Returns a pointer to source QgsRasterBlock.
void sortedColumnRow (qgssize rank, int &column, int &row, Qt::SortOrder order=Qt::AscendingOrder) const
 Retrieves the source raster block column and row corresponding to the specified sorted rank.
qgssize sortedCount () const
 Returns the number of valid (non-NoData) sorted cells.
qgssize sortedIndex (qgssize rank, Qt::SortOrder order=Qt::AscendingOrder) const
 Returns the source raster block index corresponding to the specified sorted rank.
double sortedValue (qgssize rank, Qt::SortOrder order=Qt::AscendingOrder) const
 Returns the raster block value corresponding to the specified sorted rank.

Detailed Description

Creates a flat index over a QgsRasterBlock, sorted by cell values.

This index allows for efficient retrieval of raster block cells by their sorted order. The index is sorted once during initialization, and cell values or coordinates can be requested in either ascending or descending order on demand.

Warning
Because nodata cells are ignored during index creation, the total number of indexed cells is limited to sortedCount(). Do not attempt to retrieve ranks outside of this range.
Raster block data is not stored in this class, and the source QgsRasterBlock must exist for the lifetime of this object.
Since
QGIS 4.4

Definition at line 45 of file qgssortedrasterblockindex.h.

Constructor & Destructor Documentation

◆ QgsSortedRasterBlockIndex()

QgsSortedRasterBlockIndex::QgsSortedRasterBlockIndex ( const QgsRasterBlock * block)

Constructor for QgsSortedRasterBlockIndex, indexing the specified raster block.

Warning
Raster block data is not stored in this class, and the source QgsRasterBlock must exist for the lifetime of this object.

Definition at line 113 of file qgssortedrasterblockindex.cpp.

Member Function Documentation

◆ block()

const QgsRasterBlock * QgsSortedRasterBlockIndex::block ( ) const
inline

Returns a pointer to source QgsRasterBlock.

Definition at line 63 of file qgssortedrasterblockindex.h.

◆ sortedColumnRow()

void QgsSortedRasterBlockIndex::sortedColumnRow ( qgssize rank,
int & column,
int & row,
Qt::SortOrder order = Qt::AscendingOrder ) const

Retrieves the source raster block column and row corresponding to the specified sorted rank.

Parameters
rankSorted position (0 to sortedCount() - 1). E.g. 0 for the lowest value, when using an ascending order.
columnOutput column
rowOutput row
orderSort order to query

Definition at line 153 of file qgssortedrasterblockindex.cpp.

◆ sortedCount()

qgssize QgsSortedRasterBlockIndex::sortedCount ( ) const

Returns the number of valid (non-NoData) sorted cells.

Definition at line 132 of file qgssortedrasterblockindex.cpp.

◆ sortedIndex()

qgssize QgsSortedRasterBlockIndex::sortedIndex ( qgssize rank,
Qt::SortOrder order = Qt::AscendingOrder ) const

Returns the source raster block index corresponding to the specified sorted rank.

Parameters
rankSorted position (0 to sortedCount() - 1). E.g. 0 for the lowest value, when using an ascending order.
orderSort order to query

Definition at line 137 of file qgssortedrasterblockindex.cpp.

◆ sortedValue()

double QgsSortedRasterBlockIndex::sortedValue ( qgssize rank,
Qt::SortOrder order = Qt::AscendingOrder ) const

Returns the raster block value corresponding to the specified sorted rank.

Parameters
rankSorted position (0 to sortedCount() - 1). E.g. 0 for the lowest value, when using an ascending order.
orderSort order to query

Definition at line 148 of file qgssortedrasterblockindex.cpp.


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