QGIS API Documentation
2.2.0-Valmiera
|
Raster calculator class. More...
#include <qgsrastercalculator.h>
Public Member Functions | |
QgsRasterCalculator (const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, int nOutputColumns, int nOutputRows, const QVector< QgsRasterCalculatorEntry > &rasterEntries) | |
~QgsRasterCalculator () | |
int | processCalculation (QProgressDialog *p=0) |
Starts the calculation and writes new raster. |
Private Member Functions | |
QgsRasterCalculator () | |
GDALDriverH | openOutputDriver () |
Opens the output driver and tests if it supports the creation of a new dataset. | |
GDALDatasetH | openOutputFile (GDALDriverH outputDriver) |
Opens the output file and sets the same geotransform and CRS as the input data. | |
void | readRasterPart (double *targetGeotransform, int xOffset, int yOffset, int nCols, int nRows, double *sourceTransform, GDALRasterBandH sourceBand, float *rasterBuffer) |
Reads raster pixels from a dataset/band. | |
bool | transformationsEqual (double *t1, double *t2) const |
Compares two geotransformations (six parameter double arrays. | |
void | outputGeoTransform (double *transform) const |
Sets gdal 6 parameters array from mOutputRectangle, mNumOutputColumns, mNumOutputRows. |
Private Attributes | |
QString | mFormulaString |
QString | mOutputFile |
QString | mOutputFormat |
QgsRectangle | mOutputRectangle |
Output raster extent. | |
int | mNumOutputColumns |
Number of output columns. | |
int | mNumOutputRows |
Number of output rows. | |
QVector< QgsRasterCalculatorEntry > | mRasterEntries |
Raster calculator class.
Definition at line 39 of file qgsrastercalculator.h.
QgsRasterCalculator::QgsRasterCalculator | ( | const QString & | formulaString, |
const QString & | outputFile, | ||
const QString & | outputFormat, | ||
const QgsRectangle & | outputExtent, | ||
int | nOutputColumns, | ||
int | nOutputRows, | ||
const QVector< QgsRasterCalculatorEntry > & | rasterEntries | ||
) |
Definition at line 37 of file qgsrastercalculator.cpp.
QgsRasterCalculator::~QgsRasterCalculator | ( | ) |
Definition at line 43 of file qgsrastercalculator.cpp.
|
private |
Definition at line 252 of file qgsrastercalculator.cpp.
|
private |
Opens the output driver and tests if it supports the creation of a new dataset.
Definition at line 256 of file qgsrastercalculator.cpp.
References mOutputFormat.
Referenced by processCalculation().
|
private |
Opens the output file and sets the same geotransform and CRS as the input data.
Definition at line 277 of file qgsrastercalculator.cpp.
References mNumOutputColumns, mNumOutputRows, mOutputFile, outputGeoTransform(), and TO8F.
Referenced by processCalculation().
|
private |
Sets gdal 6 parameters array from mOutputRectangle, mNumOutputColumns, mNumOutputRows.
transform | double[6] array that receives the GDAL parameters |
Definition at line 404 of file qgsrastercalculator.cpp.
References QgsRectangle::height(), mNumOutputColumns, mNumOutputRows, mOutputRectangle, QgsRectangle::width(), QgsRectangle::xMinimum(), and QgsRectangle::yMaximum().
Referenced by openOutputFile(), and processCalculation().
int QgsRasterCalculator::processCalculation | ( | QProgressDialog * | p = 0 | ) |
Starts the calculation and writes new raster.
p | progress bar (or 0 if called from non-gui code) |
Definition at line 47 of file qgsrastercalculator.cpp.
References QgsCoordinateReferenceSystem::authid(), QgsRasterCalcNode::calculate(), QgsMapLayer::crs(), QgsRasterMatrix::data(), QgsRasterMatrix::isNumber(), mFormulaString, mNumOutputColumns, mNumOutputRows, mOutputFile, mRasterEntries, QgsRasterMatrix::nodataValue(), QgsRasterMatrix::number(), openOutputDriver(), openOutputFile(), outputGeoTransform(), QgsRasterCalcNode::parseRasterCalcString(), readRasterPart(), TO8, TO8F, and QgsCoordinateReferenceSystem::toWkt().
|
private |
Reads raster pixels from a dataset/band.
targetGeotransform | transformation parameters of the requested raster array (not necessarily the same as the transform of the source dataset) |
xOffset | x offset |
yOffset | y offset |
nCols | number of columns |
nRows | number of rows |
sourceTransform | source transformation |
sourceBand | source band |
rasterBuffer | raster buffer |
Definition at line 295 of file qgsrastercalculator.cpp.
References QgsRectangle::intersect(), QgsRectangle::isEmpty(), transformationsEqual(), QgsRectangle::xMaximum(), QgsRectangle::xMinimum(), QgsRectangle::yMaximum(), and QgsRectangle::yMinimum().
Referenced by processCalculation().
|
private |
Compares two geotransformations (six parameter double arrays.
Definition at line 392 of file qgsrastercalculator.cpp.
References qgsDoubleNear().
Referenced by readRasterPart().
|
private |
Definition at line 88 of file qgsrastercalculator.h.
Referenced by processCalculation().
|
private |
Number of output columns.
Definition at line 95 of file qgsrastercalculator.h.
Referenced by openOutputFile(), outputGeoTransform(), and processCalculation().
|
private |
Number of output rows.
Definition at line 97 of file qgsrastercalculator.h.
Referenced by openOutputFile(), outputGeoTransform(), and processCalculation().
|
private |
Definition at line 89 of file qgsrastercalculator.h.
Referenced by openOutputFile(), and processCalculation().
|
private |
Definition at line 90 of file qgsrastercalculator.h.
Referenced by openOutputDriver().
|
private |
Output raster extent.
Definition at line 93 of file qgsrastercalculator.h.
Referenced by outputGeoTransform().
|
private |
Definition at line 100 of file qgsrastercalculator.h.
Referenced by processCalculation().