QGIS API Documentation  2.99.0-Master (b95d432)
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 <QString>
23 #include <QVector>
24 
25 #include <limits>
26 
31 class CORE_EXPORT QgsRasterHistogram
32 {
33  public:
34  typedef QVector<int> HistogramVector;
35 
37  {
38  bandNumber = 0;
39  binCount = 0;
40  nonNullCount = 0;
41  includeOutOfRange = false;
42  maximum = 0;
43  minimum = 0;
44  width = 0;
45  height = 0;
46  valid = false;
47  }
48 
50  bool operator==( const QgsRasterHistogram &h ) const
51  {
52  return ( h.bandNumber == bandNumber &&
53  h.binCount == binCount &&
54  h.includeOutOfRange == includeOutOfRange &&
55  qgsDoubleNear( h.maximum, maximum ) &&
56  qgsDoubleNear( h.minimum, minimum ) &&
57  h.extent == extent &&
58  h.width == width &&
59  h.height == height );
60  }
61 
64 
66  int binCount;
67 
70 
73 
77  HistogramVector histogramVector;
78 
80  double maximum;
81 
83  double minimum;
84 
86  int width;
87 
89  int height;
90 
93 
95  bool valid;
96 };
97 #endif
A rectangle specified with double values.
Definition: qgsrectangle.h:38
int bandNumber
The gdal band number (starts at 1)
int width
Number of columns used to calc histogram.
QVector< int > HistogramVector
double minimum
The minimum histogram value.
int height
Number of rows used to calc histogram.
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
Compare two doubles (but allow some difference)
Definition: qgis.h:203
double maximum
The maximum histogram value.
bool operator==(const QgsRasterHistogram &h) const
Compares region, size etc. not histogram itself.
The QgsRasterHistogram is a container for histogram of a single raster band.
int binCount
Number of bins (intervals,buckets) in histogram.
HistogramVector histogramVector
Store the histogram for a given layer.
bool valid
Histogram is valid.
QgsRectangle extent
Extent used to calc histogram.
bool includeOutOfRange
Whether histogram includes out of range values (in first and last bin)
int nonNullCount
The number of non NULL cells used to calculate histogram.