QGIS API Documentation  2.2.0-Valmiera
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 class ANALYSIS_EXPORT QgsRasterMatrix
22 {
23  public:
24 
26  {
32  opEQ, // =
33  opNE, // != resp. <>
34  opGT, // >
35  opLT, // <
36  opGE, // >=
37  opLE, // <=
39  opOR
40  };
41 
43  {
51  opSIGN
52  };
53 
57  QgsRasterMatrix( int nCols, int nRows, float* data, double nodataValue );
58  QgsRasterMatrix( const QgsRasterMatrix& m );
59  ~QgsRasterMatrix();
60 
62  bool isNumber() const { return ( mColumns == 1 && mRows == 1 ); }
63  double number() const { return mData[0]; }
64 
66 
67  float* data() { return mData; }
69 
70  float* takeData();
71 
72  void setData( int cols, int rows, float* data, double nodataValue );
73 
74  int nColumns() const { return mColumns; }
75  int nRows() const { return mRows; }
76 
77  double nodataValue() const { return mNodataValue; }
78  void setNodataValue( double d ) { mNodataValue = d; }
79 
80  QgsRasterMatrix& operator=( const QgsRasterMatrix& m );
82  bool add( const QgsRasterMatrix& other );
84  bool subtract( const QgsRasterMatrix& other );
85  bool multiply( const QgsRasterMatrix& other );
86  bool divide( const QgsRasterMatrix& other );
87  bool power( const QgsRasterMatrix& other );
88  bool equal( const QgsRasterMatrix& other );
89  bool notEqual( const QgsRasterMatrix& other );
90  bool greaterThan( const QgsRasterMatrix& other );
91  bool lesserThan( const QgsRasterMatrix& other );
92  bool greaterEqual( const QgsRasterMatrix& other );
93  bool lesserEqual( const QgsRasterMatrix& other );
94  bool logicalAnd( const QgsRasterMatrix& other );
95  bool logicalOr( const QgsRasterMatrix& other );
96 
97  bool squareRoot();
98  bool sinus();
99  bool asinus();
100  bool cosinus();
101  bool acosinus();
102  bool tangens();
103  bool atangens();
104  bool changeSign();
105 
106  private:
107  int mColumns;
108  int mRows;
109  float* mData;
110  double mNodataValue;
111 
113  bool twoArgumentOperation( TwoArgOperator op, const QgsRasterMatrix& other );
114  /*sqrt, sin, cos, tan, asin, acos, atan*/
115  bool oneArgumentOperation( OneArgOperator op );
116  bool testPowerValidity( double base, double power );
117 };
118 
119 #endif // QGSRASTERMATRIX_H