QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
Public Types | Public Member Functions | Static Public Member Functions | List of all members
QgsMeshCalculator Class Reference

Performs mesh layer calculations. More...

#include <qgsmeshcalculator.h>

Public Types

enum  Result {
  Success = 0 , Canceled , CreateOutputError , InputLayerError ,
  ParserError , InvalidDatasets , EvaluateError , MemoryError
}
 Result of the calculation. More...
 

Public Member Functions

 QgsMeshCalculator (const QString &formulaString, const QString &outputDriver, const QString &outputGroupName, const QString &outputFile, const QgsGeometry &outputMask, double startTime, double endTime, QgsMeshLayer *layer)
 Creates calculator with geometry mask. More...
 
 QgsMeshCalculator (const QString &formulaString, const QString &outputDriver, const QString &outputGroupName, const QString &outputFile, const QgsRectangle &outputExtent, double startTime, double endTime, QgsMeshLayer *layer)
 Creates calculator with bounding box (rectangular) mask. More...
 
Q_DECL_DEPRECATED QgsMeshCalculator (const QString &formulaString, const QString &outputFile, const QgsGeometry &outputMask, double startTime, double endTime, QgsMeshLayer *layer)
 Creates calculator with geometry mask. More...
 
Q_DECL_DEPRECATED QgsMeshCalculator (const QString &formulaString, const QString &outputFile, const QgsRectangle &outputExtent, double startTime, double endTime, QgsMeshLayer *layer)
 Creates calculator with bounding box (rectangular) mask. More...
 
 QgsMeshCalculator (const QString &formulaString, const QString &outputGroupName, const QgsGeometry &outputMask, const QgsMeshDatasetGroup::Type &destination, QgsMeshLayer *layer, double startTime, double endTime)
 Creates calculator with with geometry mask, store the result in destination (must be on memory or virtual), see QgsMeshCalculator::Destination. More...
 
 QgsMeshCalculator (const QString &formulaString, const QString &outputGroupName, const QgsRectangle &outputExtent, const QgsMeshDatasetGroup::Type &destination, QgsMeshLayer *layer, double startTime, double endTime)
 Creates calculator with bounding box (rectangular) mask, store the result in destination (must be on memory or virtual), see QgsMeshCalculator::Destination. More...
 
Result processCalculation (QgsFeedback *feedback=nullptr)
 Starts the calculation, creates new dataset group and adds it to the mesh layer. More...
 

Static Public Member Functions

static Q_DECL_DEPRECATED Result expression_valid (const QString &formulaString, QgsMeshLayer *layer)
 Returns whether formula is valid for particular mesh layer. More...
 
static Result expressionIsValid (const QString &formulaString, QgsMeshLayer *layer, QgsMeshDriverMetadata::MeshDriverCapability &requiredCapability)
 Returns whether formula is valid for particular mesh layer. More...
 

Detailed Description

Performs mesh layer calculations.

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.

Resulting dataset is always scalar

Since
QGIS 3.6

Definition at line 50 of file qgsmeshcalculator.h.

Member Enumeration Documentation

◆ Result

Result of the calculation.

Enumerator
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.

Definition at line 55 of file qgsmeshcalculator.h.

Constructor & Destructor Documentation

◆ QgsMeshCalculator() [1/6]

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
formulaStringformula/expression to evaluate. Consists of dataset group names, operators and numbers
outputFilefile to store the resulting dataset group data
outputExtentspatial filter defined by rectangle
startTimetime filter defining the starting dataset
endTimetime filter defining the ending dataset
layermesh layer with dataset groups references in formulaString
Deprecated:
QGIS 3.12

Definition at line 31 of file qgsmeshcalculator.cpp.

◆ QgsMeshCalculator() [2/6]

QgsMeshCalculator::QgsMeshCalculator ( const QString &  formulaString,
const QString &  outputFile,
const QgsGeometry outputMask,
double  startTime,
double  endTime,
QgsMeshLayer layer 
)

Creates calculator with geometry mask.

Parameters
formulaStringformula/expression to evaluate. Consists of dataset group names, operators and numbers
outputFilefile to store the resulting dataset group data
outputMaskspatial filter defined by geometry
startTimetime filter defining the starting dataset
endTimetime filter defining the ending dataset
layermesh layer with dataset groups references in formulaString
Deprecated:
QGIS 3.12

Definition at line 50 of file qgsmeshcalculator.cpp.

◆ QgsMeshCalculator() [3/6]

QgsMeshCalculator::QgsMeshCalculator ( const QString &  formulaString,
const QString &  outputDriver,
const QString &  outputGroupName,
const QString &  outputFile,
const QgsRectangle outputExtent,
double  startTime,
double  endTime,
QgsMeshLayer layer 
)

Creates calculator with bounding box (rectangular) mask.

