QgsMeshCalculator class
Performs mesh layer calculations.
Contents
Mesh calculator can do various mathematical operations between dataset groups from a single mesh layer. Resulting dataset group is added to the mesh layer. Result can be filtered by extent or a vector layer mask spatially and by selection of times.
Note: only dataset groups defined on vertices are implemented and supported
Public types
- enum Result { Success = 0, Canceled, CreateOutputError, InputLayerError, ParserError, InvalidDatasets, EvaluateError, MemoryError }
- Result of the calculation.
Public static functions
- static auto expression_valid(const QString& formulaString, QgsMeshLayer* layer) -> Result
- Returns whether formula is valid for particular mesh layer.
Constructors, destructors, conversion operators
- QgsMeshCalculator(const QString& formulaString, const QString& outputFile, const QgsRectangle& outputExtent, double startTime, double endTime, QgsMeshLayer* layer)
- Creates calculator with bounding box (rectangular) mask.
- QgsMeshCalculator(const QString& formulaString, const QString& outputFile, const QgsGeometry& outputMask, double startTime, double endTime, QgsMeshLayer* layer)
- Creates calculator with geometry mask.
Public functions
- auto processCalculation(QgsFeedback* feedback = nullptr) -> Result
- Starts the calculation, writes new dataset group to file and adds it to the mesh layer.
Enum documentation
enum QgsMeshCalculator:: Result
Result of the calculation.
| Enumerators | |
|---|---|
| Success |
Calculation successful. |
| Canceled |
Calculation canceled. |
| CreateOutputError |
Error creating output data file. |
| InputLayerError |
Error reading input layer. |
| ParserError |
Error parsing formula. |
| InvalidDatasets |
Datasets with different time outputs or not part of the mesh. |
| EvaluateError |
Error during evaluation. |
| MemoryError |
Error allocating memory for result. |
Function documentation
static Result QgsMeshCalculator:: expression_valid(const QString& formulaString,
QgsMeshLayer* layer)
Returns whether formula is valid for particular mesh layer.
| Parameters | |
|---|---|
| formulaString | formula/expression to evaluate. Consists of dataset group names, operators and numbers |
| layer | mesh layer with dataset groups references in formulaString |
| Returns | QgsMeshCalculator:: |
QgsMeshCalculator:: QgsMeshCalculator(const QString& formulaString,
const QString& outputFile,
const QgsRectangle& outputExtent,
double startTime,
double endTime,
QgsMeshLayer* layer)
Creates calculator with bounding box (rectangular) mask.
| Parameters | |
|---|---|
| formulaString | formula/expression to evaluate. Consists of dataset group names, operators and numbers |
| outputFile | file to store the resulting dataset group data |
| outputExtent | spatial filter defined by rectangle |
| startTime | time filter defining the starting dataset |
| endTime | time filter defining the ending dataset |
| layer | mesh layer with dataset groups references in formulaString |
QgsMeshCalculator:: QgsMeshCalculator(const QString& formulaString,
const QString& outputFile,
const QgsGeometry& outputMask,
double startTime,
double endTime,
QgsMeshLayer* layer)
Creates calculator with geometry mask.
| Parameters | |
|---|---|
| formulaString | formula/expression to evaluate. Consists of dataset group names, operators and numbers |
| outputFile | file to store the resulting dataset group data |
| outputMask | spatial filter defined by geometry |
| startTime | time filter defining the starting dataset |
| endTime | time filter defining the ending dataset |
| layer | mesh layer with dataset groups references in formulaString |
Result QgsMeshCalculator:: processCalculation(QgsFeedback* feedback = nullptr)
Starts the calculation, writes new dataset group to file and adds it to the mesh layer.
| Parameters | |
|---|---|
| feedback | The optional feedback argument for progress reporting and cancelation support |
| Returns | QgsMeshCalculator:: |