QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsmeshcalcnode.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmeshcalcnode.h
3  --------------------------------
4  begin : December 18th, 2018
5  copyright : (C) 2018 by Peter Petrik
6  email : zilolv at gmail dot com
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 QGSMESHCALCNODE_H
19 #define QGSMESHCALCNODE_H
20 
21 #define SIP_NO_FILE
22 
24 
25 #include <QMap>
26 #include <QString>
27 #include <QStringList>
28 #include <memory>
29 #include <limits>
30 
31 #include "qgis_core.h"
32 
33 #include "qgsmeshcalcutils.h"
34 
42 class CORE_EXPORT QgsMeshCalcNode
43 {
44  public:
46  enum Type
47  {
48  tOperator = 1,
49  tNumber,
50  tNoData,
51  tDatasetGroupRef
52  };
53 
55  enum Operator
56  {
57  opPLUS,
58  opMINUS,
59  opMUL,
60  opDIV,
61  opPOW,
62  opEQ,
63  opNE,
64  opGT,
65  opLT,
66  opGE,
67  opLE,
68  opAND,
69  opOR,
70  opNOT,
71  opIF,
72  opSIGN,
73  opMIN,
74  opMAX,
75  opABS,
76  opSUM_AGGR,
77  opMAX_AGGR,
78  opMIN_AGGR,
79  opAVG_AGGR,
80  opNONE,
81  };
82 
86  QgsMeshCalcNode();
87 
91  QgsMeshCalcNode( double number );
92 
99  QgsMeshCalcNode( Operator op, QgsMeshCalcNode *left, QgsMeshCalcNode *right );
100 
107  QgsMeshCalcNode( QgsMeshCalcNode *condition /* bool condition */,
108  QgsMeshCalcNode *left /*if true */,
109  QgsMeshCalcNode *right /* if false */ );
110 
115  QgsMeshCalcNode( const QString &datasetGroupName );
116 
118  ~QgsMeshCalcNode();
119 
121  Type type() const;
122 
124  void setLeft( QgsMeshCalcNode *left );
125 
127  void setRight( QgsMeshCalcNode *right );
128 
135  bool calculate( const QgsMeshCalcUtils &dsu, QgsMeshMemoryDatasetGroup &result ) const;
136 
138  QStringList usedDatasetGroupNames() const;
139 
146  static QgsMeshCalcNode *parseMeshCalcString( const QString &str, QString &parserErrorMsg );
147 
152  bool isNonTemporal() const;
153 
154  private:
155  Q_DISABLE_COPY( QgsMeshCalcNode )
156 
157  Type mType = tNoData;
158  std::unique_ptr<QgsMeshCalcNode> mLeft;
159  std::unique_ptr<QgsMeshCalcNode> mRight;
160  std::unique_ptr<QgsMeshCalcNode> mCondition;
161  double mNumber = std::numeric_limits<double>::quiet_NaN();
162  QString mDatasetGroupName;
163  Operator mOperator = opNONE;
164 };
165 
167 
168 #endif // QGSMESHCALCNODE_H
qgsmeshcalcutils.h
QgsMeshMemoryDatasetGroup
Class that represents a dataset group stored in memory The QgsMeshMemoryDataset objects stores in a Q...
Definition: qgsmeshdataset.h:727