QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 <QString>
22 #include <QVector>
23 
24 #include <limits>
25 
30 class CORE_EXPORT QgsRasterHistogram
31 {
32  public:
34 
36  {
37  bandNumber = 0;
38  binCount = 0;
39  nonNullCount = 0;
40  includeOutOfRange = false;
41  maximum = 0;
42  minimum = 0;
43  width = 0;
44  height = 0;
45  valid = false;
46  }
47 
49  bool operator==( const QgsRasterHistogram &h ) const
50  {
51  return ( h.bandNumber == bandNumber &&
52  h.binCount == binCount &&
53  h.includeOutOfRange == includeOutOfRange &&
54  qgsDoubleNear( h.maximum, maximum ) &&
55  qgsDoubleNear( h.minimum, minimum ) &&
56  h.extent == extent &&
57  h.width == width &&
58  h.height == height );
59  }
60 
63 
65  int binCount;
66 
69 
72 
76  HistogramVector histogramVector;
77 
79  double maximum;
80 
82  double minimum;
83 
85  int width;
86 
88  int height;
89 
92 
94  bool valid;
95 };
96 #endif
A rectangle specified with double values.
Definition: qgsrectangle.h:35
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:353
double maximum
The maximum histogram value.
bool operator==(const QgsRasterHistogram &h) const
Compares region, size etc.
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.