QGIS API Documentation  2.12.0-Lyon
qgsrastercalculator.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrastercalculator.h - description
3  ---------------------
4  begin : September 28th, 2010
5  copyright : (C) 2010 by Marco Hugentobler
6  email : marco dot hugentobler at sourcepole dot ch
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 QGSRASTERCALCULATOR_H
19 #define QGSRASTERCALCULATOR_H
20 
21 #include "qgsfield.h"
22 #include "qgsrectangle.h"
24 #include <QString>
25 #include <QVector>
26 #include "gdal.h"
27 
28 class QgsRasterLayer;
29 class QProgressDialog;
30 
31 
32 struct ANALYSIS_EXPORT QgsRasterCalculatorEntry
33 {
34  QString ref; //name
35  QgsRasterLayer* raster; //pointer to rasterlayer
36  int bandNumber; //raster band number
37 };
38 
40 class ANALYSIS_EXPORT QgsRasterCalculator
41 {
42  public:
43 
53  QgsRasterCalculator( const QString& formulaString, const QString& outputFile, const QString& outputFormat,
54  const QgsRectangle& outputExtent, int nOutputColumns, int nOutputRows, const QVector<QgsRasterCalculatorEntry>& rasterEntries );
55 
67  QgsRasterCalculator( const QString& formulaString, const QString& outputFile, const QString& outputFormat,
68  const QgsRectangle& outputExtent, const QgsCoordinateReferenceSystem& outputCrs, int nOutputColumns, int nOutputRows, const QVector<QgsRasterCalculatorEntry>& rasterEntries );
69 
71 
75  int processCalculation( QProgressDialog* p = 0 );
76 
77  private:
78  //default constructor forbidden. We need formula, output file, output format and output raster resolution obligatory
80 
83  GDALDriverH openOutputDriver();
84 
87  GDALDatasetH openOutputFile( GDALDriverH outputDriver );
88 
91  void outputGeoTransform( double* transform ) const;
92 
93  QString mFormulaString;
94  QString mOutputFile;
95  QString mOutputFormat;
96 
98  QgsRectangle mOutputRectangle;
100 
102  int mNumOutputColumns;
104  int mNumOutputRows;
105 
106  /***/
107  QVector<QgsRasterCalculatorEntry> mRasterEntries;
108 };
109 
110 #endif // QGSRASTERCALCULATOR_H
A rectangle specified with double values.
Definition: qgsrectangle.h:35
Raster calculator class.
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
void * GDALDatasetH
Class for storing a coordinate reference system (CRS)