~ubuntu-branches/ubuntu/utopic/qgis/utopic

« back to all changes in this revision

Viewing changes to src/analysis/vector/qgszonalstatistics.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
                          qgszonalstatistics.h  -  description
 
3
                          ----------------------------
 
4
    begin                : August 29th, 2009
 
5
    copyright            : (C) 2009 by Marco Hugentobler
 
6
    email                : marco at hugis dot net
 
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 QGSZONALSTATISTICS_H
 
19
#define QGSZONALSTATISTICS_H
 
20
 
 
21
#include "qgsrectangle.h"
 
22
#include <QString>
 
23
 
 
24
class QgsVectorLayer;
 
25
class QProgressDialog;
 
26
 
 
27
/**A class that calculates raster statistics (count, sum, mean) for a polygon or multipolygon layer and appends the results as attributes*/
 
28
class ANALYSIS_EXPORT QgsZonalStatistics
 
29
{
 
30
  public:
 
31
    QgsZonalStatistics( QgsVectorLayer* polygonLayer, const QString& rasterFile, const QString& attributePrefix = "", int rasterBand = 1 );
 
32
    ~QgsZonalStatistics();
 
33
 
 
34
    /**Starts the calculation
 
35
      @return 0 in case of success*/
 
36
    int calculateStatistics( QProgressDialog* p );
 
37
 
 
38
  private:
 
39
    QgsZonalStatistics();
 
40
    /**Analysis what cells need to be considered to cover the bounding box of a feature
 
41
      @return 0 in case of success*/
 
42
    int cellInfoForBBox( const QgsRectangle& rasterBBox, const QgsRectangle& featureBBox, double cellSizeX, double cellSizeY,
 
43
                         int& offsetX, int& offsetY, int& nCellsX, int& nCellsY ) const;
 
44
 
 
45
    QString mRasterFilePath;
 
46
    /**Raster band to calculate statistics from (defaults to 1)*/
 
47
    int mRasterBand;
 
48
    QgsVectorLayer* mPolygonLayer;
 
49
    QString mAttributePrefix;
 
50
    /**The nodata value of the input layer*/
 
51
    float mInputNodataValue;
 
52
};
 
53
 
 
54
#endif // QGSZONALSTATISTICS_H