QGIS API Documentation 3.41.0-Master (45a0abf3bec)
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#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
42class 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
117 ~QgsMeshCalcNode();
118
120 Type type() const;
121
123 void setLeft( QgsMeshCalcNode *left );
124
126 void setRight( QgsMeshCalcNode *right );
127
134 bool calculate( const QgsMeshCalcUtils &dsu, QgsMeshMemoryDatasetGroup &result, bool isAggregate = false ) const;
135
137 QStringList usedDatasetGroupNames() const;
138
140 QStringList aggregatedUsedDatasetGroupNames() const;
141
143 QStringList notAggregatedUsedDatasetGroupNames() const;
144
151 static QgsMeshCalcNode *parseMeshCalcString( const QString &str, QString &parserErrorMsg );
152
157 bool isNonTemporal() const;
158
159 private:
160 Q_DISABLE_COPY( QgsMeshCalcNode )
161
162 Type mType = tNoData;
163 std::unique_ptr<QgsMeshCalcNode> mLeft;
164 std::unique_ptr<QgsMeshCalcNode> mRight;
165 std::unique_ptr<QgsMeshCalcNode> mCondition;
166 double mNumber = std::numeric_limits<double>::quiet_NaN();
167 QString mDatasetGroupName;
168 Operator mOperator = opNONE;
169};
170
172
173#endif // QGSMESHCALCNODE_H
Class that represents a dataset group stored in memory.
#define str(x)
Definition qgis.cpp:39