QGIS API Documentation 4.3.0-Master (0de80482b60)
Loading...
Searching...
No Matches
qgssortedrasterblockindex.h
Go to the documentation of this file.
1/***************************************************************************
2 qgssortedrasterblockindex.h
3 --------------------------------------
4 Date : September 2026
5 Copyright : (C) 2026 by Nyall Dawson
6 email : nyall.dawson@gmail.com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSSORTEDRASTERBLOCKINDEX_H
19#define QGSSORTEDRASTERBLOCKINDEX_H
20
21#include <variant>
22
23#include "qgis.h"
24#include "qgis_core.h"
25#include "qgis_sip.h"
26
27class QgsRasterBlock;
28
46{
47 public:
54
58 qgssize sortedCount() const;
59
63 const QgsRasterBlock *block() const { return mBlock; }
64
71 qgssize sortedIndex( qgssize rank, Qt::SortOrder order = Qt::AscendingOrder ) const;
72
81 void sortedColumnRow( qgssize rank, int &column SIP_OUT, int &row SIP_OUT, Qt::SortOrder order = Qt::AscendingOrder ) const;
82
89 double sortedValue( qgssize rank, Qt::SortOrder order = Qt::AscendingOrder ) const;
90
91 private:
92 const QgsRasterBlock *mBlock = nullptr;
93
94 int mCols = 0;
95 int mRows = 0;
96
97 std::variant<std::vector<uint32_t>, std::vector<qgssize>> mSortedIndices;
98
99 inline void indexToColumnAndRow( qgssize index, int &column, int &row ) const
100 {
101 column = static_cast<int>( index % mCols );
102 row = static_cast<int>( index / mCols );
103 }
104};
105
106#endif // QGSSORTEDRASTERBLOCKINDEX_H
Raster data container.
const QgsRasterBlock * block() const
Returns a pointer to source QgsRasterBlock.
qgssize sortedCount() const
Returns the number of valid (non-NoData) sorted cells.
QgsSortedRasterBlockIndex(const QgsRasterBlock *block)
Constructor for QgsSortedRasterBlockIndex, indexing the specified raster block.
unsigned long long qgssize
Qgssize is used instead of size_t, because size_t is stdlib type, unknown by SIP, and it would be har...
Definition qgis.h:8174
#define SIP_OUT
Definition qgis_sip.h:57