-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
qgsrasterhistogram.h
91 lines (73 loc) · 2.89 KB
/
qgsrasterhistogram.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/***************************************************************************
qgsrasterhistogram.h
-------------------
begin : July 2012
copyright : (C) 2012 by Radim Blazek
email : radim dot blazek at gmail dot com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSRASTERHISTOGRAM
#define QGSRASTERHISTOGRAM
#include "qgis_core.h"
#include "qgsrectangle.h"
#include <QString>
#include <QVector>
#include <limits>
/**
* \ingroup core
* The QgsRasterHistogram is a container for histogram of a single raster band.
* It is used to cache computed histograms in raster providers.
*/
class CORE_EXPORT QgsRasterHistogram
{
public:
typedef QVector<int> HistogramVector;
/**
* Constructor for an invalid QgsRasterHistogram.
*/
QgsRasterHistogram() = default;
//! Compares region, size etc. not histogram itself
bool operator==( const QgsRasterHistogram &h ) const
{
return ( h.bandNumber == bandNumber &&
h.binCount == binCount &&
h.includeOutOfRange == includeOutOfRange &&
qgsDoubleNear( h.maximum, maximum ) &&
qgsDoubleNear( h.minimum, minimum ) &&
h.extent == extent &&
h.width == width &&
h.height == height );
}
//! \brief The gdal band number (starts at 1)
int bandNumber = 0;
//! \brief Number of bins (intervals,buckets) in histogram.
int binCount = 0;
//! \brief The number of non NULL cells used to calculate histogram.
int nonNullCount = 0;
//! \brief Whether histogram includes out of range values (in first and last bin)
bool includeOutOfRange = false;
/**
* Stores the histogram for a given layer
*/
QgsRasterHistogram::HistogramVector histogramVector;
//! \brief The maximum histogram value.
double maximum = 0;
//! \brief The minimum histogram value.
double minimum = 0;
//! \brief Number of columns used to calc histogram
int width = 0;
//! \brief Number of rows used to calc histogram
int height = 0;
//! \brief Extent used to calc histogram
QgsRectangle extent;
//! \brief Histogram is valid
bool valid = false;
};
#endif