2017-06-01 15:39:31 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterinterface.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
2012-09-24 02:28:15 +02:00
2016-07-22 23:26:47 +02:00
class QgsRasterBlockFeedback : QgsFeedback
{
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Feedback object tailored for raster block reading.
2017-06-01 15:39:31 +02:00
.. versionadded:: 3.0
2016-07-22 23:26:47 +02:00
%End
2016-09-02 09:41:35 +08:00
2017-06-01 15:39:31 +02:00
%TypeHeaderCode
#include "qgsrasterinterface.h"
%End
2016-09-02 09:41:35 +08:00
public:
2017-05-02 07:21:20 +02:00
QgsRasterBlockFeedback( QObject *parent = 0 );
2017-06-01 15:39:31 +02:00
%Docstring
Construct a new raster block feedback object
%End
2016-09-02 09:41:35 +08:00
virtual void onNewData();
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
May be emitted by raster data provider to indicate that some partial data are available
and a new preview image may be produced
2017-06-01 15:39:31 +02:00
%End
2016-09-09 16:02:18 +08:00
bool isPreviewOnly() const;
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Whether the raster provider should return only data that are already available
without waiting for full result. By default this flag is not enabled.
2018-01-09 17:26:37 -04:00
.. seealso:: :py:func:`setPreviewOnly`
2017-06-01 15:39:31 +02:00
%End
2017-10-05 11:51:04 +10:00
2016-09-09 16:02:18 +08:00
void setPreviewOnly( bool preview );
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
set flag whether the block request is for preview purposes only
2018-01-09 17:26:37 -04:00
.. seealso:: :py:func:`isPreviewOnly`
2017-06-01 15:39:31 +02:00
%End
2016-09-09 16:02:18 +08:00
bool renderPartialOutput() const;
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Whether our painter is drawing to a temporary image used just by this layer
2018-01-09 17:26:37 -04:00
.. seealso:: :py:func:`setRenderPartialOutput`
2017-06-01 15:39:31 +02:00
%End
2017-10-05 11:51:04 +10:00
2016-09-09 16:02:18 +08:00
void setRenderPartialOutput( bool enable );
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Set whether our painter is drawing to a temporary image used just by this layer
2018-01-09 17:26:37 -04:00
.. seealso:: :py:func:`renderPartialOutput`
2019-05-21 09:29:18 +10:00
%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
2017-06-01 15:39:31 +02:00
%End
2016-09-09 16:02:18 +08:00
2016-07-22 23:26:47 +02:00
};
2012-09-24 02:28:15 +02:00
class QgsRasterInterface
{
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Base class for processing filters like renderers, reprojector, resampler etc.
2017-06-01 15:39:31 +02:00
%End
2012-09-24 02:28:15 +02:00
%TypeHeaderCode
2017-06-01 15:39:31 +02:00
#include "qgsrasterinterface.h"
2014-10-22 17:29:14 +07:00
// QgsRasterInterface subclasses
#include <qgsbrightnesscontrastfilter.h>
#include <qgshuesaturationfilter.h>
2012-09-24 02:28:15 +02:00
#include <qgsrasterdataprovider.h>
2014-10-22 17:29:14 +07:00
#include <qgsrasternuller.h>
#include <qgsrasterprojector.h>
#include <qgsrasterrenderer.h>
#include <qgsrasterresamplefilter.h>
2012-09-24 02:28:15 +02:00
2014-10-22 17:29:14 +07:00
// QgsRasterRenderer subclasses
2017-04-10 08:52:32 +10:00
#include <qgshillshaderenderer.h>
2012-09-24 02:28:15 +02:00
#include <qgsmultibandcolorrenderer.h>
2014-10-22 17:29:14 +07:00
#include <qgspalettedrasterrenderer.h>
2012-09-24 02:28:15 +02:00
#include <qgssinglebandcolordatarenderer.h>
2014-10-22 17:29:14 +07:00
#include <qgssinglebandgrayrenderer.h>
#include <qgssinglebandpseudocolorrenderer.h>
2012-09-24 02:28:15 +02:00
%End
%ConvertToSubClassCode
2017-06-01 15:39:31 +02:00
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
sipType = sipType_QgsRasterRenderer;
}
else if ( dynamic_cast<QgsRasterResampleFilter *>( sipCpp ) )
sipType = sipType_QgsRasterResampleFilter;
2014-10-22 17:29:14 +07:00
else
2017-06-01 15:39:31 +02:00
sipType = 0;
2012-09-24 02:28:15 +02:00
%End
public:
2012-12-17 18:29:08 +01:00
enum Capability
{
NoCapabilities,
Size,
Create,
Remove,
2013-04-16 16:14:12 +02:00
BuildPyramids,
Identify,
2012-12-17 18:29:08 +01:00
IdentifyValue,
IdentifyText,
IdentifyHtml,
2014-02-27 22:22:07 +01:00
IdentifyFeature,
2012-12-17 18:29:08 +01:00
};
2012-09-24 02:28:15 +02:00
2017-05-03 07:45:22 +02:00
QgsRasterInterface( QgsRasterInterface *input = 0 );
2012-09-24 02:28:15 +02:00
virtual ~QgsRasterInterface();
virtual QgsRasterInterface *clone() const = 0 /Factory/;
2017-06-01 15:39:31 +02:00
%Docstring
Clone itself, create deep copy
%End
2012-09-24 02:28:15 +02:00
2012-12-17 18:29:08 +01:00
virtual int capabilities() const;
2017-06-01 15:39:31 +02:00
%Docstring
Returns a bitmask containing the supported capabilities
%End
2013-01-12 23:48:58 +01:00
2012-12-17 18:29:08 +01:00
QString capabilitiesString() const;
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the above in friendly format.
2017-06-01 15:39:31 +02:00
%End
2012-12-17 18:29:08 +01:00
2016-07-21 22:01:38 +10:00
virtual Qgis::DataType dataType( int bandNo ) const = 0;
2017-06-01 15:39:31 +02:00
%Docstring
Returns data type for the band specified by number
%End
2012-09-24 02:28:15 +02:00
2016-07-21 22:01:38 +10:00
virtual Qgis::DataType sourceDataType( int bandNo ) const;
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns source data type for the band specified by number,
2019-02-25 17:20:36 +10:00
source data type may be shorter than dataType
2017-06-01 15:39:31 +02:00
%End
2014-01-26 18:35:21 +01:00
2016-07-10 21:30:19 +10:00
virtual QgsRectangle extent() const;
2017-06-01 15:39:31 +02:00
%Docstring
2018-05-26 18:44:30 +10:00
Gets the extent of the interface.
2017-12-15 10:36:55 -04:00
:return: QgsRectangle containing the extent of the layer
2017-06-01 15:39:31 +02:00
%End
2014-01-26 18:35:21 +01:00
2015-02-03 02:21:52 +01:00
int dataTypeSize( int bandNo );
2012-09-24 02:28:15 +02:00
2012-10-11 16:11:45 +02:00
virtual int bandCount() const = 0;
2017-06-01 15:39:31 +02:00
%Docstring
2018-05-26 18:44:30 +10:00
Gets number of bands
2017-06-01 15:39:31 +02:00
%End
2012-09-24 02:28:15 +02:00
2012-12-17 18:29:08 +01:00
virtual int xBlockSize() const;
2017-06-01 15:39:31 +02:00
%Docstring
2018-05-26 18:44:30 +10:00
Gets block size
2017-06-01 15:39:31 +02:00
%End
2012-12-17 18:29:08 +01:00
virtual int yBlockSize() const;
virtual int xSize() const;
2017-06-01 15:39:31 +02:00
%Docstring
2018-05-26 18:44:30 +10:00
Gets raster size
2017-06-01 15:39:31 +02:00
%End
2012-12-17 18:29:08 +01:00
virtual int ySize() const;
2017-02-21 18:14:58 +01:00
virtual QString generateBandName( int bandNumber ) const;
2017-06-01 15:39:31 +02:00
%Docstring
2018-05-26 14:10:30 +10:00
helper function to create zero padded band names
2017-06-01 15:39:31 +02:00
%End
2012-09-24 02:28:15 +02:00
2017-05-02 07:21:20 +02:00
virtual QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = 0 ) = 0 /Factory/;
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Read block of data using given extent and size.
Returns pointer to data.
Caller is responsible to free the memory returned.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param bandNo: band number
:param extent: extent of block
:param width: pixel width of block
:param height: pixel height of block
2019-02-24 10:15:32 +01:00
:param feedback: optional raster feedback object for cancellation/preview. Added in QGIS 3.0.
2017-06-01 15:39:31 +02:00
%End
2012-09-24 02:28:15 +02:00
2017-05-01 18:13:15 +02:00
virtual bool setInput( QgsRasterInterface *input );
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Set input.
2019-02-26 19:54:09 +10:00
Returns ``True`` if set correctly, ``False`` if cannot use that input
2017-06-01 15:39:31 +02:00
%End
2012-09-24 02:28:15 +02:00
2017-05-03 07:45:22 +02:00
virtual QgsRasterInterface *input() const;
2017-06-01 15:39:31 +02:00
%Docstring
Current input
%End
2012-09-24 02:28:15 +02:00
2012-10-20 00:56:44 +02:00
virtual bool on() const;
2017-06-01 15:39:31 +02:00
%Docstring
2018-05-25 13:54:27 +10:00
Returns whether the interface is on or off
2017-06-01 15:39:31 +02:00
%End
2012-09-24 02:28:15 +02:00
virtual void setOn( bool on );
2017-06-01 15:39:31 +02:00
%Docstring
2018-05-25 13:54:27 +10:00
Sets whether the interface is on or off
2017-06-01 15:39:31 +02:00
%End
2012-09-24 02:28:15 +02:00
2016-07-19 11:45:47 +10:00
virtual QgsRasterInterface *sourceInput();
2017-06-01 15:39:31 +02:00
%Docstring
2018-05-26 18:44:30 +10:00
Gets source / raw input, the first in pipe, usually provider.
2017-12-15 10:36:55 -04:00
It may be used to get info about original data, e.g. resolution to decide
resampling etc.
2017-06-01 15:39:31 +02:00
%End
2012-12-17 18:29:08 +01:00
2017-02-21 18:14:58 +01:00
virtual QgsRasterBandStats bandStatistics( int bandNo,
int stats = QgsRasterBandStats::All,
2017-03-27 15:27:06 +10:00
const QgsRectangle &extent = QgsRectangle(),
int sampleSize = 0, QgsRasterBlockFeedback *feedback = 0 );
2017-06-01 15:39:31 +02:00
%Docstring
2018-05-26 18:44:30 +10:00
Returns the band statistics.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
: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
2017-06-01 15:39:31 +02:00
%End
2017-02-21 18:14:58 +01:00
virtual bool hasStatistics( int bandNo,
int stats = QgsRasterBandStats::All,
2017-03-27 15:27:06 +10:00
const QgsRectangle &extent = QgsRectangle(),
2017-02-21 18:14:58 +01:00
int sampleSize = 0 );
2017-06-01 15:39:31 +02:00
%Docstring
2019-02-26 19:54:09 +10:00
Returns ``True`` if histogram is available (cached, already calculated). * The parameters are the same as in bandStatistics()
2017-12-15 10:36:55 -04:00
2019-02-26 19:54:09 +10:00
:return: ``True`` if statistics are available (ready to use)
2017-06-01 15:39:31 +02:00
%End
2017-02-21 18:14:58 +01:00
virtual QgsRasterHistogram histogram( int bandNo,
2017-06-12 11:12:25 +02:00
int binCount = 0,
SIP_PYOBJECT minimum = Py_None,
SIP_PYOBJECT maximum = Py_None,
2017-03-27 15:27:06 +10:00
const QgsRectangle &extent = QgsRectangle(),
int sampleSize = 0,
2017-06-01 15:39:31 +02:00
bool includeOutOfRange = false,
2017-06-12 11:12:25 +02:00
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 )];
2017-06-01 15:39:31 +02:00
%Docstring
2018-05-26 18:44:30 +10:00
Returns a band histogram. Histograms are cached in providers.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
: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.
2017-06-01 15:39:31 +02:00
.. note::
binCount, minimum and maximum not optional in Python bindings
%End
2017-06-12 11:12:25 +02:00
%MethodCode
double minimum;
double maximum;
if ( a2 == Py_None )
{
minimum = std::numeric_limits<double>::quiet_NaN();
}
else
{
minimum = PyFloat_AsDouble( a2 );
}
2017-06-01 15:39:31 +02:00
2017-06-12 11:12:25 +02:00
if ( a3 == Py_None )
{
maximum = std::numeric_limits<double>::quiet_NaN();
}
else
{
maximum = PyFloat_AsDouble( a3 );
}
2017-06-01 15:39:31 +02:00
2017-06-12 11:12:25 +02:00
QgsRasterHistogram h = sipCpp->histogram( a0, a1, minimum, maximum, *a4, a5, a6, a7 );
sipRes = &h;
2017-06-01 15:39:31 +02:00
%End
2013-01-12 23:48:58 +01:00
2017-02-21 18:14:58 +01:00
virtual bool hasHistogram( int bandNo,
int binCount,
2017-06-12 11:12:25 +02:00
SIP_PYOBJECT minimum = Py_None,
SIP_PYOBJECT maximum = Py_None,
2017-06-01 15:39:31 +02:00
const QgsRectangle &extent = QgsRectangle(),
int sampleSize = 0,
2017-06-12 11:12:25 +02:00
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 )];
2017-06-01 15:39:31 +02:00
%Docstring
2019-02-26 19:54:09 +10:00
Returns ``True`` if histogram is available (cached, already calculated)
2017-12-15 10:36:55 -04:00
2018-01-09 17:26:37 -04:00
.. note::
the parameters are the same as in :py:func:`histogram`
2017-06-01 15:39:31 +02:00
%End
2017-06-12 11:12:25 +02:00
%MethodCode
double minimum;
double maximum;
if ( a2 == Py_None )
{
minimum = std::numeric_limits<double>::quiet_NaN();
}
else
{
minimum = PyFloat_AsDouble( a2 );
}
2017-06-01 15:39:31 +02:00
2017-06-12 11:12:25 +02:00
if ( a3 == Py_None )
{
maximum = std::numeric_limits<double>::quiet_NaN();
}
else
{
maximum = PyFloat_AsDouble( a3 );
}
2017-06-01 15:39:31 +02:00
2017-06-12 11:12:25 +02:00
sipRes = sipCpp->hasHistogram( a0, a1, minimum, maximum, *a4, a5, a6 );
2017-06-01 15:39:31 +02:00
%End
2017-02-21 18:14:58 +01:00
virtual void cumulativeCut( int bandNo,
double lowerCount,
double upperCount,
double &lowerValue,
double &upperValue,
2017-06-01 15:39:31 +02:00
const QgsRectangle &extent = QgsRectangle(),
2017-02-21 18:14:58 +01:00
int sampleSize = 0 );
2017-06-01 15:39:31 +02:00
%Docstring
2018-05-26 14:10:30 +10:00
Find values for cumulative pixel count cut.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
: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.
2018-05-27 16:42:41 +10:00
:param upperValue: Location into which the upper value will be set.
2017-12-15 10:36:55 -04:00
: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.
2017-06-01 15:39:31 +02:00
%End
2012-12-17 18:29:08 +01:00
2017-05-01 18:13:15 +02:00
virtual void writeXml( QDomDocument &doc, QDomElement &parentElem ) const;
2017-06-01 15:39:31 +02:00
%Docstring
Write base class members to xml.
%End
2017-05-01 18:13:15 +02:00
virtual void readXml( const QDomElement &filterElem );
2017-06-01 15:39:31 +02:00
%Docstring
Sets base class members from xml. Usually called from create() methods of subclasses
%End
2013-03-14 17:34:38 +01:00
2016-01-04 22:51:18 +11:00
protected:
2017-06-01 15:39:31 +02:00
void initHistogram( QgsRasterHistogram &histogram,
int bandNo,
int binCount,
2017-06-12 11:12:25 +02:00
SIP_PYOBJECT minimum = Py_None,
SIP_PYOBJECT maximum = Py_None,
const QgsRectangle &boundingBox = QgsRectangle(),
2017-02-21 18:14:58 +01:00
int sampleSize = 0,
2017-06-12 11:12:25 +02:00
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 )];
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Fill in histogram defaults if not specified
2018-01-09 17:26:37 -04:00
.. note::
the parameters are the same as in :py:func:`histogram`
2017-06-01 15:39:31 +02:00
%End
2017-06-12 11:12:25 +02:00
%MethodCode
double minimum;
double maximum;
if ( a3 == Py_None )
{
minimum = std::numeric_limits<double>::quiet_NaN();
}
else
{
minimum = PyFloat_AsDouble( a3 );
}
2017-06-01 15:39:31 +02:00
2017-06-12 11:12:25 +02:00
if ( a4 == Py_None )
{
maximum = std::numeric_limits<double>::quiet_NaN();
}
else
{
maximum = PyFloat_AsDouble( a4 );
}
2017-02-21 18:14:58 +01:00
2017-06-13 14:36:16 +02:00
#if defined(SIP_PROTECTED_IS_PUBLIC)
2017-06-12 11:12:25 +02:00
sipCpp->initHistogram( *a0, a1, a2, minimum, maximum, *a5, a6, a7 );
2017-06-13 14:36:16 +02:00
#else
sipCpp->sipProtect_initHistogram( *a0, a1, a2, minimum, maximum, *a5, a6, a7 );
#endif
2017-06-01 15:39:31 +02:00
%End
void initStatistics( QgsRasterBandStats &statistics, int bandNo,
2017-02-21 18:14:58 +01:00
int stats = QgsRasterBandStats::All,
2017-06-01 15:39:31 +02:00
const QgsRectangle &boundingBox = QgsRectangle(),
2017-02-21 18:14:58 +01:00
int binCount = 0 );
2017-06-01 15:39:31 +02:00
%Docstring
Fill in statistics defaults if not specified
%End
2016-09-01 15:38:58 +08:00
private:
2017-06-01 15:39:31 +02:00
QgsRasterInterface( const QgsRasterInterface & );
QgsRasterInterface &operator=( const QgsRasterInterface & );
2012-09-24 02:28:15 +02:00
};
2017-06-01 15:39:31 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterinterface.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/