QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
analysis
raster
qgsrastermatrix.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsrastermatrix.h
3
-----------------
4
begin : 2010-10-23
5
copyright : (C) 20010 by Marco Hugentobler
6
email : marco dot hugentobler at sourcepole dot ch
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 QGSRASTERMATRIX_H
19
#define QGSRASTERMATRIX_H
20
21
#include "qgis_analysis.h"
22
#include "
qgis_sip.h
"
23
29
class
ANALYSIS_EXPORT
QgsRasterMatrix
30
{
31
public
:
32
enum
TwoArgOperator
33
{
34
opPLUS
,
35
opMINUS
,
36
opMUL
,
37
opDIV
,
38
opPOW
,
39
opEQ
,
40
opNE
,
41
opGT
,
42
opLT
,
43
opGE
,
44
opLE
,
45
opAND
,
46
opOR
,
47
opMIN
,
48
opMAX
49
};
50
51
enum
OneArgOperator
52
{
53
opSQRT
,
54
opSIN
,
55
opCOS
,
56
opTAN
,
57
opASIN
,
58
opACOS
,
59
opATAN
,
60
opSIGN
,
61
opLOG
,
62
opLOG10
,
63
opABS
,
64
};
65
66
QgsRasterMatrix
() =
default
;
67
72
QgsRasterMatrix
(
int
nCols,
int
nRows
,
double
*
data
,
double
nodataValue
)
SIP_SKIP
;
73
QgsRasterMatrix
(
const
QgsRasterMatrix
&m );
74
~QgsRasterMatrix
();
75
77
bool
isNumber
()
const
{
return
( mColumns == 1 && mRows == 1 ); }
78
double
number
()
const
{
return
mData[0]; }
79
84
double
*
data
()
SIP_SKIP
{
return
mData; }
85
90
double
*takeData()
SIP_SKIP
;
91
92
void
setData(
int
cols,
int
rows,
double
*data,
double
nodataValue );
93
94
int
nColumns
()
const
{
return
mColumns; }
95
int
nRows
()
const
{
return
mRows; }
96
97
double
nodataValue
()
const
{
return
mNodataValue; }
98
void
setNodataValue
(
double
d ) { mNodataValue = d; }
99
100
QgsRasterMatrix
&operator=(
const
QgsRasterMatrix
&m );
102
bool
add(
const
QgsRasterMatrix
&other );
104
bool
subtract(
const
QgsRasterMatrix
&other );
105
bool
multiply(
const
QgsRasterMatrix
&other );
106
bool
divide(
const
QgsRasterMatrix
&other );
107
bool
power(
const
QgsRasterMatrix
&other );
108
bool
equal(
const
QgsRasterMatrix
&other );
109
bool
notEqual(
const
QgsRasterMatrix
&other );
110
bool
greaterThan(
const
QgsRasterMatrix
&other );
111
bool
lesserThan(
const
QgsRasterMatrix
&other );
112
bool
greaterEqual(
const
QgsRasterMatrix
&other );
113
bool
lesserEqual(
const
QgsRasterMatrix
&other );
114
bool
logicalAnd(
const
QgsRasterMatrix
&other );
115
bool
logicalOr(
const
QgsRasterMatrix
&other );
116
122
bool
max(
const
QgsRasterMatrix
&other );
123
129
bool
min(
const
QgsRasterMatrix
&other );
130
131
bool
squareRoot();
132
bool
sinus();
133
bool
asinus();
134
bool
cosinus();
135
bool
acosinus();
136
bool
tangens();
137
bool
atangens();
138
bool
changeSign();
139
bool
log();
140
bool
log10();
141
147
bool
absoluteValue();
148
149
private
:
150
int
mColumns = 0;
151
int
mRows = 0;
152
double
*mData =
nullptr
;
153
double
mNodataValue = -1;
154
156
bool
twoArgumentOperation( TwoArgOperator op,
const
QgsRasterMatrix
&other );
157
double
calculateTwoArgumentOp( TwoArgOperator op,
double
arg1,
double
arg2 )
const
;
158
159
/*sqrt, std::sin, std::cos, tan, asin, acos, atan*/
160
bool
oneArgumentOperation( OneArgOperator op );
161
bool
testPowerValidity(
double
base,
double
power )
const
;
162
};
163
164
#endif
// QGSRASTERMATRIX_H
QgsRasterMatrix
Represents a matrix in a raster calculator operation.
Definition
qgsrastermatrix.h:30
QgsRasterMatrix::TwoArgOperator
TwoArgOperator
Definition
qgsrastermatrix.h:33
QgsRasterMatrix::opMIN
@ opMIN
Definition
qgsrastermatrix.h:47
QgsRasterMatrix::opMUL
@ opMUL
Definition
qgsrastermatrix.h:36
QgsRasterMatrix::opLT
@ opLT
<
Definition
qgsrastermatrix.h:42
QgsRasterMatrix::opMAX
@ opMAX
Definition
qgsrastermatrix.h:48
QgsRasterMatrix::opPLUS
@ opPLUS
Definition
qgsrastermatrix.h:34
QgsRasterMatrix::opPOW
@ opPOW
Definition
qgsrastermatrix.h:38
QgsRasterMatrix::opAND
@ opAND
Definition
qgsrastermatrix.h:45
QgsRasterMatrix::opGT
@ opGT
Definition
qgsrastermatrix.h:41
QgsRasterMatrix::opLE
@ opLE
<=
Definition
qgsrastermatrix.h:44
QgsRasterMatrix::opEQ
@ opEQ
=
Definition
qgsrastermatrix.h:39
QgsRasterMatrix::opMINUS
@ opMINUS
Definition
qgsrastermatrix.h:35
QgsRasterMatrix::opOR
@ opOR
Definition
qgsrastermatrix.h:46
QgsRasterMatrix::opNE
@ opNE
!= resp. <>
Definition
qgsrastermatrix.h:40
QgsRasterMatrix::opGE
@ opGE
>=
Definition
qgsrastermatrix.h:43
QgsRasterMatrix::opDIV
@ opDIV
Definition
qgsrastermatrix.h:37
QgsRasterMatrix::QgsRasterMatrix
QgsRasterMatrix()=default
QgsRasterMatrix::isNumber
bool isNumber() const
Returns true if matrix is 1x1 (=scalar number).
Definition
qgsrastermatrix.h:77
QgsRasterMatrix::nRows
int nRows() const
Definition
qgsrastermatrix.h:95
QgsRasterMatrix::setNodataValue
void setNodataValue(double d)
Definition
qgsrastermatrix.h:98
QgsRasterMatrix::data
double * data()
Returns data array (but not ownership).
Definition
qgsrastermatrix.h:84
QgsRasterMatrix::OneArgOperator
OneArgOperator
Definition
qgsrastermatrix.h:52
QgsRasterMatrix::opCOS
@ opCOS
Definition
qgsrastermatrix.h:55
QgsRasterMatrix::opSQRT
@ opSQRT
Definition
qgsrastermatrix.h:53
QgsRasterMatrix::opSIN
@ opSIN
Definition
qgsrastermatrix.h:54
QgsRasterMatrix::opTAN
@ opTAN
Definition
qgsrastermatrix.h:56
QgsRasterMatrix::opLOG10
@ opLOG10
Definition
qgsrastermatrix.h:62
QgsRasterMatrix::opATAN
@ opATAN
Definition
qgsrastermatrix.h:59
QgsRasterMatrix::opABS
@ opABS
Definition
qgsrastermatrix.h:63
QgsRasterMatrix::opLOG
@ opLOG
Definition
qgsrastermatrix.h:61
QgsRasterMatrix::opASIN
@ opASIN
Definition
qgsrastermatrix.h:57
QgsRasterMatrix::opACOS
@ opACOS
Definition
qgsrastermatrix.h:58
QgsRasterMatrix::opSIGN
@ opSIGN
Definition
qgsrastermatrix.h:60
QgsRasterMatrix::nodataValue
double nodataValue() const
Definition
qgsrastermatrix.h:97
QgsRasterMatrix::number
double number() const
Definition
qgsrastermatrix.h:78
QgsRasterMatrix::nColumns
int nColumns() const
Definition
qgsrastermatrix.h:94
qgis_sip.h
SIP_SKIP
#define SIP_SKIP
Definition
qgis_sip.h:138
Generated on
for QGIS API Documentation by
1.17.0