QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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 */, QgsMeshCalcNode *left /*if true */, QgsMeshCalcNode *right /* if false */ );
109
114 QgsMeshCalcNode( const QString &datasetGroupName );
115
116 ~QgsMeshCalcNode();
117
119 Type type() const;
120
122 void setLeft( QgsMeshCalcNode *left );
123
125 void setRight( QgsMeshCalcNode *right );
126
133 bool calculate( const QgsMeshCalcUtils &dsu, QgsMeshMemoryDatasetGroup &result, bool isAggregate = false ) const;
134
136 QStringList usedDatasetGroupNames() const;
137
139 QStringList aggregatedUsedDatasetGroupNames() const;
140
142 QStringList notAggregatedUsedDatasetGroupNames() const;
143
150 static QgsMeshCalcNode *parseMeshCalcString( const QString &str, QString &parserErrorMsg );
151
156 bool isNonTemporal() const;
157
158 private:
159 Q_DISABLE_COPY( QgsMeshCalcNode )
160
161 Type mType = tNoData;
162 std::unique_ptr<QgsMeshCalcNode> mLeft;
163 std::unique_ptr<QgsMeshCalcNode> mRight;
164 std::unique_ptr<QgsMeshCalcNode> mCondition;
165 double mNumber = std::numeric_limits<double>::quiet_NaN();
166 QString mDatasetGroupName;
167 Operator mOperator = opNONE;
168};
169
171
172#endif // QGSMESHCALCNODE_H