QGIS API Documentation  3.37.0-Master (a5b4d9743e8)
Public Types | Public Member Functions | Static Public Member Functions | List of all members
QgsRasterCalcNode Class Reference

Represents a node in a raster calculator. More...

#include <qgsrastercalcnode.h>

Public Types

enum  Operator {
  opPLUS , opMINUS , opMUL , opDIV ,
  opPOW , opSQRT , opSIN , opCOS ,
  opTAN , opASIN , opACOS , opATAN ,
  opEQ , opNE , opGT , opLT ,
  opGE , opLE , opAND , opOR ,
  opSIGN , opLOG , opLOG10 , opABS ,
  opMAX , opMIN , opNONE
}
 possible operators More...
 
enum  Type {
  tOperator = 1 , tNumber , tRasterRef , tMatrix ,
  tFunction
}
 defines possible types of node More...
 

Public Member Functions

 QgsRasterCalcNode ()=default
 Constructor for QgsRasterCalcNode. More...
 
 QgsRasterCalcNode (const QgsRasterCalcNode &rh)=delete
 QgsRasterCalcNode cannot be copied. More...
 
 QgsRasterCalcNode (const QString &rasterName)
 
 QgsRasterCalcNode (double number)
 
 QgsRasterCalcNode (Operator op, QgsRasterCalcNode *left, QgsRasterCalcNode *right)
 
 QgsRasterCalcNode (QgsRasterMatrix *matrix)
 
 QgsRasterCalcNode (QString functionName, QVector< QgsRasterCalcNode * > functionArgs)
 Constructor for the tFunction type. More...
 
 ~QgsRasterCalcNode ()
 
bool calculate (QMap< QString, QgsRasterBlock * > &rasterData, QgsRasterMatrix &result, int row=-1) const
 Calculates result of raster calculation (might be real matrix or single number). More...
 
QStringList cleanRasterReferences ()
 Returns a list of raster layer references that are addressed in the formula, without quotation marks. More...
 
QList< const QgsRasterCalcNode * > findNodes (const QgsRasterCalcNode::Type type) const
 Returns a list of nodes of a specific type. More...
 
QgsRasterCalcNodeoperator= (const QgsRasterCalcNode &rh)=delete
 QgsRasterCalcNode cannot be copied. More...
 
QStringList referencedLayerNames ()
 Returns a list of raster layer names that are referenced in the formula without the quotation marks. More...
 
void setLeft (QgsRasterCalcNode *left)
 
void setRight (QgsRasterCalcNode *right)
 
QString toString (bool cStyle=false) const
 Returns a string representation of the expression. More...
 
Type type () const
 

Static Public Member Functions

static QgsRasterCalcNodeparseRasterCalcString (const QString &str, QString &parserErrorMsg)
 

Detailed Description

Represents a node in a raster calculator.

Definition at line 38 of file qgsrastercalcnode.h.

Member Enumeration Documentation

◆ Operator

possible operators

Enumerator
opPLUS 
opMINUS 
opMUL 
opDIV 
opPOW 
opSQRT 
opSIN 
opCOS 
opTAN 
opASIN 
opACOS 
opATAN 
opEQ 
opNE 
opGT 

=

opLT 
opGE 
opLE 
opAND 
opOR 
opSIGN 
opLOG 
opLOG10 
opABS 
opMAX 
opMIN 
opNONE 

Definition at line 52 of file qgsrastercalcnode.h.

◆ Type

defines possible types of node

Enumerator
tOperator 
tNumber 
tRasterRef 
tMatrix 
tFunction 

Definition at line 42 of file qgsrastercalcnode.h.

Constructor & Destructor Documentation

◆ QgsRasterCalcNode() [1/7]

QgsRasterCalcNode::QgsRasterCalcNode ( )
default

Constructor for QgsRasterCalcNode.

◆ QgsRasterCalcNode() [2/7]

QgsRasterCalcNode::QgsRasterCalcNode ( double  number)

Definition at line 19 of file qgsrastercalcnode.cpp.

◆ QgsRasterCalcNode() [3/7]

