Quantum GIS API Documentation
1.7.4
|
00001 /*************************************************************************** 00002 qgsrastermatrix.h 00003 ----------------- 00004 begin : 2010-10-23 00005 copyright : (C) 20010 by Marco Hugentobler 00006 email : marco dot hugentobler at sourcepole dot ch 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef QGSRASTERMATRIX_H 00019 #define QGSRASTERMATRIX_H 00020 00021 class ANALYSIS_EXPORT QgsRasterMatrix 00022 { 00023 public: 00024 00025 enum TwoArgOperator 00026 { 00027 opPLUS, 00028 opMINUS, 00029 opMUL, 00030 opDIV, 00031 opPOW, 00032 opEQ, // = 00033 opNE, // != resp. <> 00034 opGT, // > 00035 opLT, // < 00036 opGE, // >= 00037 opLE, // <= 00038 opAND, 00039 opOR 00040 }; 00041 00042 enum OneArgOperator 00043 { 00044 opSQRT, 00045 opSIN, 00046 opCOS, 00047 opTAN, 00048 opASIN, 00049 opACOS, 00050 opATAN, 00051 opSIGN 00052 }; 00053 00055 QgsRasterMatrix(); 00056 QgsRasterMatrix( int nCols, int nRows, float* data, double nodataValue ); 00057 QgsRasterMatrix( const QgsRasterMatrix& m ); 00058 ~QgsRasterMatrix(); 00059 00061 bool isNumber() const { return ( mColumns == 1 && mRows == 1 ); } 00062 double number() const { return mData[0]; } 00063 00065 float* data() { return mData; } 00067 float* takeData(); 00068 00069 void setData( int cols, int rows, float* data, double nodataValue ); 00070 00071 int nColumns() const { return mColumns; } 00072 int nRows() const { return mRows; } 00073 00074 double nodataValue() const { return mNodataValue; } 00075 void setNodataValue( double d ) { mNodataValue = d; } 00076 00077 QgsRasterMatrix& operator=( const QgsRasterMatrix& m ); 00079 bool add( const QgsRasterMatrix& other ); 00081 bool subtract( const QgsRasterMatrix& other ); 00082 bool multiply( const QgsRasterMatrix& other ); 00083 bool divide( const QgsRasterMatrix& other ); 00084 bool power( const QgsRasterMatrix& other ); 00085 bool equal( const QgsRasterMatrix& other ); 00086 bool notEqual( const QgsRasterMatrix& other ); 00087 bool greaterThan( const QgsRasterMatrix& other ); 00088 bool lesserThan( const QgsRasterMatrix& other ); 00089 bool greaterEqual( const QgsRasterMatrix& other ); 00090 bool lesserEqual( const QgsRasterMatrix& other ); 00091 bool logicalAnd( const QgsRasterMatrix& other ); 00092 bool logicalOr( const QgsRasterMatrix& other ); 00093 00094 bool squareRoot(); 00095 bool sinus(); 00096 bool asinus(); 00097 bool cosinus(); 00098 bool acosinus(); 00099 bool tangens(); 00100 bool atangens(); 00101 bool changeSign(); 00102 00103 private: 00104 int mColumns; 00105 int mRows; 00106 float* mData; 00107 double mNodataValue; 00108 00110 bool twoArgumentOperation( TwoArgOperator op, const QgsRasterMatrix& other ); 00111 /*sqrt, sin, cos, tan, asin, acos, atan*/ 00112 bool oneArgumentOperation( OneArgOperator op ); 00113 bool testPowerValidity( double base, double power ); 00114 }; 00115 00116 #endif // QGSRASTERMATRIX_H