QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 
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 
97  Q_DECL_DEPRECATED bool calculate( QMap<QString, QgsRasterMatrix*>& rasterData, QgsRasterMatrix& result ) const;
98 
99  static QgsRasterCalcNode* parseRasterCalcString( const QString& str, QString& parserErrorMsg );
100 
101  private:
102  Type mType;
103  QgsRasterCalcNode* mLeft;
104  QgsRasterCalcNode* mRight;
105  double mNumber;
106  QString mRasterName;
107  QgsRasterMatrix* mMatrix;
108  Operator mOperator;
109 
111  QgsRasterCalcNode& operator=( const QgsRasterCalcNode& rh );
112 };
113 
114 
115 #endif // QGSRASTERCALCNODE_H
Raster data container.
Type
defines possible types of node
Operator
possible operators
void setLeft(QgsRasterCalcNode *left)
void setRight(QgsRasterCalcNode *right)