Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 
56  QgsRasterMatrix( int nCols, int nRows, float* data, double nodataValue );
57  QgsRasterMatrix( const QgsRasterMatrix& m );
58  ~QgsRasterMatrix();
59 
61  bool isNumber() const { return ( mColumns == 1 && mRows == 1 ); }
62  double number() const { return mData[0]; }
63 
65  float* data() { return mData; }
67  float* takeData();
68 
69  void setData( int cols, int rows, float* data, double nodataValue );
70 
71  int nColumns() const { return mColumns; }
72  int nRows() const { return mRows; }
73 
74  double nodataValue() const { return mNodataValue; }
75  void setNodataValue( double d ) { mNodataValue = d; }
76 
77  QgsRasterMatrix& operator=( const QgsRasterMatrix& m );
79  bool add( const QgsRasterMatrix& other );
81  bool subtract( const QgsRasterMatrix& other );
82  bool multiply( const QgsRasterMatrix& other );
83  bool divide( const QgsRasterMatrix& other );
84  bool power( const QgsRasterMatrix& other );
85  bool equal( const QgsRasterMatrix& other );
86  bool notEqual( const QgsRasterMatrix& other );
87  bool greaterThan( const QgsRasterMatrix& other );
88  bool lesserThan( const QgsRasterMatrix& other );
89  bool greaterEqual( const QgsRasterMatrix& other );
90  bool lesserEqual( const QgsRasterMatrix& other );
91  bool logicalAnd( const QgsRasterMatrix& other );
92  bool logicalOr( const QgsRasterMatrix& other );
93 
94  bool squareRoot();
95  bool sinus();
96  bool asinus();
97  bool cosinus();
98  bool acosinus();
99  bool tangens();
100  bool atangens();
101  bool changeSign();
102 
103  private:
104  int mColumns;
105  int mRows;
106  float* mData;
107  double mNodataValue;
108 
110  bool twoArgumentOperation( TwoArgOperator op, const QgsRasterMatrix& other );
111  /*sqrt, sin, cos, tan, asin, acos, atan*/
112  bool oneArgumentOperation( OneArgOperator op );
113  bool testPowerValidity( double base, double power );
114 };
115 
116 #endif // QGSRASTERMATRIX_H