|
Quantum GIS API Documentation
master-693a1fe
|
00001 /*************************************************************************** 00002 qgsrasterbandstats.h - description 00003 ------------------- 00004 begin : Fri Jun 28 2002 00005 copyright : (C) 2005 by T.Sutton 00006 email : tim@linfiniti.com 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef QGSRASTERBANDSTATS 00019 #define QGSRASTERBANDSTATS 00020 00021 #include <QString> 00022 #include <QVector> 00023 00024 #include <limits> 00025 00026 #include "qgscolorrampshader.h" 00027 #include "qgsrectangle.h" 00028 00033 class CORE_EXPORT QgsRasterBandStats 00034 { 00035 public: 00036 enum Stats 00037 { 00038 None = 0, 00039 Min = 1, 00040 Max = 1 << 1, 00041 Range = 1 << 2, 00042 Sum = 1 << 3, 00043 Mean = 1 << 4, 00044 StdDev = 1 << 5, 00045 SumOfSquares = 1 << 6, 00046 All = Min | Max | Range | Sum | Mean | StdDev | SumOfSquares 00047 }; 00048 00049 QgsRasterBandStats() 00050 { 00051 statsGathered = None; 00052 minimumValue = std::numeric_limits<double>::max(); 00053 maximumValue = std::numeric_limits<double>::min(); 00054 range = 0.0; 00055 mean = 0.0; 00056 sumOfSquares = 0.0; 00057 stdDev = 0.0; 00058 sum = 0.0; 00059 elementCount = 0; 00060 width = 0; 00061 height = 0; 00062 } 00063 00065 bool contains( const QgsRasterBandStats &s ) const 00066 { 00067 return ( s.bandNumber == bandNumber && 00068 s.extent == extent && 00069 s.width == width && 00070 s.height == height && 00071 s.statsGathered == ( statsGathered & s.statsGathered ) ); 00072 } 00073 00075 //QString bandName; 00076 00078 int bandNumber; 00079 00081 // TODO: check if no data are excluded in stats calculation 00082 size_t elementCount; 00083 00086 double maximumValue; 00087 00090 double minimumValue; 00091 00093 double mean; 00094 00096 double range; 00097 00099 double stdDev; 00100 00102 int statsGathered; 00103 00105 double sum; 00106 00108 double sumOfSquares; 00109 00111 int width; 00112 00114 int height; 00115 00117 QgsRectangle extent; 00118 }; 00119 #endif