Skip to content
Permalink
Browse files

sipify analysis raster

  • Loading branch information
3nids committed Jun 21, 2017
1 parent 537ef07 commit 2bf92f34f322ef361720ae131ae0e1287d36a7d8
@@ -1,17 +1,41 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/analysis/raster/qgsaspectfilter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsAspectFilter: QgsDerivativeFilter
{
%TypeHeaderCode
#include <qgsaspectfilter.h>
%Docstring
Calculates aspect values in a window of 3x3 cells based on first order derivatives in x- and y- directions. Direction is clockwise starting from north*
%End

%TypeHeaderCode
#include "qgsaspectfilter.h"
%End
public:
QgsAspectFilter( const QString &inputFile, const QString &outputFile, const QString &outputFormat );
~QgsAspectFilter();

/** Calculates output value from nine input values. The input values and the output value can be equal to the
nodata value if not present or outside of the border. Must be implemented by subclasses*/
float processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
virtual float processNineCellWindow( float *x11, float *x21, float *x31,
float *x12, float *x22, float *x32,
float *x13, float *x23, float *x33 );
%Docstring
Calculates output value from nine input values. The input values and the output value can be equal to the
nodata value if not present or outside of the border. Must be implemented by subclasses*
:rtype: float
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/analysis/raster/qgsaspectfilter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -1,21 +1,47 @@
/** Adds the ability to calculate derivatives in x- and y-directions. Needs to be subclassed (e.g. for slope and aspect)*/
/************************************************************************
* This file has been generated automatically from *
* *
* src/analysis/raster/qgsderivativefilter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsDerivativeFilter : QgsNineCellFilter
{
%TypeHeaderCode
#include <qgsderivativefilter.h>
%Docstring
Adds the ability to calculate derivatives in x- and y-directions. Needs to be subclassed (e.g. for slope and aspect)*
%End

%TypeHeaderCode
#include "qgsderivativefilter.h"
%End
public:
QgsDerivativeFilter( const QString &inputFile, const QString &outputFile, const QString &outputFormat );
virtual ~QgsDerivativeFilter();
//to be implemented by subclasses
virtual float processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
virtual float processNineCellWindow( float *x11, float *x21, float *x31,
float *x12, float *x22, float *x32,
float *x13, float *x23, float *x33 ) = 0;

protected:
/** Calculates the first order derivative in x-direction according to Horn (1981)*/
float calcFirstDerX( float *x11, float *x21, float *x31, float *x12, float *x22, float *x32, float *x13, float *x23, float *x33 );
/** Calculates the first order derivative in y-direction according to Horn (1981)*/
%Docstring
Calculates the first order derivative in x-direction according to Horn (1981)
:rtype: float
%End
float calcFirstDerY( float *x11, float *x21, float *x31, float *x12, float *x22, float *x32, float *x13, float *x23, float *x33 );
%Docstring
Calculates the first order derivative in y-direction according to Horn (1981)
:rtype: float
%End
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/analysis/raster/qgsderivativefilter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -1,104 +1,140 @@
/**
* \class QgsKernelDensityEstimation
* \ingroup analysis
* Performs Kernel Density Estimation ("heatmap") calculations on a vector layer.
* @note added in QGIS 3.0
*/
/************************************************************************
* This file has been generated automatically from *
* *
* src/analysis/raster/qgskde.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/






class QgsKernelDensityEstimation
{
%TypeHeaderCode
#include <qgskde.h>
%Docstring
Performs Kernel Density Estimation ("heatmap") calculations on a vector layer.
.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgskde.h"
%End
public:

//! Kernel shape type
enum KernelShape
{
KernelQuartic, //!< Quartic kernel
KernelTriangular, //!< Triangular kernel
KernelUniform, //!< Uniform (flat) kernel
KernelTriweight, //!< Triweight kernel
KernelEpanechnikov, //!< Epanechnikov kernel
KernelQuartic,
KernelTriangular,
KernelUniform,
KernelTriweight,
KernelEpanechnikov,
};

//! Output values type
enum OutputValues
{
OutputRaw, //!< Output the raw KDE values
OutputScaled, //!< Output mathematically correct scaled values
OutputRaw,
OutputScaled,
};

//! Result of operation
enum Result
{
Success, //!< Operation completed successfully
DriverError, //!< Could not open the driver for the specified format
InvalidParameters, //!< Input parameters were not valid
FileCreationError, //!< Error creating output file
RasterIoError, //!< Error writing to raster
Success,
DriverError,
InvalidParameters,
FileCreationError,
RasterIoError,
};

//! KDE parameters
struct Parameters
{
//! Vector point layer
QgsVectorLayer *vectorLayer;
%Docstring
Vector point layer
%End

//! Fixed radius, in map units
double radius;
%Docstring
Fixed radius, in map units
%End

//! Field for radius, or empty if using a fixed radius
QString radiusField;
%Docstring
Field for radius, or empty if using a fixed radius
%End

//! Field name for weighting field, or empty if not using weights
QString weightField;
%Docstring
Field name for weighting field, or empty if not using weights
%End

//! Size of pixel in output file
double pixelSize;
%Docstring
Size of pixel in output file
%End

//! Kernel shape
QgsKernelDensityEstimation::KernelShape shape;
%Docstring
Kernel shape
%End

//! Decay ratio (Triangular kernels only)
double decayRatio;
%Docstring
Decay ratio (Triangular kernels only)
%End

//! Type of output value
QgsKernelDensityEstimation::OutputValues outputValues;
%Docstring
Type of output value
%End
};

/**
* Constructor for QgsKernelDensityEstimation. Requires a Parameters object specifying the options to use
* to generate the surface. The output path and file format are also required.
*/
QgsKernelDensityEstimation( const Parameters &parameters, const QString &outputFile, const QString &outputFormat );
%Docstring
Constructor for QgsKernelDensityEstimation. Requires a Parameters object specifying the options to use
to generate the surface. The output path and file format are also required.
%End

/**
* Runs the KDE calculation across the whole layer at once. Either call this method, or manually
* call run(), addFeature() and finalise() separately.
*/
Result run();
%Docstring
Runs the KDE calculation across the whole layer at once. Either call this method, or manually
call run(), addFeature() and finalise() separately.
:rtype: Result
%End

/**
* Prepares the output file for writing and setups up the surface calculation. This must be called
* before adding features via addFeature().
* @see addFeature()
* @see finalise()
*/
Result prepare();
%Docstring
Prepares the output file for writing and setups up the surface calculation. This must be called
before adding features via addFeature().
.. seealso:: addFeature()
.. seealso:: finalise()
:rtype: Result
%End

/**
* Adds a single feature to the KDE surface. prepare() must be called before adding features.
* @see prepare()
* @see finalise()
*/
Result addFeature( const QgsFeature &feature );
%Docstring
Adds a single feature to the KDE surface. prepare() must be called before adding features.
.. seealso:: prepare()
.. seealso:: finalise()
:rtype: Result
%End

/**
* Finalises the output file. Must be called after adding all features via addFeature().
* @see prepare()
* @see addFeature()
*/
Result finalise();
%Docstring
Finalises the output file. Must be called after adding all features via addFeature().
.. seealso:: prepare()
.. seealso:: addFeature()
:rtype: Result
%End

};


