QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsrasterbandstats.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrasterbandstats.h - description
3  -------------------
4  begin : Fri Jun 28 2002
5  copyright : (C) 2005 by T.Sutton
6  email : [email protected]
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 QGSRASTERBANDSTATS
19 #define QGSRASTERBANDSTATS
20 
21 #include <QString>
22 #include <QVector>
23 
24 #include <limits>
25 
26 #include "qgscolorrampshader.h"
27 #include "qgsrectangle.h"
28 
33 class CORE_EXPORT QgsRasterBandStats
34 {
35  public:
36  enum Stats
37  {
38  None = 0,
39  Min = 1,
40  Max = 1 << 1,
41  Range = 1 << 2,
42  Sum = 1 << 3,
43  Mean = 1 << 4,
44  StdDev = 1 << 5,
45  SumOfSquares = 1 << 6,
46  All = Min | Max | Range | Sum | Mean | StdDev | SumOfSquares
47  };
48 
50  {
51  statsGathered = None;
52  minimumValue = std::numeric_limits<double>::max();
53  maximumValue = -std::numeric_limits<double>::max();
54  range = 0.0;
55  mean = 0.0;
56  sumOfSquares = 0.0;
57  stdDev = 0.0;
58  sum = 0.0;
59  elementCount = 0;
60  width = 0;
61  height = 0;
62  bandNumber = 1;
63  }
64 
66  bool contains( const QgsRasterBandStats &s ) const
67  {
68  return ( s.bandNumber == bandNumber &&
69  s.extent == extent &&
70  s.width == width &&
71  s.height == height &&
72  s.statsGathered == ( statsGathered & s.statsGathered ) );
73  }
74 
77 
79  // TODO: check if no data are excluded in stats calculation
81 
84  double maximumValue;
85 
88  double minimumValue;
89 
91  double mean;
92 
94  double range;
95 
97  double stdDev;
98 
101 
103  double sum;
104 
106  double sumOfSquares;
107 
109  int width;
110 
112  int height;
113 
116 };
117 #endif