QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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
QgsRasterHistogram::HistogramVector
QVector< int > HistogramVector
Definition: qgsrasterhistogram.h:36
QgsRasterHistogram::QgsRasterHistogram
QgsRasterHistogram()=default
Constructor for an invalid QgsRasterHistogram.
QgsRasterHistogram::histogramVector
QgsRasterHistogram::HistogramVector histogramVector
Stores the histogram for a given layer.
Definition: qgsrasterhistogram.h:71
qgsrectangle.h
QgsRasterHistogram::operator==
bool operator==(const QgsRasterHistogram &h) const
Compares region, size etc. not histogram itself.
Definition: qgsrasterhistogram.h:44
QgsRectangle
A rectangle specified with double values.
Definition: qgsrectangle.h:42
QgsRasterHistogram::extent
QgsRectangle extent
Extent used to calc histogram.
Definition: qgsrasterhistogram.h:86
QgsRasterHistogram::includeOutOfRange
bool includeOutOfRange
Whether histogram includes out of range values (in first and last bin)
Definition: qgsrasterhistogram.h:66
QgsRasterHistogram::minimum
double minimum
The minimum histogram value.
Definition: qgsrasterhistogram.h:77
qgsDoubleNear
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
Definition: qgis.h:315
QgsRasterHistogram::binCount
int binCount
Number of bins (intervals,buckets) in histogram.
Definition: qgsrasterhistogram.h:60
QgsRasterHistogram
The QgsRasterHistogram is a container for histogram of a single raster band.
Definition: qgsrasterhistogram.h:34
QgsRasterHistogram::height
int height
Number of rows used to calc histogram.
Definition: qgsrasterhistogram.h:83
QgsRasterHistogram::width
int width
Number of columns used to calc histogram.
Definition: qgsrasterhistogram.h:80
QgsRasterHistogram::maximum
double maximum
The maximum histogram value.
Definition: qgsrasterhistogram.h:74
QgsRasterHistogram::bandNumber
int bandNumber
The gdal band number (starts at 1)
Definition: qgsrasterhistogram.h:57