QGIS API Documentation  2.11.0-Master
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 
70 
72 
76  int processCalculation( QProgressDialog* p = 0 );
77 
78  private:
79  //default constructor forbidden. We need formula, output file, output format and output raster resolution obligatory
81 
84  GDALDriverH openOutputDriver();
85 
88  GDALDatasetH openOutputFile( GDALDriverH outputDriver );
89 
92  void outputGeoTransform( double* transform ) const;
93 
94  QString mFormulaString;
95  QString mOutputFile;
96  QString mOutputFormat;
97 
99  QgsRectangle mOutputRectangle;
100  QgsCoordinateReferenceSystem mOutputCrs;
101 
103  int mNumOutputColumns;
105  int mNumOutputRows;
106 
107  /***/
108  QVector<QgsRasterCalculatorEntry> mRasterEntries;
109 };
110 
111 #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)