mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-08 00:05:09 -04:00
598 lines
19 KiB
Plaintext
598 lines
19 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/raster/qgsrasterinterface.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QgsRasterBlockFeedback : QgsFeedback
|
|
{
|
|
%Docstring(signature="appended")
|
|
Feedback object tailored for raster block reading.
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgsrasterinterface.h"
|
|
%End
|
|
public:
|
|
QgsRasterBlockFeedback( QObject *parent = 0 );
|
|
%Docstring
|
|
Construct a new raster block feedback object
|
|
%End
|
|
|
|
virtual void onNewData();
|
|
%Docstring
|
|
May be emitted by raster data provider to indicate that some partial
|
|
data are available and a new preview image may be produced
|
|
%End
|
|
|
|
bool isPreviewOnly() const;
|
|
%Docstring
|
|
Whether the raster provider should return only data that are already
|
|
available without waiting for full result. By default this flag is not
|
|
enabled.
|
|
|
|
.. seealso:: :py:func:`setPreviewOnly`
|
|
%End
|
|
|
|
void setPreviewOnly( bool preview );
|
|
%Docstring
|
|
set flag whether the block request is for preview purposes only
|
|
|
|
.. seealso:: :py:func:`isPreviewOnly`
|
|
%End
|
|
|
|
bool renderPartialOutput() const;
|
|
%Docstring
|
|
Whether our painter is drawing to a temporary image used just by this
|
|
layer
|
|
|
|
.. seealso:: :py:func:`setRenderPartialOutput`
|
|
%End
|
|
|
|
void setRenderPartialOutput( bool enable );
|
|
%Docstring
|
|
Set whether our painter is drawing to a temporary image used just by
|
|
this layer
|
|
|
|
.. seealso:: :py:func:`renderPartialOutput`
|
|
%End
|
|
|
|
void appendError( const QString &error );
|
|
%Docstring
|
|
Appends an error message to the stored list of errors. Should be called
|
|
whenever an error is encountered while retrieving a raster block.
|
|
|
|
.. seealso:: :py:func:`errors`
|
|
|
|
.. versionadded:: 3.8.0
|
|
%End
|
|
|
|
QStringList errors() const;
|
|
%Docstring
|
|
Returns a list of any errors encountered while retrieving the raster
|
|
block.
|
|
|
|
.. seealso:: :py:func:`appendError`
|
|
|
|
.. versionadded:: 3.8.0
|
|
%End
|
|
|
|
QgsRenderContext renderContext() const;
|
|
%Docstring
|
|
Returns the render context of the associated block reading
|
|
|
|
.. seealso:: :py:func:`setRenderContext`
|
|
|
|
.. versionadded:: 3.24.0
|
|
%End
|
|
|
|
void setRenderContext( const QgsRenderContext &renderContext );
|
|
%Docstring
|
|
Sets the render context of the associated block reading
|
|
|
|
.. seealso:: :py:func:`renderContext`
|
|
|
|
.. versionadded:: 3.24.0
|
|
%End
|
|
|
|
};
|
|
|
|
|
|
class QgsRasterInterface
|
|
{
|
|
%Docstring(signature="appended")
|
|
Base class for processing filters like renderers, reprojector, resampler
|
|
etc.
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgsrasterinterface.h"
|
|
#include "qgsbrightnesscontrastfilter.h"
|
|
#include "qgshuesaturationfilter.h"
|
|
#include "qgsrasterdataprovider.h"
|
|
#include "qgsrasternuller.h"
|
|
#include "qgsrasterprojector.h"
|
|
#include "qgsrasterrenderer.h"
|
|
#include "qgsrasterresamplefilter.h"
|
|
#include "qgshillshaderenderer.h"
|
|
#include "qgsmultibandcolorrenderer.h"
|
|
#include "qgspalettedrasterrenderer.h"
|
|
#include "qgssinglebandcolordatarenderer.h"
|
|
#include "qgssinglebandgrayrenderer.h"
|
|
#include "qgssinglebandpseudocolorrenderer.h"
|
|
#include "qgsrastersinglecolorrenderer.h"
|
|
#include "qgsrastercontourrenderer.h"
|
|
%End
|
|
%ConvertToSubClassCode
|
|
if ( dynamic_cast<QgsBrightnessContrastFilter *>( sipCpp ) )
|
|
sipType = sipType_QgsBrightnessContrastFilter;
|
|
else if ( dynamic_cast<QgsHueSaturationFilter *>( sipCpp ) )
|
|
sipType = sipType_QgsHueSaturationFilter;
|
|
else if ( dynamic_cast<QgsRasterDataProvider *>( sipCpp ) )
|
|
{
|
|
sipType = sipType_QgsRasterDataProvider;
|
|
// use static cast because QgsRasterDataProvider has multiple inheritance
|
|
// and we would end up with bad pointer otherwise!
|
|
*sipCppRet = static_cast<QgsRasterDataProvider *>( sipCpp );
|
|
}
|
|
else if ( dynamic_cast<QgsRasterNuller *>( sipCpp ) )
|
|
sipType = sipType_QgsRasterNuller;
|
|
else if ( dynamic_cast<QgsRasterProjector *>( sipCpp ) )
|
|
sipType = sipType_QgsRasterProjector;
|
|
else if ( dynamic_cast<QgsRasterRenderer *>( sipCpp ) )
|
|
{
|
|
if ( dynamic_cast<QgsHillshadeRenderer *>( sipCpp ) )
|
|
sipType = sipType_QgsHillshadeRenderer;
|
|
else if ( dynamic_cast<QgsMultiBandColorRenderer *>( sipCpp ) )
|
|
sipType = sipType_QgsMultiBandColorRenderer;
|
|
else if ( dynamic_cast<QgsPalettedRasterRenderer *>( sipCpp ) )
|
|
sipType = sipType_QgsPalettedRasterRenderer;
|
|
else if ( dynamic_cast<QgsSingleBandColorDataRenderer *>( sipCpp ) )
|
|
sipType = sipType_QgsSingleBandColorDataRenderer;
|
|
else if ( dynamic_cast<QgsSingleBandGrayRenderer *>( sipCpp ) )
|
|
sipType = sipType_QgsSingleBandGrayRenderer;
|
|
else if ( dynamic_cast<QgsSingleBandPseudoColorRenderer *>( sipCpp ) )
|
|
sipType = sipType_QgsSingleBandPseudoColorRenderer;
|
|
else if ( dynamic_cast<QgsRasterSingleColorRenderer *>( sipCpp ) )
|
|
sipType = sipType_QgsRasterSingleColorRenderer;
|
|
else if ( dynamic_cast<QgsRasterContourRenderer *>( sipCpp ) )
|
|
sipType = sipType_QgsRasterContourRenderer;
|
|
else
|
|
sipType = sipType_QgsRasterRenderer;
|
|
}
|
|
else if ( dynamic_cast<QgsRasterResampleFilter *>( sipCpp ) )
|
|
sipType = sipType_QgsRasterResampleFilter;
|
|
else
|
|
sipType = 0;
|
|
%End
|
|
public:
|
|
|
|
QgsRasterInterface( QgsRasterInterface *input = 0 );
|
|
|
|
virtual ~QgsRasterInterface();
|
|
|
|
virtual QgsRasterInterface *clone() const = 0 /Factory/;
|
|
%Docstring
|
|
Clone itself, create deep copy
|
|
%End
|
|
|
|
|
|
virtual Qgis::RasterInterfaceCapabilities capabilities() const;
|
|
%Docstring
|
|
Returns the capabilities supported by the interface.
|
|
%End
|
|
|
|
QString capabilitiesString() const /Deprecated="Since 3.40. Will be removed in QGIS 4.0."/;
|
|
%Docstring
|
|
Returns the raster interface capabilities in friendly format.
|
|
|
|
.. deprecated:: 3.40
|
|
|
|
Will be removed in QGIS 4.0.
|
|
%End
|
|
|
|
virtual Qgis::DataType dataType( int bandNo ) const = 0;
|
|
%Docstring
|
|
Returns data type for the band specified by number
|
|
%End
|
|
|
|
virtual Qgis::DataType sourceDataType( int bandNo ) const;
|
|
%Docstring
|
|
Returns source data type for the band specified by number, source data
|
|
type may be shorter than dataType
|
|
%End
|
|
|
|
virtual QgsRectangle extent() const;
|
|
%Docstring
|
|
Gets the extent of the interface.
|
|
|
|
:return: :py:class:`QgsRectangle` containing the extent of the layer
|
|
%End
|
|
|
|
int dataTypeSize( int bandNo ) const;
|
|
%Docstring
|
|
Returns the size (in bytes) for the data type for the specified band.
|
|
%End
|
|
|
|
virtual int bandCount() const = 0;
|
|
%Docstring
|
|
Gets number of bands
|
|
%End
|
|
|
|
virtual int xBlockSize() const;
|
|
%Docstring
|
|
Gets block size
|
|
%End
|
|
virtual int yBlockSize() const;
|
|
|
|
virtual int xSize() const;
|
|
%Docstring
|
|
Gets raster size
|
|
%End
|
|
virtual int ySize() const;
|
|
|
|
virtual QString generateBandName( int bandNumber ) const;
|
|
%Docstring
|
|
helper function to create zero padded band names
|
|
%End
|
|
|
|
virtual QString colorInterpretationName( int bandNumber ) const;
|
|
%Docstring
|
|
Returns the name of the color interpretation for the specified
|
|
``bandNumber``. It is translated since QGIS 3.40
|
|
|
|
.. versionadded:: 3.18
|
|
%End
|
|
|
|
QString displayBandName( int bandNumber ) const;
|
|
%Docstring
|
|
Generates a friendly, descriptive name for the specified ``bandNumber``.
|
|
|
|
.. versionadded:: 3.18
|
|
%End
|
|
|
|
virtual QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = 0 ) = 0 /Factory/;
|
|
%Docstring
|
|
Read block of data using given extent and size. Returns pointer to data.
|
|
Caller is responsible to free the memory returned.
|
|
|
|
:param bandNo: band number
|
|
:param extent: extent of block
|
|
:param width: pixel width of block
|
|
:param height: pixel height of block
|
|
:param feedback: optional raster feedback object for
|
|
cancellation/preview. Added in QGIS 3.0.
|
|
%End
|
|
|
|
virtual bool setInput( QgsRasterInterface *input );
|
|
%Docstring
|
|
Set input. Returns ``True`` if set correctly, ``False`` if cannot use
|
|
that input
|
|
%End
|
|
|
|
virtual QgsRasterInterface *input() const;
|
|
%Docstring
|
|
Current input
|
|
%End
|
|
|
|
virtual bool on() const;
|
|
%Docstring
|
|
Returns whether the interface is on or off
|
|
%End
|
|
|
|
virtual void setOn( bool on );
|
|
%Docstring
|
|
Sets whether the interface is on or off
|
|
%End
|
|
|
|
|
|
virtual QgsRasterInterface *sourceInput();
|
|
%Docstring
|
|
Gets source / raw input, the first in pipe, usually provider. It may be
|
|
used to get info about original data, e.g. resolution to decide
|
|
resampling etc.
|
|
%End
|
|
|
|
QgsRasterBandStats bandStatistics( int bandNo, int stats, const QgsRectangle &extent = QgsRectangle(), int sampleSize = 0, QgsRasterBlockFeedback *feedback = 0 ) /Deprecated="Since 3.40. Use Qgis.RasterBandStatistic instead of int for ``stats`` argument."/;
|
|
%Docstring
|
|
Returns the band statistics.
|
|
|
|
:param bandNo: The band (number).
|
|
:param stats: Requested statistics
|
|
:param extent: Extent used to calc statistics, if empty, whole raster
|
|
extent is used.
|
|
:param sampleSize: Approximate number of cells in sample. If 0, all
|
|
cells (whole raster will be used). If raster does not
|
|
have exact size (WCS without exact size for example),
|
|
provider decides size of sample.
|
|
:param feedback: optional feedback object
|
|
|
|
.. deprecated:: 3.40
|
|
|
|
Use :py:class:`Qgis`.RasterBandStatistic instead of int for ``stats`` argument.
|
|
%End
|
|
|
|
virtual QgsRasterBandStats bandStatistics( int bandNo,
|
|
Qgis::RasterBandStatistics stats = Qgis::RasterBandStatistic::All,
|
|
const QgsRectangle &extent = QgsRectangle(),
|
|
int sampleSize = 0, QgsRasterBlockFeedback *feedback = 0 );
|
|
%Docstring
|
|
Returns the band statistics.
|
|
|
|
:param bandNo: The band (number).
|
|
:param stats: Requested statistics
|
|
:param extent: Extent used to calc statistics, if empty, whole raster
|
|
extent is used.
|
|
:param sampleSize: Approximate number of cells in sample. If 0, all
|
|
cells (whole raster will be used). If raster does not
|
|
have exact size (WCS without exact size for example),
|
|
provider decides size of sample.
|
|
:param feedback: optional feedback object
|
|
%End
|
|
|
|
bool hasStatistics( int bandNo, int stats, const QgsRectangle &extent = QgsRectangle(), int sampleSize = 0 ) /Deprecated="Since 3.40. Use Qgis.RasterBandStatistic instead of int for ``stats`` argument."/;
|
|
%Docstring
|
|
Returns ``True`` if histogram is available (cached, already calculated).
|
|
The parameters are the same as in
|
|
:py:func:`~QgsRasterInterface.bandStatistics`
|
|
|
|
:return: ``True`` if statistics are available (ready to use)
|
|
|
|
.. deprecated:: 3.40
|
|
|
|
Use :py:class:`Qgis`.RasterBandStatistic instead of int for ``stats`` argument.
|
|
%End
|
|
|
|
virtual bool hasStatistics( int bandNo,
|
|
Qgis::RasterBandStatistics stats = Qgis::RasterBandStatistic::All,
|
|
const QgsRectangle &extent = QgsRectangle(),
|
|
int sampleSize = 0 );
|
|
%Docstring
|
|
Returns ``True`` if histogram is available (cached, already calculated).
|
|
The parameters are the same as in
|
|
:py:func:`~QgsRasterInterface.bandStatistics`
|
|
|
|
:return: ``True`` if statistics are available (ready to use)
|
|
%End
|
|
|
|
|
|
virtual QgsRasterHistogram histogram( int bandNo,
|
|
int binCount = 0,
|
|
SIP_PYOBJECT minimum = Py_None,
|
|
SIP_PYOBJECT maximum = Py_None,
|
|
const QgsRectangle &extent = QgsRectangle(),
|
|
int sampleSize = 0,
|
|
bool includeOutOfRange = false,
|
|
QgsRasterBlockFeedback *feedback = 0 )
|
|
[QgsRasterHistogram( int bandNo,
|
|
int binCount = 0,
|
|
double minimum = 0.0,
|
|
double maximum = 0.0,
|
|
const QgsRectangle &extent = QgsRectangle(),
|
|
int sampleSize = 0,
|
|
bool includeOutOfRange = false,
|
|
QgsRasterBlockFeedback *feedback = nullptr )];
|
|
%Docstring
|
|
Returns a band histogram. Histograms are cached in providers.
|
|
|
|
:param bandNo: The band (number).
|
|
:param binCount: Number of bins (intervals,buckets). If 0, the number of
|
|
bins is decided automatically according to data type,
|
|
raster size etc.
|
|
:param minimum: Minimum value, if NaN (None for Python), raster minimum
|
|
value will be used.
|
|
:param maximum: Maximum value, if NaN (None for Python), raster maximum
|
|
value will be used.
|
|
:param extent: Extent used to calc histogram, if empty, whole raster
|
|
extent is used.
|
|
:param sampleSize: Approximate number of cells in sample. If 0, all
|
|
cells (whole raster will be used). If raster does not
|
|
have exact size (WCS without exact size for example),
|
|
provider decides size of sample.
|
|
:param includeOutOfRange: include out of range values
|
|
:param feedback: optional feedback object
|
|
|
|
:return: Vector of non NULL cell counts for each bin.
|
|
|
|
.. note::
|
|
|
|
binCount, minimum and maximum not optional in Python bindings
|
|
%End
|
|
%MethodCode
|
|
double minimum;
|
|
double maximum;
|
|
if ( a2 == Py_None )
|
|
{
|
|
minimum = std::numeric_limits<double>::quiet_NaN();
|
|
}
|
|
else
|
|
{
|
|
minimum = PyFloat_AsDouble( a2 );
|
|
}
|
|
|
|
if ( a3 == Py_None )
|
|
{
|
|
maximum = std::numeric_limits<double>::quiet_NaN();
|
|
}
|
|
else
|
|
{
|
|
maximum = PyFloat_AsDouble( a3 );
|
|
}
|
|
|
|
QgsRasterHistogram *h = new QgsRasterHistogram( sipCpp->histogram( a0, a1, minimum, maximum, *a4, a5, a6, a7 ) );
|
|
return sipConvertFromType( h, sipType_QgsRasterHistogram, Py_None );
|
|
%End
|
|
|
|
|
|
virtual bool hasHistogram( int bandNo,
|
|
int binCount,
|
|
SIP_PYOBJECT minimum = Py_None,
|
|
SIP_PYOBJECT maximum = Py_None,
|
|
const QgsRectangle &extent = QgsRectangle(),
|
|
int sampleSize = 0,
|
|
bool includeOutOfRange = false )
|
|
[bool( int bandNo,
|
|
int binCount,
|
|
double minimum = 0.0,
|
|
double maximum = 0.0,
|
|
const QgsRectangle &extent = QgsRectangle(),
|
|
int sampleSize = 0,
|
|
bool includeOutOfRange = false )];
|
|
%Docstring
|
|
Returns ``True`` if histogram is available (cached, already calculated)
|
|
|
|
.. note::
|
|
|
|
the parameters are the same as in :py:func:`histogram`
|
|
%End
|
|
%MethodCode
|
|
double minimum;
|
|
double maximum;
|
|
if ( a2 == Py_None )
|
|
{
|
|
minimum = std::numeric_limits<double>::quiet_NaN();
|
|
}
|
|
else
|
|
{
|
|
minimum = PyFloat_AsDouble( a2 );
|
|
}
|
|
|
|
if ( a3 == Py_None )
|
|
{
|
|
maximum = std::numeric_limits<double>::quiet_NaN();
|
|
}
|
|
else
|
|
{
|
|
maximum = PyFloat_AsDouble( a3 );
|
|
}
|
|
|
|
sipRes = sipCpp->hasHistogram( a0, a1, minimum, maximum, *a4, a5, a6 );
|
|
%End
|
|
|
|
|
|
virtual void cumulativeCut( int bandNo,
|
|
double lowerCount,
|
|
double upperCount,
|
|
double &lowerValue,
|
|
double &upperValue,
|
|
const QgsRectangle &extent = QgsRectangle(),
|
|
int sampleSize = 0 );
|
|
%Docstring
|
|
Find values for cumulative pixel count cut.
|
|
|
|
:param bandNo: The band (number).
|
|
:param lowerCount: The lower count as fraction of 1, e.g. 0.02 = 2%
|
|
:param upperCount: The upper count as fraction of 1, e.g. 0.98 = 98%
|
|
:param lowerValue: Location into which the lower value will be set.
|
|
:param upperValue: Location into which the upper value will be set.
|
|
:param extent: Extent used to calc histogram, if empty, whole raster
|
|
extent is used.
|
|
:param sampleSize: Approximate number of cells in sample. If 0, all
|
|
cells (whole raster will be used). If raster does not
|
|
have exact size (WCS without exact size for example),
|
|
provider decides size of sample.
|
|
%End
|
|
|
|
virtual void writeXml( QDomDocument &doc, QDomElement &parentElem ) const;
|
|
%Docstring
|
|
Write base class members to xml.
|
|
%End
|
|
virtual void readXml( const QDomElement &filterElem );
|
|
%Docstring
|
|
Sets base class members from xml. Usually called from
|
|
:py:func:`~QgsRasterInterface.create` methods of subclasses
|
|
%End
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
void initHistogram( QgsRasterHistogram &histogram,
|
|
int bandNo,
|
|
int binCount,
|
|
SIP_PYOBJECT minimum = Py_None,
|
|
SIP_PYOBJECT maximum = Py_None,
|
|
const QgsRectangle &boundingBox = QgsRectangle(),
|
|
int sampleSize = 0,
|
|
bool includeOutOfRange = false )
|
|
[void ( QgsRasterHistogram & histogram,
|
|
int bandNo,
|
|
int binCount,
|
|
double minimum = 0.0,
|
|
double maximum = 0.0,
|
|
const QgsRectangle &boundingBox = QgsRectangle(),
|
|
int sampleSize = 0,
|
|
bool includeOutOfRange = false )];
|
|
%Docstring
|
|
Fill in histogram defaults if not specified
|
|
|
|
.. note::
|
|
|
|
the parameters are the same as in :py:func:`histogram`
|
|
%End
|
|
%MethodCode
|
|
double minimum;
|
|
double maximum;
|
|
if ( a3 == Py_None )
|
|
{
|
|
minimum = std::numeric_limits<double>::quiet_NaN();
|
|
}
|
|
else
|
|
{
|
|
minimum = PyFloat_AsDouble( a3 );
|
|
}
|
|
|
|
if ( a4 == Py_None )
|
|
{
|
|
maximum = std::numeric_limits<double>::quiet_NaN();
|
|
}
|
|
else
|
|
{
|
|
maximum = PyFloat_AsDouble( a4 );
|
|
}
|
|
|
|
#if defined(SIP_PROTECTED_IS_PUBLIC) || (SIP_VERSION >= 0x050000 && !defined(_MSC_VER))
|
|
sipCpp->initHistogram( *a0, a1, a2, minimum, maximum, *a5, a6, a7 );
|
|
#else
|
|
sipCpp->sipProtect_initHistogram( *a0, a1, a2, minimum, maximum, *a5, a6, a7 );
|
|
#endif
|
|
%End
|
|
|
|
void initStatistics( QgsRasterBandStats &statistics, int bandNo, int stats, const QgsRectangle &boundingBox = QgsRectangle(), int binCount = 0 ) const /Deprecated="Since 3.40. Use Qgis.RasterBandStatistic instead of int for ``stats`` argument."/;
|
|
%Docstring
|
|
Fill in statistics defaults if not specified
|
|
|
|
.. deprecated:: 3.40
|
|
|
|
Use :py:class:`Qgis`.RasterBandStatistic instead of int for ``stats`` argument.
|
|
%End
|
|
|
|
void initStatistics( QgsRasterBandStats &statistics, int bandNo,
|
|
Qgis::RasterBandStatistics stats = Qgis::RasterBandStatistic::All,
|
|
const QgsRectangle &boundingBox = QgsRectangle(),
|
|
int binCount = 0 ) const;
|
|
%Docstring
|
|
Fill in statistics defaults if not specified
|
|
%End
|
|
|
|
private:
|
|
QgsRasterInterface( const QgsRasterInterface & );
|
|
QgsRasterInterface &operator=( const QgsRasterInterface & );
|
|
};
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/raster/qgsrasterinterface.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|