QGIS API Documentation
2.2.0-Valmiera
|
Produces coloured relief rasters from DEM. More...
#include <qgsrelief.h>
Classes | |
struct | ReliefColor |
Public Member Functions | |
QgsRelief (const QString &inputFile, const QString &outputFile, const QString &outputFormat) | |
~QgsRelief () | |
int | processRaster (QProgressDialog *p) |
Starts the calculation, reads from mInputFile and stores the result in mOutputFile. | |
double | zFactor () const |
void | setZFactor (double factor) |
void | clearReliefColors () |
void | addReliefColorClass (const ReliefColor &color) |
const QList< ReliefColor > & | reliefColors () const |
void | setReliefColors (const QList< ReliefColor > &c) |
QList< ReliefColor > | calculateOptimizedReliefClasses () |
Calculates class breaks according with the method of Buenzli (2011) using an iterative algorithm for segmented regression. | |
bool | exportFrequencyDistributionToCsv (const QString &file) |
Write frequency of elevation values to file for manual inspection. |
Private Member Functions | |
bool | processNineCellWindow (float *x1, float *x2, float *x3, float *x4, float *x5, float *x6, float *x7, float *x8, float *x9, unsigned char *red, unsigned char *green, unsigned char *blue) |
GDALDatasetH | openInputFile (int &nCellsX, int &nCellsY) |
Opens the input file and returns the dataset handle and the number of pixels in x-/y- direction. | |
GDALDriverH | openOutputDriver () |
Opens the output driver and tests if it supports the creation of a new dataset. | |
GDALDatasetH | openOutputFile (GDALDatasetH inputDataset, GDALDriverH outputDriver) |
Opens the output file and sets the same geotransform and CRS as the input data. | |
bool | setElevationColor (double elevation, int *red, int *green, int *blue) |
Set elevation color. | |
void | setDefaultReliefColors () |
Sets relief colors. | |
int | frequencyClassForElevation (double elevation, double minElevation, double elevationClassRange) |
Returns class (0-255) for an elevation value. | |
void | optimiseClassBreaks (QList< int > &breaks, double *frequencies) |
Do one iteration of class break optimisation (algorithm from Garcia and Rodriguez) | |
bool | calculateRegression (const QList< QPair< int, double > > &input, double &a, double &b) |
Calculates coefficients a and b. |
Private Attributes | |
QString | mInputFile |
QString | mOutputFile |
QString | mOutputFormat |
double | mCellSizeX |
double | mCellSizeY |
float | mInputNodataValue |
The nodata value of the input layer. | |
float | mOutputNodataValue |
The nodata value of the output layer. | |
double | mZFactor |
QgsSlopeFilter * | mSlopeFilter |
QgsAspectFilter * | mAspectFilter |
QgsHillshadeFilter * | mHillshadeFilter285 |
QgsHillshadeFilter * | mHillshadeFilter300 |
QgsHillshadeFilter * | mHillshadeFilter315 |
QList< ReliefColor > | mReliefColors |
Produces coloured relief rasters from DEM.
Definition at line 33 of file qgsrelief.h.
QgsRelief::QgsRelief | ( | const QString & | inputFile, |
const QString & | outputFile, | ||
const QString & | outputFormat | ||
) |
Definition at line 36 of file qgsrelief.cpp.
References mAspectFilter, mHillshadeFilter285, mHillshadeFilter300, mHillshadeFilter315, and mSlopeFilter.
QgsRelief::~QgsRelief | ( | ) |
Definition at line 49 of file qgsrelief.cpp.
References mAspectFilter, mHillshadeFilter285, mHillshadeFilter300, mHillshadeFilter315, and mSlopeFilter.
void QgsRelief::addReliefColorClass | ( | const ReliefColor & | color | ) |
Definition at line 63 of file qgsrelief.cpp.
References mReliefColors.
Referenced by setDefaultReliefColors().
QList< QgsRelief::ReliefColor > QgsRelief::calculateOptimizedReliefClasses | ( | ) |
Calculates class breaks according with the method of Buenzli (2011) using an iterative algorithm for segmented regression.
Definition at line 562 of file qgsrelief.cpp.
References frequencyClassForElevation(), openInputFile(), and optimiseClassBreaks().
|
private |
Calculates coefficients a and b.
input | data points ( elevation class / frequency ) |
a | slope |
b | y value for x=0 |
Definition at line 755 of file qgsrelief.cpp.
Referenced by optimiseClassBreaks().
void QgsRelief::clearReliefColors | ( | ) |
Definition at line 58 of file qgsrelief.cpp.
References mReliefColors.
Referenced by setDefaultReliefColors().
bool QgsRelief::exportFrequencyDistributionToCsv | ( | const QString & | file | ) |
Write frequency of elevation values to file for manual inspection.
Definition at line 481 of file qgsrelief.cpp.
References frequencyClassForElevation(), and openInputFile().
|
private |
Returns class (0-255) for an elevation value.
Definition at line 750 of file qgsrelief.cpp.
Referenced by calculateOptimizedReliefClasses(), and exportFrequencyDistributionToCsv().
|
private |
Opens the input file and returns the dataset handle and the number of pixels in x-/y- direction.
Definition at line 391 of file qgsrelief.cpp.
References mInputFile, and TO8F.
Referenced by calculateOptimizedReliefClasses(), exportFrequencyDistributionToCsv(), and processRaster().
|
private |
Opens the output driver and tests if it supports the creation of a new dataset.
Definition at line 409 of file qgsrelief.cpp.
References mOutputFormat.
Referenced by processRaster().
|
private |
Opens the output file and sets the same geotransform and CRS as the input data.
Definition at line 430 of file qgsrelief.cpp.
References mCellSizeX, mCellSizeY, mOutputFile, and TO8F.
Referenced by processRaster().
|
private |
Do one iteration of class break optimisation (algorithm from Garcia and Rodriguez)
Definition at line 680 of file qgsrelief.cpp.
References calculateRegression(), and qgsDoubleNear().
Referenced by calculateOptimizedReliefClasses().
|
private |
Definition at line 280 of file qgsrelief.cpp.
References M_PI, mAspectFilter, mHillshadeFilter285, mHillshadeFilter300, mHillshadeFilter315, mOutputNodataValue, mSlopeFilter, QgsHillshadeFilter::processNineCellWindow(), QgsAspectFilter::processNineCellWindow(), QgsSlopeFilter::processNineCellWindow(), and setElevationColor().
Referenced by processRaster().
int QgsRelief::processRaster | ( | QProgressDialog * | p | ) |
Starts the calculation, reads from mInputFile and stores the result in mOutputFile.
p | progress dialog that receives update and that is checked for abort. 0 if no progress bar is needed. |
Definition at line 79 of file qgsrelief.cpp.
References mAspectFilter, mCellSizeX, mCellSizeY, mHillshadeFilter285, mHillshadeFilter300, mHillshadeFilter315, mInputNodataValue, mOutputFile, mOutputNodataValue, mSlopeFilter, mZFactor, openInputFile(), openOutputDriver(), openOutputFile(), processNineCellWindow(), QgsNineCellFilter::setCellSizeX(), QgsNineCellFilter::setCellSizeY(), QgsNineCellFilter::setInputNodataValue(), QgsNineCellFilter::setOutputNodataValue(), QgsNineCellFilter::setZFactor(), and TO8F.
|
inline |
Definition at line 57 of file qgsrelief.h.
|
private |
Sets relief colors.
Definition at line 68 of file qgsrelief.cpp.
References addReliefColorClass(), and clearReliefColors().
|
private |
Set elevation color.
Definition at line 372 of file qgsrelief.cpp.
References mReliefColors.
Referenced by processNineCellWindow().
|
inline |
Definition at line 58 of file qgsrelief.h.
|
inline |
Definition at line 53 of file qgsrelief.h.
|
inline |
Definition at line 52 of file qgsrelief.h.
|
private |
Definition at line 83 of file qgsrelief.h.
Referenced by processNineCellWindow(), processRaster(), QgsRelief(), and ~QgsRelief().
|
private |
Definition at line 73 of file qgsrelief.h.
Referenced by openOutputFile(), and processRaster().
|
private |
Definition at line 74 of file qgsrelief.h.
Referenced by openOutputFile(), and processRaster().
|
private |
Definition at line 84 of file qgsrelief.h.
Referenced by processNineCellWindow(), processRaster(), QgsRelief(), and ~QgsRelief().
|
private |
Definition at line 85 of file qgsrelief.h.
Referenced by processNineCellWindow(), processRaster(), QgsRelief(), and ~QgsRelief().
|
private |
Definition at line 86 of file qgsrelief.h.
Referenced by processNineCellWindow(), processRaster(), QgsRelief(), and ~QgsRelief().
|
private |
Definition at line 69 of file qgsrelief.h.
Referenced by openInputFile().
|
private |
The nodata value of the input layer.
Definition at line 76 of file qgsrelief.h.
Referenced by processRaster().
|
private |
Definition at line 70 of file qgsrelief.h.
Referenced by openOutputFile(), and processRaster().
|
private |
Definition at line 71 of file qgsrelief.h.
Referenced by openOutputDriver().
|
private |
The nodata value of the output layer.
Definition at line 78 of file qgsrelief.h.
Referenced by processNineCellWindow(), and processRaster().
|
private |
Definition at line 89 of file qgsrelief.h.
Referenced by addReliefColorClass(), clearReliefColors(), and setElevationColor().
|
private |
Definition at line 82 of file qgsrelief.h.
Referenced by processNineCellWindow(), processRaster(), QgsRelief(), and ~QgsRelief().
|
private |
Definition at line 80 of file qgsrelief.h.
Referenced by processRaster().