Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Similarly to raster calculator, mesh calculator can take dataset groups from current mesh layer and combine them with various aritmentic/logical operators to new dataset group.
- Loading branch information
1 parent
e163caf
commit cd9a84e
Showing
43 changed files
with
4,761 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
python/analysis/auto_generated/mesh/qgsmeshcalculator.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/analysis/mesh/qgsmeshcalculator.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
|
||
|
||
class QgsMeshCalculator | ||
{ | ||
%Docstring | ||
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. | ||
|
||
Note: only dataset groups defined on vertices are | ||
implemented and supported | ||
|
||
.. versionadded:: 3.6 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsmeshcalculator.h" | ||
%End | ||
public: | ||
|
||
enum Result | ||
{ | ||
Success, | ||
Canceled, | ||
CreateOutputError, | ||
InputLayerError, | ||
ParserError, | ||
InvalidDatasets, | ||
EvaluateError, | ||
MemoryError, | ||
}; | ||
|
||
QgsMeshCalculator( const QString &formulaString, | ||
const QString &outputFile, | ||
const QgsRectangle &outputExtent, | ||
double startTime, | ||
double endTime, | ||
QgsMeshLayer *layer ); | ||
%Docstring | ||
Creates calculator with bounding box (rectangular) mask | ||
|
||
:param formulaString: formula/expression to evaluate. Consists of dataset group names, operators and numbers | ||
:param outputFile: file to store the resulting dataset group data | ||
:param outputExtent: spatial filter defined by rectangle | ||
:param startTime: time filter defining the starting dataset | ||
:param endTime: time filter defining the ending dataset | ||
:param layer: mesh layer with dataset groups references in formulaString | ||
%End | ||
|
||
QgsMeshCalculator( const QString &formulaString, | ||
const QString &outputFile, | ||
const QgsGeometry &outputMask, | ||
double startTime, | ||
double endTime, | ||
QgsMeshLayer *layer ); | ||
%Docstring | ||
Creates calculator with geometry mask | ||
|
||
:param formulaString: formula/expression to evaluate. Consists of dataset group names, operators and numbers | ||
:param outputFile: file to store the resulting dataset group data | ||
:param outputMask: spatial filter defined by geometry | ||
:param startTime: time filter defining the starting dataset | ||
:param endTime: time filter defining the ending dataset | ||
:param layer: mesh layer with dataset groups references in formulaString | ||
%End | ||
|
||
Result processCalculation( QgsFeedback *feedback = 0 ); | ||
%Docstring | ||
Starts the calculation, writes new dataset group to file and adds it to the mesh layer | ||
|
||
:param feedback: The optional feedback argument for progress reporting and cancelation support | ||
|
||
:return: QgsMeshCalculator.Success in case of success | ||
%End | ||
|
||
static Result expression_valid( const QString &formulaString, QgsMeshLayer *layer ); | ||
%Docstring | ||
Returns whether formula is valid for particular mesh layer | ||
|
||
:param formulaString: formula/expression to evaluate. Consists of dataset group names, operators and numbers | ||
:param layer: mesh layer with dataset groups references in formulaString | ||
|
||
:return: QgsMeshCalculator.Success in case of success | ||
%End | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/analysis/mesh/qgsmeshcalculator.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/*************************************************************************** | ||
qgsmeshcalclexer.ll | ||
------------------- | ||
begin : December 19th, 2018 | ||
copyright : (C) 2018 by Peter Petrik | ||
email : zilolv at gmail dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
%option noyywrap | ||
%option nounput | ||
%option case-insensitive | ||
%option never-interactive | ||
|
||
// ensure that lexer will be 8-bit (and not just 7-bit) | ||
%option 8bit | ||
|
||
%{ | ||
//directly included in the output program | ||
#include "qgsmeshcalcnode.h" | ||
#include "qgsmeshcalcparser.hpp" | ||
|
||
// if not defined, searches for isatty() | ||
// which doesn't in MSVC compiler | ||
#define YY_NEVER_INTERACTIVE 1 | ||
|
||
#ifdef _MSC_VER | ||
#define YY_NO_UNISTD_H | ||
#endif | ||
|
||
#ifndef _MSC_VER | ||
#pragma GCC diagnostic ignored "-Wsign-compare" | ||
#endif | ||
%} | ||
|
||
white [ \t\r\n]+ | ||
|
||
dig [0-9] | ||
num1 {dig}+\.?([eE][-+]?{dig}+)? | ||
num2 {dig}*\.{dig}+([eE][-+]?{dig}+)? | ||
number {num1}|{num2} | ||
|
||
non_ascii [\x80-\xFF] | ||
dataset_ref_char [A-Za-z0-9_./:]|{non_ascii}|[-] | ||
dataset_ref ({dataset_ref_char}+) | ||
dataset_ref_quoted \"(\\.|[^"])*\" | ||
%% | ||
"sum_aggr" { meshlval.op = QgsMeshCalcNode::opSUM_AGGR; return FUNCTION; } | ||
"max_aggr" { meshlval.op = QgsMeshCalcNode::opMAX_AGGR; return FUNCTION; } | ||
"min_aggr" { meshlval.op = QgsMeshCalcNode::opMIN_AGGR; return FUNCTION; } | ||
"average_aggr" { meshlval.op = QgsMeshCalcNode::opAVG_AGGR; return FUNCTION; } | ||
"abs" { meshlval.op = QgsMeshCalcNode::opABS; return FUNCTION; } | ||
"max" { meshlval.op = QgsMeshCalcNode::opMAX; return FUNCTION2; } | ||
"min" { meshlval.op = QgsMeshCalcNode::opMIN; return FUNCTION2; } | ||
"IF" { return IF; } | ||
"AND" { return AND; } | ||
"OR" { return OR; } | ||
"NOT" { return NOT; } | ||
"!=" { return NE; } | ||
"<=" { return LE; } | ||
">=" { return GE; } | ||
"NODATA" {return NODATA;} | ||
[=><+-/*^] { return yytext[0]; } | ||
[()] { return yytext[0]; } | ||
{number} { meshlval.number = atof(meshtext); return NUMBER; } | ||
{dataset_ref} { return DATASET_REF; } | ||
{dataset_ref_quoted} { return DATASET_REF; } | ||
{white} /* skip blanks and tabs */ | ||
%% | ||
void set_mesh_input_buffer(const char* buffer) | ||
{ | ||
mesh_scan_string(buffer); | ||
} |
Oops, something went wrong.