~ubuntu-branches/ubuntu/trusty/qgis/trusty

« back to all changes in this revision

Viewing changes to src/core/raster/qgsrasterbandstats.h

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                        qgsrasterbandstats.h  -  description
 
3
                              -------------------
 
4
 begin                : Fri Jun 28 2002
 
5
 copyright            : (C) 2005 by T.Sutton
 
6
 email                : tim@linfiniti.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
/* $Id: qgsrasterlayer.h 4380 2005-12-26 23:37:50Z timlinux $ */
 
18
 
 
19
#ifndef QGSRASTERBANDSTATS
 
20
#define QGSRASTERBANDSTATS
 
21
 
 
22
#include <QString>
 
23
#include <QVector>
 
24
 
 
25
#include <limits>
 
26
 
 
27
#include "qgscolorrampshader.h"
 
28
/** \ingroup core
 
29
 * The RasterBandStats struct is a container for statistics about a single
 
30
 * raster band.
 
31
 */
 
32
class CORE_EXPORT QgsRasterBandStats
 
33
{
 
34
  public:
 
35
    typedef QVector<int> HistogramVector;
 
36
 
 
37
    QgsRasterBandStats()
 
38
    {
 
39
      bandName = "";
 
40
      statsGathered = false;
 
41
      minimumValue = std::numeric_limits<double>::max();
 
42
      maximumValue = std::numeric_limits<double>::min();
 
43
      range = 0.0;
 
44
      mean = 0.0;
 
45
      sumOfSquares = 0.0;
 
46
      stdDev = 0.0;
 
47
      sum = 0.0;
 
48
      elementCount = 0;
 
49
      isHistogramEstimated = false;
 
50
      isHistogramOutOfRange = false;
 
51
    }
 
52
 
 
53
    /** \brief The name of the band that these stats belong to. */
 
54
    QString bandName;
 
55
 
 
56
    /** \brief The gdal band number (starts at 1)*/
 
57
    int bandNumber;
 
58
 
 
59
    /** Color table */
 
60
    QList<QgsColorRampShader::ColorRampItem> colorTable;
 
61
 
 
62
    /** \brief The number of cells in the band. Equivalent to height x width.
 
63
     * TODO: check if NO_DATA are excluded!*/
 
64
    int elementCount;
 
65
 
 
66
    /** \brief whteher histogram values are estimated or completely calculated */
 
67
    bool isHistogramEstimated;
 
68
 
 
69
    /** whehter histogram compuation should include out of range values */
 
70
    bool isHistogramOutOfRange;
 
71
 
 
72
    /** \brief Store the histogram for a given layer */
 
73
    HistogramVector * histogramVector;
 
74
 
 
75
    /** \brief The maximum cell value in the raster band. NO_DATA values
 
76
     * are ignored. This does not use the gdal GetMaximmum function. */
 
77
    double maximumValue;
 
78
 
 
79
    /** \brief The minimum cell value in the raster band. NO_DATA values
 
80
     * are ignored. This does not use the gdal GetMinimum function. */
 
81
    double minimumValue;
 
82
 
 
83
    /** \brief The mean cell value for the band. NO_DATA values are excluded. */
 
84
    double mean;
 
85
 
 
86
    /** \brief The range is the distance between min & max. */
 
87
    double range;
 
88
 
 
89
    /** \brief The standard deviation of the cell values. */
 
90
    double stdDev;
 
91
 
 
92
    /** \brief A flag to indicate whether this RasterBandStats struct
 
93
     * is completely populated */
 
94
    bool statsGathered;
 
95
 
 
96
    /** \brief The sum of all cells in the band. NO_DATA values are excluded. */
 
97
    double sum;
 
98
 
 
99
    /** \brief The sum of the squares. Used to calculate standard deviation. */
 
100
    double sumOfSquares;
 
101
};
 
102
#endif