QGIS API Documentation 3.99.0-Master (c22de0620c0)
Loading...
Searching...
No Matches
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
23
24#include <limits>
25#include <memory>
26
27#include "qgis_core.h"
28#include "qgsmeshcalcutils.h"
29
30#include <QMap>
31#include <QString>
32#include <QStringList>
33
34#define SIP_NO_FILE
35
43class CORE_EXPORT QgsMeshCalcNode
44{
45 public:
47 enum Type
48 {
49 tOperator = 1,
50 tNumber,
51 tNoData,
52 tDatasetGroupRef
53 };
54
56 enum Operator
57 {
58 opPLUS,
59 opMINUS,
60 opMUL,
61 opDIV,
62 opPOW,
63 opEQ,
64 opNE,
65 opGT,
66 opLT,
67 opGE,
68 opLE,
69 opAND,
70 opOR,
71 opNOT,
72 opIF,
73 opSIGN,
74 opMIN,
75 opMAX,
76 opABS,
77 opSUM_AGGR,
78 opMAX_AGGR,
79 opMIN_AGGR,
80 opAVG_AGGR,
81 opNONE,
82 };
83
87 QgsMeshCalcNode();
88
92 QgsMeshCalcNode( double number );
93
100 QgsMeshCalcNode( Operator op, QgsMeshCalcNode *left, QgsMeshCalcNode *right );
101
108 QgsMeshCalcNode( QgsMeshCalcNode *condition /* bool condition */,
109 QgsMeshCalcNode *left /*if true */,
110 QgsMeshCalcNode *right /* if false */ );
111
116 QgsMeshCalcNode( const QString &datasetGroupName );
117
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, bool isAggregate = false ) const;
136
138 QStringList usedDatasetGroupNames() const;
139
141 QStringList aggregatedUsedDatasetGroupNames() const;
142
144 QStringList notAggregatedUsedDatasetGroupNames() const;
145
152 static QgsMeshCalcNode *parseMeshCalcString( const QString &str, QString &parserErrorMsg );
153
158 bool isNonTemporal() const;
159
160 private:
161 Q_DISABLE_COPY( QgsMeshCalcNode )
162
163 Type mType = tNoData;
164 std::unique_ptr<QgsMeshCalcNode> mLeft;
165 std::unique_ptr<QgsMeshCalcNode> mRight;
166 std::unique_ptr<QgsMeshCalcNode> mCondition;
167 double mNumber = std::numeric_limits<double>::quiet_NaN();
168 QString mDatasetGroupName;
169 Operator mOperator = opNONE;
170};
171
173
174#endif // QGSMESHCALCNODE_H