QgsRasterCalcNode::QgsRasterCalcNode ( QgsRasterMatrix matrix)

Definition at line 24 of file qgsrastercalcnode.cpp.

◆ QgsRasterCalcNode() [4/7]

QgsRasterCalcNode::QgsRasterCalcNode ( Operator  op,
QgsRasterCalcNode left,
QgsRasterCalcNode right 
)

Definition at line 31 of file qgsrastercalcnode.cpp.

◆ QgsRasterCalcNode() [5/7]

QgsRasterCalcNode::QgsRasterCalcNode ( QString  functionName,
QVector< QgsRasterCalcNode * >  functionArgs 
)

Constructor for the tFunction type.

Definition at line 39 of file qgsrastercalcnode.cpp.

◆ QgsRasterCalcNode() [6/7]

QgsRasterCalcNode::QgsRasterCalcNode ( const QString &  rasterName)

Definition at line 46 of file qgsrastercalcnode.cpp.

◆ ~QgsRasterCalcNode()

QgsRasterCalcNode::~QgsRasterCalcNode ( )

Definition at line 54 of file qgsrastercalcnode.cpp.

◆ QgsRasterCalcNode() [7/7]

QgsRasterCalcNode::QgsRasterCalcNode ( const QgsRasterCalcNode rh)
delete

QgsRasterCalcNode cannot be copied.

Member Function Documentation

◆ calculate()

bool QgsRasterCalcNode::calculate ( QMap< QString, QgsRasterBlock * > &  rasterData,
QgsRasterMatrix result,
int  row = -1 
) const

Calculates result of raster calculation (might be real matrix or single number).

Parameters
rasterDatainput raster data references, map of raster name to raster data block
resultdestination raster matrix for calculation results
rowoptional row number to calculate for calculating result by rows, or -1 to calculate entire result
Note
not available in Python bindings

Definition at line 65 of file qgsrastercalcnode.cpp.

◆ cleanRasterReferences()

QStringList QgsRasterCalcNode::cleanRasterReferences ( )

Returns a list of raster layer references that are addressed in the formula, without quotation marks.

Note
since QGIS 3.22

Definition at line 442 of file qgsrastercalcnode.cpp.

◆ findNodes()

QList< const QgsRasterCalcNode * > QgsRasterCalcNode::findNodes ( const QgsRasterCalcNode::Type  type) const

Returns a list of nodes of a specific type.

Since
QGIS 3.6

Definition at line 406 of file qgsrastercalcnode.cpp.

◆ operator=()

QgsRasterCalcNode& QgsRasterCalcNode::operator= ( const QgsRasterCalcNode rh)
delete

QgsRasterCalcNode cannot be copied.

◆ parseRasterCalcString()

QgsRasterCalcNode * QgsRasterCalcNode::parseRasterCalcString ( const QString &  str,
QString &  parserErrorMsg 
)
static

Definition at line 422 of file qgsrastercalcnode.cpp.

◆ referencedLayerNames()

QStringList QgsRasterCalcNode::referencedLayerNames ( )

Returns a list of raster layer names that are referenced in the formula without the quotation marks.

It uses QgsRasterCalcNode::cleanRasterReferences

Note
since QGIS 3.22

Definition at line 428 of file qgsrastercalcnode.cpp.

◆ setLeft()

void QgsRasterCalcNode::setLeft ( QgsRasterCalcNode left)
inline

Definition at line 104 of file qgsrastercalcnode.h.

◆ setRight()

void QgsRasterCalcNode::setRight ( QgsRasterCalcNode right)
inline

Definition at line 105 of file qgsrastercalcnode.h.

◆ toString()

QString QgsRasterCalcNode::toString ( bool  cStyle = false) const

Returns a string representation of the expression.

Parameters
cStyleif true operators will follow C syntax
Since
QGIS 3.6

Definition at line 241 of file qgsrastercalcnode.cpp.

◆ type()

Type QgsRasterCalcNode::type ( ) const
inline

Definition at line 101 of file qgsrastercalcnode.h.


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