/************************************************************************
* This file has been generated automatically from *
* *
* src/analysis/raster/qgskde.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -1,33 +1,88 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/analysis/raster/qgsninecellfilter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/






class QgsNineCellFilter
{
%Docstring
Base class for raster analysis methods that work with a 3x3 cell filter and calculate the value of each cell based on
the cell value and the eight neighbour cells. Common examples are slope and aspect calculation in DEMs. Subclasses only implement
the method that calculates the new value from the nine values. Everything else (reading file, writing file) is done by this subclass*
%End

%TypeHeaderCode
#include <qgsninecellfilter.h>
#include "qgsninecellfilter.h"
%End
public:
/** Constructor that takes input file, output file and output format (GDAL string)*/
QgsNineCellFilter( const QString &inputFile, const QString &outputFile, const QString &outputFormat );
%Docstring
Constructor that takes input file, output file and output format (GDAL string)
%End
virtual ~QgsNineCellFilter();
/** Starts the calculation, reads from mInputFile and stores the result in mOutputFile
@param p progress dialog that receives update and that is checked for abort. 0 if no progress bar is needed.
@return 0 in case of success*/

int processRaster( QProgressDialog *p );
%Docstring
Starts the calculation, reads from mInputFile and stores the result in mOutputFile
\param p progress dialog that receives update and that is checked for abort. 0 if no progress bar is needed.
:return: 0 in case of success*
:rtype: int
%End

double cellSizeX() const;
%Docstring
:rtype: float
%End
void setCellSizeX( double size );
double cellSizeY() const;
%Docstring
:rtype: float
%End
void setCellSizeY( double size );

double zFactor() const;
%Docstring
:rtype: float
%End
void setZFactor( double factor );

double inputNodataValue() const;
%Docstring
:rtype: float
%End
void setInputNodataValue( double value );
double outputNodataValue() const;
%Docstring
:rtype: float
%End
void setOutputNodataValue( double value );

/** Calculates output value from nine input values. The input values and the output value can be equal to the
nodata value if not present or outside of the border. Must be implemented by subclasses*/
virtual float processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
virtual float processNineCellWindow( float *x11, float *x21, float *x31,
float *x12, float *x22, float *x32,
float *x13, float *x23, float *x33 ) = 0;
%Docstring
Calculates output value from nine input values. The input values and the output value can be equal to the
nodata value if not present or outside of the border. Must be implemented by subclasses*
:rtype: float
%End

protected:


};

/************************************************************************
* This file has been generated automatically from *
* *
* src/analysis/raster/qgsninecellfilter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

0 comments on commit 2bf92f3

Please sign in to comment.
You can’t perform that action at this time.