47 , mRasterName( rasterName )
70 QMap<QString, QgsRasterMatrix*>::iterator it = rasterData.find(
mRasterName );
71 if ( it == rasterData.end() )
76 int nEntries = ( *it )->nColumns() * ( *it )->nRows();
77 float* data =
new float[nEntries];
78 memcpy( data, ( *it )->data(), nEntries *
sizeof( float ) );
79 result.
setData(( *it )->nColumns(), ( *it )->nRows(), data, ( *it )->nodataValue() );
98 leftMatrix.
add( rightMatrix );
107 leftMatrix.
divide( rightMatrix );
110 leftMatrix.
power( rightMatrix );
113 leftMatrix.
equal( rightMatrix );
162 int newNColumns = leftMatrix.
nColumns();
163 int newNRows = leftMatrix.
nRows();
169 float* data =
new float[1];
171 result.
setData( 1, 1, data, -FLT_MAX );
179 extern QgsRasterCalcNode* localParseRasterCalcString(
const QString & str, QString & parserErrorMsg );
180 return localParseRasterCalcString( str, parserErrorMsg );
void setData(int cols, int rows, float *data, double nodataValue)
float * takeData()
Returns data and ownership.
bool add(const QgsRasterMatrix &other)
Adds another matrix to this one.
bool power(const QgsRasterMatrix &other)
bool greaterThan(const QgsRasterMatrix &other)
QgsRasterCalcNode * mRight
bool notEqual(const QgsRasterMatrix &other)
bool equal(const QgsRasterMatrix &other)
bool logicalOr(const QgsRasterMatrix &other)
bool calculate(QMap< QString, QgsRasterMatrix * > &rasterData, QgsRasterMatrix &result) const
Calculates result (might be real matrix or single number)
bool subtract(const QgsRasterMatrix &other)
Subtracts another matrix from this one.
Operator
possible operators
bool multiply(const QgsRasterMatrix &other)
bool lesserEqual(const QgsRasterMatrix &other)
bool divide(const QgsRasterMatrix &other)
double nodataValue() const
bool greaterEqual(const QgsRasterMatrix &other)
QgsRasterCalcNode * mLeft
static QgsRasterCalcNode * parseRasterCalcString(const QString &str, QString &parserErrorMsg)
bool lesserThan(const QgsRasterMatrix &other)
bool logicalAnd(const QgsRasterMatrix &other)