QGIS API Documentation  2.99.0-Master (53aba61)
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 "qgis_sip.h"
24 #include "qgis.h"
25 #include <QString>
26 #include "qgis_analysis.h"
27 
28 class QgsRasterBlock;
29 class QgsRasterMatrix;
30 
34 class ANALYSIS_EXPORT QgsRasterCalcNode
35 {
36  public:
38  enum Type
39  {
40  tOperator = 1,
43  tMatrix
44  };
45 
47  enum Operator
48  {
61  opEQ, // =
62  opNE,
63  opGT, // >
64  opLT, // <
65  opGE, // >=
66  opLE, // <=
69  opSIGN, // change sign
73  };
74 
76  QgsRasterCalcNode( double number );
79  QgsRasterCalcNode( const QString &rasterName );
81 
83  QgsRasterCalcNode( const QgsRasterCalcNode &rh ) = delete;
85  QgsRasterCalcNode &operator=( const QgsRasterCalcNode &rh ) = delete;
86 
87  Type type() const { return mType; }
88 
89  //set left node
90  void setLeft( QgsRasterCalcNode *left ) { delete mLeft; mLeft = left; }
91  void setRight( QgsRasterCalcNode *right ) { delete mRight; mRight = right; }
92 
101  bool calculate( QMap<QString, QgsRasterBlock * > &rasterData, QgsRasterMatrix &result, int row = -1 ) const SIP_SKIP;
102 
103  static QgsRasterCalcNode *parseRasterCalcString( const QString &str, QString &parserErrorMsg ) SIP_FACTORY;
104 
105  private:
106 #ifdef SIP_RUN
108 #endif
109 
110  Type mType;
111  QgsRasterCalcNode *mLeft = nullptr;
112  QgsRasterCalcNode *mRight = nullptr;
113  double mNumber;
114  QString mRasterName;
115  QgsRasterMatrix *mMatrix = nullptr;
116  Operator mOperator;
117 
118 };
119 
120 
121 #endif // QGSRASTERCALCNODE_H
Raster data container.
#define SIP_SKIP
Definition: qgis_sip.h:119
Type
defines possible types of node
Operator
possible operators
#define SIP_FACTORY
Definition: qgis_sip.h:69
void setLeft(QgsRasterCalcNode *left)
void setRight(QgsRasterCalcNode *right)