65 , mRasterName( rasterName )
70 mRasterName = mRasterName.
mid( 1, mRasterName.
size() - 2 );
91 for ( ; it != rasterData.
constEnd(); ++it )
94 for (
int row = 0; row < it.
value()->nRows(); ++row )
96 for (
int col = 0; col < it.
value()->nColumns(); ++col )
101 rasterBlockData.
insert( it.
key(), block );
104 return calculate( rasterBlockData, result );
115 if ( it == rasterData.
end() )
120 int nRows = ( row >= 0 ? 1 : ( *it )->height() );
121 int startRow = ( row >= 0 ? row : 0 );
122 int endRow = startRow + nRows;
123 int nCols = ( *it )->width();
124 int nEntries = nCols * nRows;
125 double* data =
new double[nEntries];
130 for (
int dataRow = startRow; dataRow < endRow ; ++dataRow, ++outRow )
132 for (
int dataCol = 0; dataCol < nCols; ++dataCol )
134 data[ dataCol + nCols * outRow] = ( *it )->isNoData( dataRow , dataCol ) ? result.
nodataValue() : ( *it )->value( dataRow, dataCol );
146 if ( !mLeft || !mLeft->
calculate( rasterData, leftMatrix, row ) )
150 if ( mRight && !mRight->
calculate( rasterData, rightMatrix, row ) )
158 leftMatrix.
add( rightMatrix );
167 leftMatrix.
divide( rightMatrix );
170 leftMatrix.
power( rightMatrix );
173 leftMatrix.
equal( rightMatrix );
229 int newNColumns = leftMatrix.
nColumns();
230 int newNRows = leftMatrix.
nRows();
236 double* data =
new double[1];
244 double* data =
new double[nEntries];
245 for (
int i = 0; i < nEntries; ++i )
258 return localParseRasterCalcString( str, parserErrorMsg );
double * takeData()
Returns data and ownership.
bool setValue(int row, int column, double value)
Set value on position.
bool add(const QgsRasterMatrix &other)
Adds another matrix to this one.
void setNodataValue(double d)
double nodataValue() const
const_iterator constBegin() const
bool power(const QgsRasterMatrix &other)
Thirty two bit floating point (float)
bool greaterThan(const QgsRasterMatrix &other)
bool notEqual(const QgsRasterMatrix &other)
bool equal(const QgsRasterMatrix &other)
bool calculate(QMap< QString, QgsRasterBlock * > &rasterData, QgsRasterMatrix &result, int row=-1) const
Calculates result of raster calculation (might be real matrix or single number).
bool logicalOr(const QgsRasterMatrix &other)
void setData(int cols, int rows, double *data, double nodataValue)
bool subtract(const QgsRasterMatrix &other)
Subtracts another matrix from this one.
Operator
possible operators
const_iterator constEnd() const
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
bool multiply(const QgsRasterMatrix &other)
bool lesserEqual(const QgsRasterMatrix &other)
bool divide(const QgsRasterMatrix &other)
bool greaterEqual(const QgsRasterMatrix &other)
QString mid(int position, int n) const
double * data()
Returns data array (but not ownership)
static QgsRasterCalcNode * parseRasterCalcString(const QString &str, QString &parserErrorMsg)
iterator insert(const Key &key, const T &value)
bool lesserThan(const QgsRasterMatrix &other)
bool logicalAnd(const QgsRasterMatrix &other)
iterator find(const Key &key)