Parameters
formulaStringformula/expression to evaluate. Consists of dataset group names, operators and numbers
outputDriveroutput driver name
outputGroupNameoutput group name
outputFilefile to store the resulting dataset group data
outputExtentspatial filter defined by rectangle
startTimetime filter defining the starting dataset
endTimetime filter defining the ending dataset
layermesh layer with dataset groups references in formulaString
Since
QGIS 3.12

Definition at line 70 of file qgsmeshcalculator.cpp.

◆ QgsMeshCalculator() [4/6]

QgsMeshCalculator::QgsMeshCalculator ( const QString &  formulaString,
const QString &  outputDriver,
const QString &  outputGroupName,
const QString &  outputFile,
const QgsGeometry outputMask,
double  startTime,
double  endTime,
QgsMeshLayer layer 
)

Creates calculator with geometry mask.

Parameters
formulaStringformula/expression to evaluate. Consists of dataset group names, operators and numbers
outputDriveroutput driver name
outputGroupNameoutput group name
outputFilefile to store the resulting dataset group data
outputMaskspatial filter defined by geometry
startTimetime filter defining the starting dataset
endTimetime filter defining the ending dataset
layermesh layer with dataset groups references in formulaString
Since
QGIS 3.12

Definition at line 91 of file qgsmeshcalculator.cpp.

◆ QgsMeshCalculator() [5/6]

QgsMeshCalculator::QgsMeshCalculator ( const QString &  formulaString,
const QString &  outputGroupName,
const QgsRectangle outputExtent,
const QgsMeshDatasetGroup::Type destination,
QgsMeshLayer layer,
double  startTime,
double  endTime 
)

Creates calculator with bounding box (rectangular) mask, store the result in destination (must be on memory or virtual), see QgsMeshCalculator::Destination.

Parameters
formulaStringformula/expression to evaluate. Consists of dataset group names, operators and numbers
outputGroupNameoutput group name
outputExtentspatial filter defined by rectangle
destinationdestination of the calculation (memory or virtual)
startTimetime filter defining the starting dataset
endTimetime filter defining the ending dataset
layermesh layer with dataset groups references in formulaString
Since
QGIS 3.16

Definition at line 112 of file qgsmeshcalculator.cpp.

◆ QgsMeshCalculator() [6/6]

QgsMeshCalculator::QgsMeshCalculator ( const QString &  formulaString,
const QString &  outputGroupName,
const QgsGeometry outputMask,
const QgsMeshDatasetGroup::Type destination,
QgsMeshLayer layer,
double  startTime,
double  endTime 
)

Creates calculator with with geometry mask, store the result in destination (must be on memory or virtual), see QgsMeshCalculator::Destination.

Parameters
formulaStringformula/expression to evaluate. Consists of dataset group names, operators and numbers
outputGroupNameoutput group name
outputMaskspatial filter defined by geometry
destinationdestination of the calculation (memory or virtual)
startTimetime filter defining the starting dataset
endTimetime filter defining the ending dataset
layermesh layer with dataset groups references in formulaString
Since
QGIS 3.16

Definition at line 130 of file qgsmeshcalculator.cpp.

Member Function Documentation

◆ expression_valid()

QgsMeshCalculator::Result QgsMeshCalculator::expression_valid ( const QString &  formulaString,
QgsMeshLayer layer 
)
static

Returns whether formula is valid for particular mesh layer.

Parameters
formulaStringformula/expression to evaluate. Consists of dataset group names, operators and numbers
layermesh layer with dataset groups references in formulaString
Returns
QgsMeshCalculator::Success in case of success
Deprecated:
QGIS 3.12 - use expressionIsValid

Definition at line 148 of file qgsmeshcalculator.cpp.

◆ expressionIsValid()

QgsMeshCalculator::Result QgsMeshCalculator::expressionIsValid ( const QString &  formulaString,
QgsMeshLayer layer,
QgsMeshDriverMetadata::MeshDriverCapability requiredCapability 
)
static

Returns whether formula is valid for particular mesh layer.

Parameters
formulaStringformula/expression to evaluate. Consists of dataset group names, operators and numbers
layermesh layer with dataset groups references in formulaString
requiredCapabilityreturns required capability of driver to store results of the calculation
Returns
QgsMeshCalculator::Success in case of success
Since
QGIS 3.12

Definition at line 156 of file qgsmeshcalculator.cpp.

◆ processCalculation()

QgsMeshCalculator::Result QgsMeshCalculator::processCalculation ( QgsFeedback feedback = nullptr)

Starts the calculation, creates new dataset group and adds it to the mesh layer.

Parameters
feedbackThe optional feedback argument for progress reporting and cancellation support
Returns
QgsMeshCalculator::Success in case of success

Definition at line 177 of file qgsmeshcalculator.cpp.


The documentation for this class was generated from the following files: