50 , mRasterName( rasterName )
53 if ( mRasterName.startsWith(
'"' ) && mRasterName.endsWith(
'"' ) )
54 mRasterName = mRasterName.mid( 1, mRasterName.size() - 2 );
76 QMap<QString, QgsRasterMatrix*>::iterator it = rasterData.find( mRasterName );
77 if ( it == rasterData.end() )
82 int nEntries = ( *it )->nColumns() * ( *it )->nRows();
83 float* data =
new float[nEntries];
84 memcpy( data, ( *it )->data(), nEntries *
sizeof( float ) );
85 result.
setData(( *it )->nColumns(), ( *it )->nRows(), data, ( *it )->nodataValue() );
92 if ( !mLeft || !mLeft->
calculate( rasterData, leftMatrix ) )
96 if ( mRight && !mRight->
calculate( rasterData, rightMatrix ) )
104 leftMatrix.
add( rightMatrix );
113 leftMatrix.
divide( rightMatrix );
116 leftMatrix.
power( rightMatrix );
119 leftMatrix.
equal( rightMatrix );
169 int newNColumns = leftMatrix.
nColumns();
170 int newNRows = leftMatrix.
nRows();
176 float* data =
new float[1];
178 result.
setData( 1, 1, data, -FLT_MAX );
186 extern QgsRasterCalcNode* localParseRasterCalcString(
const QString & str, QString & parserErrorMsg );
187 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)
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)
static QgsRasterCalcNode * parseRasterCalcString(const QString &str, QString &parserErrorMsg)
bool lesserThan(const QgsRasterMatrix &other)
bool logicalAnd(const QgsRasterMatrix &other)