QGIS API Documentation  2.14.0-Essen
qgsrastercalcnode.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrastercalcnode.h
3  Node for raster calculator tree
4  --------------------
5  begin : 2010-10-23
6  copyright : (C) 20010 by Marco Hugentobler
7  email : marco dot hugentobler at sourcepole dot ch
8 ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 #ifndef QGSRASTERCALCNODE_H
20 #define QGSRASTERCALCNODE_H
21 
22 #include "qgsrastermatrix.h"
23 #include <QMap>
24 #include <QString>
25 
26 class QgsRasterBlock;
27 
28 class ANALYSIS_EXPORT QgsRasterCalcNode
29 {
30  public:
32  enum Type
33  {
34  tOperator = 1,
37  tMatrix
38  };
39 
41  enum Operator
42  {
55  opEQ, // =
56  opNE,
57  opGT, // >
58  opLT, // <
59  opGE, // >=
60  opLE, // <=
63  opSIGN, // change sign
67  };
68 
70  QgsRasterCalcNode( double number );
73  QgsRasterCalcNode( const QString& rasterName );
75 
76  Type type() const { return mType; }
77 
78  //set left node
79  void setLeft( QgsRasterCalcNode* left ) { delete mLeft; mLeft = left; }
80  void setRight( QgsRasterCalcNode* right ) { delete mRight; mRight = right; }
81 
90  bool calculate( QMap<QString, QgsRasterBlock* >& rasterData, QgsRasterMatrix& result, int row = -1 ) const;
91 
94  Q_DECL_DEPRECATED bool calculate( QMap<QString, QgsRasterMatrix*>& rasterData, QgsRasterMatrix& result ) const;
95 
96  static QgsRasterCalcNode* parseRasterCalcString( const QString& str, QString& parserErrorMsg );
97 
98  private:
99  Type mType;
100  QgsRasterCalcNode* mLeft;
101  QgsRasterCalcNode* mRight;
102  double mNumber;
103  QString mRasterName;
104  QgsRasterMatrix* mMatrix;
105  Operator mOperator;
106 
108  QgsRasterCalcNode& operator=( const QgsRasterCalcNode& rh );
109 };
110 
111 
112 #endif // QGSRASTERCALCNODE_H
Raster data container.
Type
defines possible types of node
Operator
possible operators
void setLeft(QgsRasterCalcNode *left)
void setRight(QgsRasterCalcNode *right)
Type type() const