00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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,
00034 opGT,
00035 opLT,
00036 opGE,
00037 opLE,
00038 };
00039
00040 enum OneArgOperator
00041 {
00042 opSQRT,
00043 opSIN,
00044 opCOS,
00045 opTAN,
00046 opASIN,
00047 opACOS,
00048 opATAN,
00049 };
00050
00052 QgsRasterMatrix();
00053 QgsRasterMatrix( int nCols, int nRows, float* data, double nodataValue );
00054 QgsRasterMatrix( const QgsRasterMatrix& m );
00055 ~QgsRasterMatrix();
00056
00058 bool isNumber() const { return ( mColumns == 1 && mRows == 1 ); }
00059 double number() const { return mData[0]; }
00060
00062 float* data() { return mData; }
00064 float* takeData();
00065
00066 void setData( int cols, int rows, float* data, double nodataValue );
00067
00068 int nColumns() const { return mColumns; }
00069 int nRows() const { return mRows; }
00070
00071 double nodataValue() const { return mNodataValue; }
00072 void setNodataValue( double d ) { mNodataValue = d; }
00073
00074 QgsRasterMatrix& operator=( const QgsRasterMatrix& m );
00076 bool add( const QgsRasterMatrix& other );
00078 bool subtract( const QgsRasterMatrix& other );
00079 bool multiply( const QgsRasterMatrix& other );
00080 bool divide( const QgsRasterMatrix& other );
00081 bool power( const QgsRasterMatrix& other );
00082 bool equal( const QgsRasterMatrix& other );
00083 bool notEqual( const QgsRasterMatrix& other );
00084 bool greaterThan( const QgsRasterMatrix& other );
00085 bool lesserThan( const QgsRasterMatrix& other );
00086 bool greaterEqual( const QgsRasterMatrix& other );
00087 bool lesserEqual( const QgsRasterMatrix& other );
00088
00089 bool squareRoot();
00090 bool sinus();
00091 bool asinus();
00092 bool cosinus();
00093 bool acosinus();
00094 bool tangens();
00095 bool atangens();
00096
00097 private:
00098 int mColumns;
00099 int mRows;
00100 float* mData;
00101 double mNodataValue;
00102
00104 bool twoArgumentOperation( TwoArgOperator op, const QgsRasterMatrix& other );
00105
00106 bool oneArgumentOperation( OneArgOperator op );
00107 bool testPowerValidity( double base, double power );
00108 };
00109
00110 #endif // QGSRASTERMATRIX_H