QGIS API Documentation  2.99.0-Master (c42dad3)
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 <QMap>
23 #include <QString>
24 
25 class QgsRasterBlock;
26 class QgsRasterMatrix;
27 
31 class ANALYSIS_EXPORT QgsRasterCalcNode
32 {
33  public:
35  enum Type
36  {
37  tOperator = 1,
40  tMatrix
41  };
42 
44  enum Operator
45  {
58  opEQ, // =
59  opNE,
60  opGT, // >
61  opLT, // <
62  opGE, // >=
63  opLE, // <=
66  opSIGN, // change sign
70  };
71 
73  QgsRasterCalcNode( double number );
76  QgsRasterCalcNode( const QString& rasterName );
78 
79  Type type() const { return mType; }
80 
81  //set left node
82  void setLeft( QgsRasterCalcNode* left ) { delete mLeft; mLeft = left; }
83  void setRight( QgsRasterCalcNode* right ) { delete mRight; mRight = right; }
84 
93  bool calculate( QMap<QString, QgsRasterBlock* >& rasterData, QgsRasterMatrix& result, int row = -1 ) const;
94 
95  static QgsRasterCalcNode* parseRasterCalcString( const QString& str, QString& parserErrorMsg );
96 
97  private:
98  Type mType;
99  QgsRasterCalcNode* mLeft;
100  QgsRasterCalcNode* mRight;
101  double mNumber;
102  QString mRasterName;
103  QgsRasterMatrix* mMatrix;
104  Operator mOperator;
105 
107  QgsRasterCalcNode& operator=( const QgsRasterCalcNode& rh );
108 };
109 
110 
111 #endif // QGSRASTERCALCNODE_H
Raster data container.
Type
defines possible types of node
Operator
possible operators
void setLeft(QgsRasterCalcNode *left)
void setRight(QgsRasterCalcNode *right)