|
Quantum GIS API Documentation
master-693a1fe
|
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(); 00057 QgsRasterMatrix( int nCols, int nRows, float* data, double nodataValue ); 00058 QgsRasterMatrix( const QgsRasterMatrix& m ); 00059 ~QgsRasterMatrix(); 00060 00062 bool isNumber() const { return ( mColumns == 1 && mRows == 1 ); } 00063 double number() const { return mData[0]; } 00064 00066 00067 float* data() { return mData; } 00069 00070 float* takeData(); 00071 00072 void setData( int cols, int rows, float* data, double nodataValue ); 00073 00074 int nColumns() const { return mColumns; } 00075 int nRows() const { return mRows; } 00076 00077 double nodataValue() const { return mNodataValue; } 00078 void setNodataValue( double d ) { mNodataValue = d; } 00079 00080 QgsRasterMatrix& operator=( const QgsRasterMatrix& m ); 00082 bool add( const QgsRasterMatrix& other ); 00084 bool subtract( const QgsRasterMatrix& other ); 00085 bool multiply( const QgsRasterMatrix& other ); 00086 bool divide( const QgsRasterMatrix& other ); 00087 bool power( const QgsRasterMatrix& other ); 00088 bool equal( const QgsRasterMatrix& other ); 00089 bool notEqual( const QgsRasterMatrix& other ); 00090 bool greaterThan( const QgsRasterMatrix& other ); 00091 bool lesserThan( const QgsRasterMatrix& other ); 00092 bool greaterEqual( const QgsRasterMatrix& other ); 00093 bool lesserEqual( const QgsRasterMatrix& other ); 00094 bool logicalAnd( const QgsRasterMatrix& other ); 00095 bool logicalOr( const QgsRasterMatrix& other ); 00096 00097 bool squareRoot(); 00098 bool sinus(); 00099 bool asinus(); 00100 bool cosinus(); 00101 bool acosinus(); 00102 bool tangens(); 00103 bool atangens(); 00104 bool changeSign(); 00105 00106 private: 00107 int mColumns; 00108 int mRows; 00109 float* mData; 00110 double mNodataValue; 00111 00113 bool twoArgumentOperation( TwoArgOperator op, const QgsRasterMatrix& other ); 00114 /*sqrt, sin, cos, tan, asin, acos, atan*/ 00115 bool oneArgumentOperation( OneArgOperator op ); 00116 bool testPowerValidity( double base, double power ); 00117 }; 00118 00119 #endif // QGSRASTERMATRIX_H