QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgsrasterhistogram.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrasterhistogram.h
3  -------------------
4  begin : July 2012
5  copyright : (C) 2012 by Radim Blazek
6  email : radim dot blazek at gmail dot 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 QGSRASTERHISTOGRAM
19 #define QGSRASTERHISTOGRAM
20 
21 #include "qgis_core.h"
22 #include "qgsrectangle.h"
23 #include <QString>
24 #include <QVector>
25 
26 #include <limits>
27 
33 class CORE_EXPORT QgsRasterHistogram
34 {
35  public:
36  typedef QVector<int> HistogramVector;
37 
41  QgsRasterHistogram() = default;
42 
44  bool operator==( const QgsRasterHistogram &h ) const
45  {
46  return ( h.bandNumber == bandNumber &&
47  h.binCount == binCount &&
48  h.includeOutOfRange == includeOutOfRange &&
49  qgsDoubleNear( h.maximum, maximum ) &&
50  qgsDoubleNear( h.minimum, minimum ) &&
51  h.extent == extent &&
52  h.width == width &&
53  h.height == height );
54  }
55 
57  int bandNumber = 0;
58 
60  int binCount = 0;
61 
63  int nonNullCount = 0;
64 
66  bool includeOutOfRange = false;
67 
72 
74  double maximum = 0;
75 
77  double minimum = 0;
78 
80  int width = 0;
81 
83  int height = 0;
84 
87 
89  bool valid = false;
90 };
91 #endif
The QgsRasterHistogram is a container for histogram of a single raster band.
bool operator==(const QgsRasterHistogram &h) const
Compares region, size etc. not histogram itself.
double minimum
The minimum histogram value.
int bandNumber
The gdal band number (starts at 1)
double maximum
The maximum histogram value.
QgsRasterHistogram()=default
Constructor for an invalid QgsRasterHistogram.
bool includeOutOfRange
Whether histogram includes out of range values (in first and last bin)
QgsRectangle extent
Extent used to calc histogram.
QgsRasterHistogram::HistogramVector histogramVector
Stores the histogram for a given layer.
QVector< int > HistogramVector
int height
Number of rows used to calc histogram.
int width
Number of columns used to calc histogram.
int binCount
Number of bins (intervals,buckets) in histogram.
A rectangle specified with double values.
Definition: qgsrectangle.h:42
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
Definition: qgis.h:598