sipify core raster part 2

This commit is contained in:
Denis Rouzaud 2017-06-01 15:39:31 +02:00
parent d357bc5a36
commit 98f653e6a5
24 changed files with 1920 additions and 889 deletions

View File

@ -2050,6 +2050,7 @@ PREDEFINED =
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
EXPAND_AS_DEFINED = "SIP_ABSTRACT" \
"SIP_ALLOWNONE" \
"SIP_ARRAY" \
"SIP_ARRAYSIZE" \
"SIP_CONSTRAINED" \
@ -2067,7 +2068,7 @@ EXPAND_AS_DEFINED = "SIP_ABSTRACT" \
"SIP_PYARGDEFAULT" \
"SIP_PYARGREMOVE" \
"SIP_PYNAME" \
"SIP_PYTYPE" \
"SIP_PYALTERNATIVETYPE" \
"SIP_SKIP" \
"SIP_TRANSFER" \
"SIP_TRANSFERBACK" \

View File

@ -48,18 +48,6 @@ core/gps/qgsgpsdconnection.sip
core/gps/qgsgpsdetector.sip
core/gps/qgsnmeaconnection.sip
core/gps/qgsqtlocationconnection.sip
core/raster/qgsrasterbandstats.sip
core/raster/qgsrasterblock.sip
core/raster/qgsrasterchecker.sip
core/raster/qgsrasterdataprovider.sip
core/raster/qgsrasterdrawer.sip
core/raster/qgsrasterhistogram.sip
core/raster/qgsrasteridentifyresult.sip
core/raster/qgsrasterinterface.sip
core/raster/qgsrasteriterator.sip
core/raster/qgsrasterlayer.sip
core/raster/qgsrasterminmaxorigin.sip
core/raster/qgsrasternuller.sip
core/raster/qgsrasterpipe.sip
core/raster/qgsrasterprojector.sip
core/raster/qgsrasterpyramid.sip

View File

@ -1,14 +1,26 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterbandstats.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
/** \ingroup core
* The RasterBandStats struct is a container for statistics about a single
* raster band.
*/
class QgsRasterBandStats
{
%TypeHeaderCode
#include <qgsrasterbandstats.h>
%Docstring
The RasterBandStats struct is a container for statistics about a single
raster band.
%End
%TypeHeaderCode
#include "qgsrasterbandstats.h"
%End
public:
enum Stats
{
@ -25,48 +37,80 @@ class QgsRasterBandStats
QgsRasterBandStats();
/** Compares region, size etc. not collected statistics */
bool contains( const QgsRasterBandStats &s ) const;
%Docstring
Compares region, size etc. not collected statistics
:rtype: bool
%End
/** \brief The gdal band number (starts at 1)*/
int bandNumber;
%Docstring
The gdal band number (starts at 1)
%End
/** \brief The number of not no data cells in the band. */
// TODO: check if no data are excluded in stats calculation
qgssize elementCount;
/** \brief The maximum cell value in the raster band. NO_DATA values
* are ignored. This does not use the gdal GetMaximmum function. */
double maximumValue;
%Docstring
The maximum cell value in the raster band. NO_DATA values
are ignored. This does not use the gdal GetMaximmum function. *
%End
/** \brief The minimum cell value in the raster band. NO_DATA values
* are ignored. This does not use the gdal GetMinimum function. */
double minimumValue;
%Docstring
The minimum cell value in the raster band. NO_DATA values
are ignored. This does not use the gdal GetMinimum function. *
%End
/** \brief The mean cell value for the band. NO_DATA values are excluded. */
double mean;
%Docstring
The mean cell value for the band. NO_DATA values are excluded.
%End
/** \brief The range is the distance between min & max. */
double range;
%Docstring
The range is the distance between min & max.
%End
/** \brief The standard deviation of the cell values. */
double stdDev;
%Docstring
The standard deviation of the cell values.
%End
/** \brief Collected statistics */
int statsGathered;
%Docstring
Collected statistics
%End
/** \brief The sum of all cells in the band. NO_DATA values are excluded. */
double sum;
%Docstring
The sum of all cells in the band. NO_DATA values are excluded.
%End
/** \brief The sum of the squares. Used to calculate standard deviation. */
double sumOfSquares;
%Docstring
The sum of the squares. Used to calculate standard deviation.
%End
/** \brief Number of columns used to calc statistics */
int width;
%Docstring
Number of columns used to calc statistics
%End
/** \brief Number of rows used to calc statistics */
int height;
%Docstring
Number of rows used to calc statistics
%End
/** \brief Extent used to calc statistics */
QgsRectangle extent;
%Docstring
Extent used to calc statistics
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterbandstats.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,300 +1,424 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterblock.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsRasterBlock
{
%TypeHeaderCode
#include <qgis.h>
#include <qgsrasterblock.h>
%Docstring
Raster data container.
%End
%TypeHeaderCode
#include "qgsrasterblock.h"
%End
public:
QgsRasterBlock();
/** \brief Constructor which allocates data block in memory
* @param dataType raster data type
* @param width width of data matrix
* @param height height of data matrix
*/
QgsRasterBlock( Qgis::DataType dataType, int width, int height );
%Docstring
Constructor which allocates data block in memory
\param dataType raster data type
\param width width of data matrix
\param height height of data matrix
%End
virtual ~QgsRasterBlock();
/** \brief Reset block
* @param dataType raster data type
* @param width width of data matrix
* @param height height of data matrix
* @return true on success
*/
bool reset( Qgis::DataType dataType, int width, int height );
%Docstring
Reset block
\param dataType raster data type
\param width width of data matrix
\param height height of data matrix
:return: true on success
:rtype: bool
%End
// TODO: consider if use isValid() at all, isEmpty() should be sufficient
// and works also if block is valid but empty - difference between valid and empty?
/** \brief Returns true if the block is valid (correctly filled with data).
* An empty block may still be valid (if zero size block was requested).
* If the block is not valid, error may be retrieved by error() method.
*/
bool isValid() const;
%Docstring
Returns true if the block is valid (correctly filled with data).
An empty block may still be valid (if zero size block was requested).
If the block is not valid, error may be retrieved by error() method.
:rtype: bool
%End
/** \brief Mark block as valid or invalid */
void setValid( bool valid );
%Docstring
Mark block as valid or invalid
%End
/** Returns true if block is empty, i.e. its size is 0 (zero rows or cols).
* This method does not return true if size is not zero and all values are
* 'no data' (null).
*/
bool isEmpty() const;
%Docstring
Returns true if block is empty, i.e. its size is 0 (zero rows or cols).
This method does not return true if size is not zero and all values are
'no data' (null).
:rtype: bool
%End
// Return data type size in bytes
static int typeSize( int dataType );
%Docstring
:rtype: int
%End
// Data type in bytes
int dataTypeSize() const;
%Docstring
:rtype: int
%End
/** Returns true if data type is numeric */
static bool typeIsNumeric( Qgis::DataType type );
%Docstring
Returns true if data type is numeric
:rtype: bool
%End
/** Returns true if data type is color */
static bool typeIsColor( Qgis::DataType type );
%Docstring
Returns true if data type is color
:rtype: bool
%End
/** Returns data type */
Qgis::DataType dataType() const;
%Docstring
Returns data type
:rtype: Qgis.DataType
%End
/** For given data type returns wider type and sets no data value */
static Qgis::DataType typeWithNoDataValue( Qgis::DataType dataType, double *noDataValue );
%Docstring
For given data type returns wider type and sets no data value
:rtype: Qgis.DataType
%End
/** True if the block has no data value.
* @return true if the block has no data value
* @see noDataValue(), setNoDataValue(), resetNoDataValue()
*/
bool hasNoDataValue() const;
%Docstring
True if the block has no data value.
:return: true if the block has no data value
.. seealso:: noDataValue(), setNoDataValue(), resetNoDataValue()
:rtype: bool
%End
/** Returns true if the block may contain no data. It does not guarantee
* that it really contains any no data. It can be used to speed up processing.
* Not the difference between this method and hasNoDataValue().
* @return true if the block may contain no data */
bool hasNoData() const;
%Docstring
Returns true if the block may contain no data. It does not guarantee
that it really contains any no data. It can be used to speed up processing.
Not the difference between this method and hasNoDataValue().
:return: true if the block may contain no data *
:rtype: bool
%End
/** Sets cell value that will be considered as "no data".
* @note added in QGIS 3.0
* @see noDataValue(), hasNoDataValue(), resetNoDataValue()
*/
void setNoDataValue( double noDataValue );
%Docstring
Sets cell value that will be considered as "no data".
.. versionadded:: 3.0
.. seealso:: noDataValue(), hasNoDataValue(), resetNoDataValue()
%End
/** Reset no data value: if there was a no data value previously set,
* it will be discarded.
* @note added in QGIS 3.0
* @see noDataValue(), hasNoDataValue(), setNoDataValue()
*/
void resetNoDataValue();
%Docstring
Reset no data value: if there was a no data value previously set,
it will be discarded.
.. versionadded:: 3.0
.. seealso:: noDataValue(), hasNoDataValue(), setNoDataValue()
%End
/** Return no data value. If the block does not have a no data value the
* returned value is undefined.
* @return No data value
* @see hasNoDataValue(), setNoDataValue(), resetNoDataValue()
*/
double noDataValue() const;
%Docstring
Return no data value. If the block does not have a no data value the
returned value is undefined.
:return: No data value
.. seealso:: hasNoDataValue(), setNoDataValue(), resetNoDataValue()
:rtype: float
%End
/** Get byte array representing a value.
* @param dataType data type
* @param value value
* @return byte array representing the value */
static QByteArray valueBytes( Qgis::DataType dataType, double value );
%Docstring
Get byte array representing a value.
\param dataType data type
\param value value
:return: byte array representing the value *
:rtype: QByteArray
%End
/** \brief Read a single value if type of block is numeric. If type is color,
* returned value is undefined.
* @param row row index
* @param column column index
* @return value */
double value( int row, int column ) const;
%Docstring
Read a single value if type of block is numeric. If type is color,
returned value is undefined.
\param row row index
\param column column index
:return: value *
:rtype: float
%End
/** \brief Read a single value if type of block is numeric. If type is color,
* returned value is undefined.
* @param index data matrix index (long type in Python)
* @return value */
double value( qgssize index ) const;
%Docstring
Read a single value if type of block is numeric. If type is color,
returned value is undefined.
\param index data matrix index (long type in Python)
:return: value *
:rtype: float
%End
/** \brief Read a single color
* @param row row index
* @param column column index
* @return color */
QRgb color( int row, int column ) const;
%Docstring
Read a single color
\param row row index
\param column column index
:return: color *
:rtype: QRgb
%End
/** \brief Read a single value
* @param index data matrix index (long type in Python)
* @return color */
QRgb color( qgssize index ) const;
%Docstring
Read a single value
\param index data matrix index (long type in Python)
:return: color *
:rtype: QRgb
%End
/** \brief Check if value at position is no data
* @param row row index
* @param column column index
* @return true if value is no data */
bool isNoData( int row, int column );
%Docstring
Check if value at position is no data
\param row row index
\param column column index
:return: true if value is no data *
:rtype: bool
%End
/** \brief Check if value at position is no data
* @param index data matrix index (long type in Python)
* @return true if value is no data */
bool isNoData( qgssize index );
%Docstring
Check if value at position is no data
\param index data matrix index (long type in Python)
:return: true if value is no data *
:rtype: bool
%End
/** \brief Set value on position
* @param row row index
* @param column column index
* @param value the value to be set
* @return true on success */
bool setValue( int row, int column, double value );
%Docstring
Set value on position
\param row row index
\param column column index
\param value the value to be set
:return: true on success *
:rtype: bool
%End
/** \brief Set value on index (indexed line by line)
* @param index data matrix index (long type in Python)
* @param value the value to be set
* @return true on success */
bool setValue( qgssize index, double value );
%Docstring
Set value on index (indexed line by line)
\param index data matrix index (long type in Python)
\param value the value to be set
:return: true on success *
:rtype: bool
%End
/** \brief Set color on position
* @param row row index
* @param column column index
* @param color the color to be set, QRgb value
* @return true on success */
bool setColor( int row, int column, QRgb color );
%Docstring
Set color on position
\param row row index
\param column column index
\param color the color to be set, QRgb value
:return: true on success *
:rtype: bool
%End
/** \brief Set color on index (indexed line by line)
* @param index data matrix index (long type in Python)
* @param color the color to be set, QRgb value
* @return true on success */
bool setColor( qgssize index, QRgb color );
%Docstring
Set color on index (indexed line by line)
\param index data matrix index (long type in Python)
\param color the color to be set, QRgb value
:return: true on success *
:rtype: bool
%End
/** \brief Set no data on pixel
* @param row row index
* @param column column index
* @return true on success */
bool setIsNoData( int row, int column );
%Docstring
Set no data on pixel
\param row row index
\param column column index
:return: true on success *
:rtype: bool
%End
/** \brief Set no data on pixel
* @param index data matrix index (long type in Python)
* @return true on success */
bool setIsNoData( qgssize index );
%Docstring
Set no data on pixel
\param index data matrix index (long type in Python)
:return: true on success *
:rtype: bool
%End
/** \brief Set the whole block to no data
* @return true on success */
bool setIsNoData();
%Docstring
Set the whole block to no data
:return: true on success *
:rtype: bool
%End
/** \brief Set the whole block to no data except specified rectangle
* @return true on success */
bool setIsNoDataExcept( QRect exceptRect );
%Docstring
Set the whole block to no data except specified rectangle
:return: true on success *
:rtype: bool
%End
/** \brief Remove no data flag on pixel. If the raster block does not have an explicit
* no data value set then an internal map of no data pixels is maintained for the block.
* In this case it is possible to reset a pixel to flag it as having valid data using this
* method. This method has no effect for raster blocks with an explicit no data value set.
* @param row row index
* @param column column index
* @note added in QGIS 2.10 */
void setIsData( int row, int column );
%Docstring
Remove no data flag on pixel. If the raster block does not have an explicit
no data value set then an internal map of no data pixels is maintained for the block.
In this case it is possible to reset a pixel to flag it as having valid data using this
method. This method has no effect for raster blocks with an explicit no data value set.
\param row row index
\param column column index
.. versionadded:: 2.10
%End
/** \brief Remove no data flag on pixel. If the raster block does not have an explicit
* no data value set then an internal map of no data pixels is maintained for the block.
* In this case it is possible to reset a pixel to flag it as having valid data using this
* method. This method has no effect for raster blocks with an explicit no data value set.
* @param index data matrix index (long type in Python)
* @note added in QGIS 2.10 */
void setIsData( qgssize index );
%Docstring
Remove no data flag on pixel. If the raster block does not have an explicit
no data value set then an internal map of no data pixels is maintained for the block.
In this case it is possible to reset a pixel to flag it as having valid data using this
method. This method has no effect for raster blocks with an explicit no data value set.
\param index data matrix index (long type in Python)
.. versionadded:: 2.10
%End
/** Get access to raw data.
* The returned QByteArray instance is not a copy of the data: it only refers to the array
* owned by the QgsRasterBlock, therefore it is only valid while the QgsRasterBlock object
* still exists. Writing to the returned QByteArray will not affect the original data:
* a deep copy of the data will be made and only the local copy will be modified.
* @note in Python the method returns ordinary bytes object as the
* @note added in QGIS 3.0
*/
QByteArray data() const;
%Docstring
Get access to raw data.
The returned QByteArray instance is not a copy of the data: it only refers to the array
owned by the QgsRasterBlock, therefore it is only valid while the QgsRasterBlock object
still exists. Writing to the returned QByteArray will not affect the original data:
a deep copy of the data will be made and only the local copy will be modified.
.. note::
in Python the method returns ordinary bytes object as the
.. versionadded:: 3.0
:rtype: QByteArray
%End
/** Rewrite raw pixel data.
* If the data array is shorter than the internal array within the raster block object,
* pixels at the end will stay untouched. If the data array is longer than the internal
* array, only the initial data from the input array will be used.
* Optionally it is possible to set non-zero offset (in bytes) if the input data should
* overwrite data somewhere in the middle of the internal buffer.
* @note added in QGIS 3.0
*/
void setData( const QByteArray &data, int offset = 0 );
%Docstring
Rewrite raw pixel data.
If the data array is shorter than the internal array within the raster block object,
pixels at the end will stay untouched. If the data array is longer than the internal
array, only the initial data from the input array will be used.
Optionally it is possible to set non-zero offset (in bytes) if the input data should
overwrite data somewhere in the middle of the internal buffer.
.. versionadded:: 3.0
%End
/** \brief Get pointer to data
* @param row row index
* @param column column index
* @return pointer to data
*/
void *bits( int row, int column ) /PyName=bitsByRowCol/ [char * ()];
/** \brief Get pointer to data
* @param index data matrix index (long type in Python)
* @return pointer to data
*/
void *bits( qgssize index ) /PyName=bitsByIndex/ [char * ()];
/** \brief Get pointer to data
* @return pointer to data
* @note not available in python bindings
*/
void *bits() [char * ()];
/** \brief Print double value with all necessary significant digits.
* It is ensured that conversion back to double gives the same number.
* @param value the value to be printed
* @return string representing the value*/
static QString printValue( double value );
%Docstring
Print double value with all necessary significant digits.
It is ensured that conversion back to double gives the same number.
\param value the value to be printed
:return: string representing the value*
:rtype: str
%End
/** \brief Convert data to different type.
* @param destDataType dest data type
* @return true on success */
bool convert( Qgis::DataType destDataType );
%Docstring
Convert data to different type.
\param destDataType dest data type
:return: true on success *
:rtype: bool
%End
/** \brief Get image if type is color.
* @return image */
QImage image() const;
%Docstring
Get image if type is color.
:return: image *
:rtype: QImage
%End
/** \brief set image.
* @param image image
* @return true on success */
bool setImage( const QImage *image );
%Docstring
set image.
\param image image
:return: true on success *
:rtype: bool
%End
// @note not available in python bindings
// inline static double readValue( void *data, Qgis::DataType type, qgssize index );
// @note not available in python bindings
// inline static void writeValue( void *data, Qgis::DataType type, qgssize index, double value );
void applyNoDataValues( const QgsRasterRangeList &rangeList );
/** Apply band scale and offset to raster block values
* @@note added in 2.3 */
void applyScaleOffset( double scale, double offset );
%Docstring
Apply band scale and offset to raster block values
.. versionadded:: 2.3
%End
/** \brief Get error */
QgsError error() const;
%Docstring
Get error
:rtype: QgsError
%End
/** \brief Set error */
void setError( const QgsError &error );
%Docstring
Set error
%End
QString toString() const;
%Docstring
:rtype: str
%End
/** \brief For extent and width, height find rectangle covered by subextent.
* The output rect has x oriented from left to right and y from top to bottom
* (upper-left to lower-right orientation).
* @param extent extent, usually the larger
* @param width numbers of columns in theExtent
* @param height numbers of rows in theExtent
* @param subExtent extent, usually smaller than theExtent
* @return the rectangle covered by sub extent
*/
static QRect subRect( const QgsRectangle &extent, int width, int height, const QgsRectangle &subExtent );
%Docstring
For extent and width, height find rectangle covered by subextent.
The output rect has x oriented from left to right and y from top to bottom
(upper-left to lower-right orientation).
\param extent extent, usually the larger
\param width numbers of columns in theExtent
\param height numbers of rows in theExtent
\param subExtent extent, usually smaller than theExtent
:return: the rectangle covered by sub extent
:rtype: QRect
%End
/** Returns the width (number of columns) of the raster block.
* @see height
* @note added in QGIS 2.10
*/
int width() const;
%Docstring
Returns the width (number of columns) of the raster block.
.. seealso:: height
.. versionadded:: 2.10
:rtype: int
%End
/** Returns the height (number of rows) of the raster block.
* @see width
* @note added in QGIS 2.10
*/
int height() const;
%Docstring
Returns the height (number of rows) of the raster block.
.. seealso:: width
.. versionadded:: 2.10
:rtype: int
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterblock.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,32 +1,49 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterchecker.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
/** Raster checker for tests in python */
/** \ingroup UnitTests
* This is a helper class for unit tests that need to
* write an image and compare it to an expected result
* or render time.
*/
class QgsRasterChecker
{
%Docstring
This is a helper class for unit tests that need to
write an image and compare it to an expected result
or render time.
%End
%TypeHeaderCode
#include <qgsrasterchecker.h>
#include "qgsrasterchecker.h"
%End
public:
QgsRasterChecker();
//! Destructor
~QgsRasterChecker();
QString report();
/**
* Test using renderer to generate the image to be compared.
* @param verifiedKey verified provider key
* @param verifiedUri URI of the raster to be verified
* @param expectedKey expected provider key
* @param expectedUri URI of the expected (control) raster
*/
bool runTest( const QString& verifiedKey, QString verifiedUri,
const QString &expectedKey, QString expectedUri );
};
%Docstring
:rtype: str
%End
bool runTest( const QString &verifiedKey, QString verifiedUri,
const QString &expectedKey, QString expectedUri );
%Docstring
Test using renderer to generate the image to be compared.
\param verifiedKey verified provider key
\param verifiedUri URI of the raster to be verified
\param expectedKey expected provider key
\param expectedUri URI of the expected (control) raster
:rtype: bool
%End
}; // class QgsRasterChecker
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterchecker.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,354 +1,476 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterdataprovider.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
/**
* \brief Handles asynchronous download of images
*
* \note added in 2.8
*/
class QgsImageFetcher : QObject
{
%Docstring
Handles asynchronous download of images
.. versionadded:: 2.8
%End
%TypeHeaderCode
#include <qgsrasterdataprovider.h>
#include "qgsrasterdataprovider.h"
%End
public:
/** Constructor */
QgsImageFetcher( QObject *parent = 0 );
/** Destructor */
virtual ~QgsImageFetcher();
/** Starts the image download
* @note Make sure to connect to "finish" and "error" before starting */
virtual void start() = 0;
signals:
/** Emitted when the download completes
* @param legend The downloaded legend image */
void finish( const QImage &legend );
/** Emitted to report progress */
void progress( qint64 received, qint64 total );
/** Emitted when an error occurs */
void error( const QString &msg );
};
/** \ingroup core
* Base class for raster data providers.
*/
class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
{
%TypeHeaderCode
#include <qgsrasterdataprovider.h>
#include <qgsrasterinterface.h>
#include <qgsrasteridentifyresult.h>
%Docstring
Constructor
%End
virtual void start() = 0;
%Docstring
Starts the image download
.. note::
Make sure to connect to "finish" and "error" before starting *
%End
signals:
void finish( const QImage &legend );
%Docstring
Emitted when the download completes
\param legend The downloaded legend image *
%End
void progress( qint64 received, qint64 total );
%Docstring
Emitted to report progress
%End
void error( const QString &msg );
%Docstring
Emitted when an error occurs
%End
};
class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
{
%Docstring
Base class for raster data providers.
%End
%TypeHeaderCode
#include "qgsrasterdataprovider.h"
%End
public:
QgsRasterDataProvider();
QgsRasterDataProvider( const QString &uri );
virtual ~QgsRasterDataProvider();
virtual QgsRasterInterface *clone() const = 0;
/* It makes no sense to set input on provider */
bool setInput( QgsRasterInterface *input );
virtual bool setInput( QgsRasterInterface *input );
%Docstring
It makes no sense to set input on provider */
:rtype: bool
%End
/** Get the extent of the data source.
* @return QgsRectangle containing the extent of the layer
*/
virtual QgsRectangle extent() const = 0;
/** Returns data type for the band specified by number */
virtual Qgis::DataType dataType( int bandNo ) const = 0;
%Docstring
Returns data type for the band specified by number
:rtype: Qgis.DataType
%End
/** Returns source data type for the band specified by number,
* source data type may be shorter than dataType
*/
virtual Qgis::DataType sourceDataType( int bandNo ) const = 0;
%Docstring
Returns source data type for the band specified by number,
source data type may be shorter than dataType
:rtype: Qgis.DataType
%End
/** Returns data type for the band specified by number */
virtual int colorInterpretation( int bandNo ) const;
%Docstring
Returns data type for the band specified by number
:rtype: int
%End
QString colorName( int colorInterpretation ) const;
/** Reload data (data could change) */
%Docstring
:rtype: str
%End
virtual bool reload();
%Docstring
Reload data (data could change)
:rtype: bool
%End
virtual QString colorInterpretationName( int bandNo ) const;
%Docstring
:rtype: str
%End
/** Read band scale for raster value
* @note added in 2.3
*/
virtual double bandScale( int bandNo ) const;
/** Read band offset for raster value
* @note added in 2.3
*/
%Docstring
Read band scale for raster value
.. versionadded:: 2.3
:rtype: float
%End
virtual double bandOffset( int bandNo ) const;
%Docstring
Read band offset for raster value
.. versionadded:: 2.3
:rtype: float
%End
/** Get block size */
virtual int xBlockSize() const;
virtual int yBlockSize() const;
/** Get raster size */
virtual int xSize() const;
virtual int ySize() const;
virtual QgsRasterBlock *block( int bandNo, const QgsRectangle &boundingBox, int width, int height, QgsRasterBlockFeedback *feedback = 0 );
%Docstring
Read block of data using given extent and size.
:rtype: QgsRasterBlock
%End
//! Read block of data using given extent and size.
virtual QgsRasterBlock *block(int bandNo, const QgsRectangle &boundingBox, int width, int height, QgsRasterBlockFeedback *feedback = 0 );
/** Return true if source band has no data value */
virtual bool sourceHasNoDataValue( int bandNo ) const;
%Docstring
Return true if source band has no data value
:rtype: bool
%End
/** \brief Get source nodata value usage */
virtual bool useSourceNoDataValue( int bandNo ) const;
%Docstring
Get source nodata value usage
:rtype: bool
%End
/** \brief Set source nodata value usage */
virtual void setUseSourceNoDataValue( int bandNo, bool use );
%Docstring
Set source nodata value usage
%End
/** Value representing no data value. */
virtual double sourceNoDataValue( int bandNo ) const;
%Docstring
Value representing no data value.
:rtype: float
%End
virtual void setUserNoDataValue( int bandNo, const QgsRasterRangeList &noData );
/** Get list of user no data value ranges */
virtual QgsRasterRangeList userNoDataValues( int bandNo ) const;
%Docstring
Get list of user no data value ranges
:rtype: QgsRasterRangeList
%End
virtual QList<QgsColorRampShader::ColorRampItem> colorTable( int bandNo ) const;
%Docstring
:rtype: list of QgsColorRampShader.ColorRampItem
%End
/** \brief Returns the sublayers of this layer - useful for providers that manage
* their own layers, such as WMS */
virtual QStringList subLayers() const;
%Docstring
Returns the sublayers of this layer - useful for providers that manage
their own layers, such as WMS *
:rtype: list of str
%End
/** \brief Returns whether the provider supplies a legend graphic */
virtual bool supportsLegendGraphic() const;
%Docstring
Returns whether the provider supplies a legend graphic
:rtype: bool
%End
/** \brief Returns the legend rendered as pixmap
*
* useful for that layer that need to get legend layer remotely as WMS
* \param scale Optional parameter that is the Scale of the layer
* \param forceRefresh Optional bool parameter to force refresh getLegendGraphic call
* \param visibleExtent Visible extent for providers supporting contextual legends, in layer CRS
* \note visibleExtent parameter added in 2.8 (no available in python bindings)
*/
virtual QImage getLegendGraphic( double scale = 0, bool forceRefresh = false, const QgsRectangle *visibleExtent = 0 );
/**
* \brief Get an image downloader for the raster legend
*
* \param mapSettings map settings for legend providers supporting
* contextual legends.
*
* \return a download handler or null if the provider does not support
* legend at all. Ownership of the returned object is transferred
* to caller.
*
* \note added in 2.8
*
*/
virtual QgsImageFetcher *getLegendGraphicFetcher( const QgsMapSettings *mapSettings ) /Factory/;
%Docstring
Get an image downloader for the raster legend
/** \brief Create pyramid overviews */
virtual QString buildPyramids( const QList<QgsRasterPyramid> & pyramidList,
const QString & resamplingMethod = "NEAREST",
\param mapSettings map settings for legend providers supporting
contextual legends.
:return: a download handler or null if the provider does not support
legend at all. Ownership of the returned object is transferred
to caller.
.. versionadded:: 2.8
:rtype: QgsImageFetcher
%End
virtual QString buildPyramids( const QList<QgsRasterPyramid> &pyramidList,
const QString &resamplingMethod = "NEAREST",
QgsRaster::RasterPyramidsFormat format = QgsRaster::PyramidsGTiff,
const QStringList & configOptions = QStringList(),
const QStringList &configOptions = QStringList(),
QgsRasterBlockFeedback *feedback = 0 );
%Docstring
Create pyramid overviews
:rtype: str
%End
/** \brief Accessor for the raster layers pyramid list.
* @param overviewList used to construct the pyramid list (optional), when empty the list is defined by the provider.
* A pyramid list defines the
* POTENTIAL pyramids that can be in a raster. To know which of the pyramid layers
* ACTUALLY exists you need to look at the existsFlag member in each struct stored in the
* list.
*/
virtual QList<QgsRasterPyramid> buildPyramidList( const QList<int> &overviewList = QList<int>() );
virtual QList<QgsRasterPyramid> buildPyramidList( QList<int> overviewList = QList<int>() );
%Docstring
Accessor for the raster layers pyramid list.
\param overviewList used to construct the pyramid list (optional), when empty the list is defined by the provider.
A pyramid list defines the
POTENTIAL pyramids that can be in a raster. To know which of the pyramid layers
ACTUALLY exists you need to look at the existsFlag member in each struct stored in the
list.
:rtype: list of QgsRasterPyramid
%End
/** \brief Returns true if raster has at least one populated histogram. */
bool hasPyramids();
%Docstring
Returns true if raster has at least one populated histogram.
:rtype: bool
%End
/**
* Get metadata in a format suitable for feeding directly
* into a subset of the GUI raster properties "Metadata" tab.
*/
virtual QString metadata() = 0;
%Docstring
Get metadata in a format suitable for feeding directly
into a subset of the GUI raster properties "Metadata" tab.
:rtype: str
%End
/** \brief Identify raster value(s) found on the point position. The context
* parameters extent, width and height are important to identify
* on the same zoom level as a displayed map and to do effective
* caching (WCS). If context params are not specified the highest
* resolution is used. capabilities() may be used to test if format
* is supported by provider. Values are set to 'no data' or empty string
* if point is outside data source extent.
*
* \note The arbitraryness of the returned document is enforced by WMS standards
* up to at least v1.3.0
* @param point coordinates in data source CRS
* @param format result format
* @param extent context extent
* @param width context width
* @param height context height
* @param dpi context dpi
* @return QgsRaster::IdentifyFormatValue: map of values for each band, keys are band numbers
* (from 1).
* QgsRaster::IdentifyFormatFeature: map of QgsRasterFeatureList for each sublayer
* (WMS) - TODO: it is not consistent with QgsRaster::IdentifyFormatValue.
* QgsRaster::IdentifyFormatHtml: map of HTML strings for each sublayer (WMS).
* Empty if failed or there are no results (TODO: better error reporting).
*/
//virtual QMap<int, QVariant> identify( const QgsPoint &point, QgsRaster::IdentifyFormat format, const QgsRectangle &extent = QgsRectangle(), int width = 0, int height = 0 );
virtual QgsRasterIdentifyResult identify(const QgsPoint &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox = QgsRectangle(), int width = 0, int height = 0, int dpi = 96 );
virtual QgsRasterIdentifyResult identify( const QgsPoint &point, QgsRaster::IdentifyFormat format, const QgsRectangle &boundingBox = QgsRectangle(), int width = 0, int height = 0, int dpi = 96 );
%Docstring
:rtype: QgsRasterIdentifyResult
%End
/**
* \brief Returns the caption error text for the last error in this provider
*
* If an operation returns 0 (e.g. draw()), this function
* returns the text of the error associated with the failure.
* Interactive users of this provider can then, for example,
* call a QMessageBox to display the contents.
*
*/
virtual QString lastErrorTitle() = 0;
%Docstring
Returns the caption error text for the last error in this provider
If an operation returns 0 (e.g. draw()), this function
returns the text of the error associated with the failure.
Interactive users of this provider can then, for example,
call a QMessageBox to display the contents.
:rtype: str
%End
/**
* \brief Returns the verbose error text for the last error in this provider
*
* If an operation returns 0 (e.g. draw()), this function
* returns the text of the error associated with the failure.
* Interactive users of this provider can then, for example,
* call a QMessageBox to display the contents.
*
*/
virtual QString lastError() = 0;
%Docstring
Returns the verbose error text for the last error in this provider
If an operation returns 0 (e.g. draw()), this function
returns the text of the error associated with the failure.
Interactive users of this provider can then, for example,
call a QMessageBox to display the contents.
:rtype: str
%End
/** Returns the format of the error text for the last error in this provider */
virtual QString lastErrorFormat();
%Docstring
Returns the format of the error text for the last error in this provider
:rtype: str
%End
/** Returns the dpi of the output device. */
int dpi() const;
%Docstring
Returns the dpi of the output device.
:rtype: int
%End
/** Sets the output device resolution. */
void setDpi( int dpi );
%Docstring
Sets the output device resolution.
%End
/** Time stamp of data source in the moment when data/metadata were loaded by provider */
virtual QDateTime timestamp() const;
%Docstring
Time stamp of data source in the moment when data/metadata were loaded by provider
:rtype: QDateTime
%End
/** Current time stamp of data source */
virtual QDateTime dataTimestamp() const;
%Docstring
Current time stamp of data source
:rtype: QDateTime
%End
/** Checks whether the provider is in editing mode, i.e. raster write operations will be accepted.
* By default providers are not editable. Use setEditable() method to enable/disable editing.
* @see setEditable(), writeBlock()
* @note added in QGIS 3.0
*/
virtual bool isEditable() const;
%Docstring
Checks whether the provider is in editing mode, i.e. raster write operations will be accepted.
By default providers are not editable. Use setEditable() method to enable/disable editing.
.. seealso:: setEditable(), writeBlock()
.. versionadded:: 3.0
:rtype: bool
%End
/** Turns on/off editing mode of the provider. When in editing mode, it is possible
* to overwrite data of the provider using writeBlock() calls.
* @note Only some providers support editing mode and even those may fail to turn
* the underlying data source into editing mode, so it is necessary to check the return
* value whether the operation was successful.
* @returns true if the switch to/from editing mode was successful
* @see isEditable(), writeBlock()
* @note added in QGIS 3.0
*/
virtual bool setEditable( bool enabled );
%Docstring
Turns on/off editing mode of the provider. When in editing mode, it is possible
to overwrite data of the provider using writeBlock() calls.
.. note::
Only some providers support editing mode and even those may fail to turn
the underlying data source into editing mode, so it is necessary to check the return
value whether the operation was successful.
:return: true if the switch to/from editing mode was successful
.. seealso:: isEditable(), writeBlock()
.. versionadded:: 3.0
:rtype: bool
%End
/** Writes into the provider datasource*/
// TODO: add data type (may be defferent from band type)
virtual bool write( void *data, int band, int width, int height, int xOffset, int yOffset );
%Docstring
:rtype: bool
%End
/** Writes pixel data from a raster block into the provider data source.
*
* This will override previously stored pixel values. It is assumed that cells in the passed
* raster block are aligned with the cells of the data source. If raster block does not cover
* the whole area of the data source, only a subset of pixels covered by the raster block
* will be overwritten. By default, writing of raster data starts from the first cell
* of the raster - it is possible to set offset in pixels by specifying non-zero
* xOffset and yOffset values.
*
* Writing is supported only by some data providers. Provider has to be in editing mode
* in order to allow write operations.
* @see isEditable(), setEditable()
* @returns true on success
* @note added in QGIS 3.0
*/
bool writeBlock( QgsRasterBlock *block, int band, int xOffset = 0, int yOffset = 0 );
%Docstring
Writes pixel data from a raster block into the provider data source.
/** Creates a new dataset with mDataSourceURI */
static QgsRasterDataProvider* create( const QString &providerKey,
This will override previously stored pixel values. It is assumed that cells in the passed
raster block are aligned with the cells of the data source. If raster block does not cover
the whole area of the data source, only a subset of pixels covered by the raster block
will be overwritten. By default, writing of raster data starts from the first cell
of the raster - it is possible to set offset in pixels by specifying non-zero
xOffset and yOffset values.
Writing is supported only by some data providers. Provider has to be in editing mode
in order to allow write operations.
.. seealso:: isEditable(), setEditable()
:return: true on success
.. versionadded:: 3.0
:rtype: bool
%End
static QgsRasterDataProvider *create( const QString &providerKey,
const QString &uri,
const QString& format, int nBands,
const QString &format, int nBands,
Qgis::DataType type,
int width, int height, double* geoTransform,
const QgsCoordinateReferenceSystem& crs,
int width, int height, double *geoTransform,
const QgsCoordinateReferenceSystem &crs,
const QStringList &createOptions = QStringList() );
%Docstring
Creates a new dataset with mDataSourceURI
:rtype: QgsRasterDataProvider
%End
/** Set no data value on created dataset
* @param bandNo band number
* @param noDataValue no data value
*/
virtual bool setNoDataValue( int bandNo, double noDataValue );
%Docstring
Set no data value on created dataset
\param bandNo band number
\param noDataValue no data value
:rtype: bool
%End
/** Remove dataset*/
virtual bool remove();
%Docstring
Remove dataset
:rtype: bool
%End
/** Returns a list of pyramid resampling method name and label pairs
* for given provider
*/
static QList<QPair<QString, QString> > pyramidResamplingMethods( const QString &providerKey );
%Docstring
Returns a list of pyramid resampling method name and label pairs
for given provider
:rtype: list of QPair<str, QString>
%End
/** Validates creation options for a specific dataset and destination format.
* @note used by GDAL provider only
* @note see also validateCreationOptionsFormat() in gdal provider for validating options based on format only
*/
virtual QString validateCreationOptions( const QStringList &createOptions, const QString &format );
%Docstring
Validates creation options for a specific dataset and destination format.
.. note::
used by GDAL provider only
.. note::
see also validateCreationOptionsFormat() in gdal provider for validating options based on format only
:rtype: str
%End
/** Validates pyramid creation options for a specific dataset and destination format
* @note used by GDAL provider only
*/
virtual QString validatePyramidsConfigOptions( QgsRaster::RasterPyramidsFormat pyramidsFormat,
const QStringList &configOptions, const QString &fileFormat );
%Docstring
Validates pyramid creation options for a specific dataset and destination format
.. note::
used by GDAL provider only
:rtype: str
%End
static QString identifyFormatName( QgsRaster::IdentifyFormat format );
%Docstring
:rtype: str
%End
static QgsRaster::IdentifyFormat identifyFormatFromName( const QString &formatName );
%Docstring
:rtype: QgsRaster.IdentifyFormat
%End
static QString identifyFormatLabel( QgsRaster::IdentifyFormat format );
%Docstring
:rtype: str
%End
static Capability identifyFormatToCapability( QgsRaster::IdentifyFormat format );
%Docstring
:rtype: Capability
%End
//! Step width and height for raster iterations
virtual int stepWidth() const;
%Docstring
Step width for raster iterations.
.. seealso:: stepHeight()
.. versionadded:: 3.0
:rtype: int
%End
virtual int stepHeight() const;
%Docstring
Step height for raster iterations.
.. seealso:: stepWidth()
.. versionadded:: 3.0
:rtype: int
%End
signals:
/** Emit a message to be displayed on status bar, usually used by network providers (WMS,WCS)
* @note added in 2.14
*/
void statusChanged( const QString& ) const;
void statusChanged( const QString & ) const;
%Docstring
Emit a message to be displayed on status bar, usually used by network providers (WMS,WCS)
.. versionadded:: 2.14
%End
protected:
/** Read block of data
* @note not available in python bindings
*/
virtual void readBlock( int bandNo, int xBlock, int yBlock, void *data );
/** Read block of data using give extent and size
* @note not available in python bindings
*/
//virtual void readBlock( int bandNo, QgsRectangle const &viewExtent, int width, int height, void *data, QgsRasterBlockFeedback *feedback = 0 );
/** Returns true if user no data contains value */
bool userNoDataValuesContains( int bandNo, double value ) const;
%Docstring
Returns true if user no data contains value
:rtype: bool
%End
/** Copy member variables from other raster data provider. Useful for implementation of clone() method in subclasses */
void copyBaseSettings( const QgsRasterDataProvider &other );
%Docstring
Copy member variables from other raster data provider. Useful for implementation of clone() method in subclasses
%End
//! @note not available in Python bindings
//static QStringList cStringList2Q_( char * *stringList );
static QString makeTableCell( const QString &value );
%Docstring
:rtype: str
%End
static QString makeTableCells( const QStringList &values );
%Docstring
:rtype: str
%End
/** Source no data value is available and is set to be used or internal no data
* is available. Used internally only */
//bool hasNoDataValue ( int bandNo );
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterdataprovider.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,31 +1,45 @@
/** \ingroup core
* The drawing pipe for raster layers.
*/
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterdrawer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsRasterDrawer
{
%Docstring
The drawing pipe for raster layers.
%End
%TypeHeaderCode
#include <qgsrasterdrawer.h>
#include "qgsrasterdrawer.h"
%End
public:
QgsRasterDrawer( QgsRasterIterator *iterator );
/** Draws raster data.
* @param p destination QPainter
* @param viewPort viewport to render
* @param qgsMapToPixel map to pixel converter
* @param feedback optional raster feedback object for cancelation/preview. Added in QGIS 3.0.
*/
void draw( QPainter *p, QgsRasterViewPort *viewPort, const QgsMapToPixel *qgsMapToPixel, QgsRasterBlockFeedback *feedback = 0 );
%Docstring
Draws raster data.
\param p destination QPainter
\param viewPort viewport to render
\param qgsMapToPixel map to pixel converter
\param feedback optional raster feedback object for cancelation/preview. Added in QGIS 3.0.
%End
protected:
/** Draws raster part
* @param p the painter to draw to
* @param viewPort view port to draw to
* @param img image to draw
* @param topLeftCol Left position relative to left border of viewport
* @param topLeftRow Top position relative to top border of viewport
* @param mapToPixel map to device coordinate transformation info
* @note not available in python bindings
*/
//void drawImage( QPainter *p, QgsRasterViewPort *viewPort, const QImage &img, int topLeftCol, int topLeftRow ) const;
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterdrawer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,46 +1,94 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterhistogram.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsRasterHistogram
{
%Docstring
The QgsRasterHistogram is a container for histogram of a single raster band.
It is used to cache computed histograms in raster providers.
%End
%TypeHeaderCode
#include <qgsrasterhistogram.h>
#include "qgsrasterhistogram.h"
%End
public:
typedef QVector<int> HistogramVector;
QgsRasterHistogram();
/** Compares region, size etc. not histogram itself */
bool operator==( const QgsRasterHistogram &h ) const;
/** \brief The gdal band number (starts at 1)*/
int bandNumber;
%Docstring
The gdal band number (starts at 1)
%End
/** \brief Number of bins (intervals,buckets) in histogram. */
int binCount;
%Docstring
Number of bins (intervals,buckets) in histogram.
%End
/** \brief The number of non NULL cells used to calculate histogram. */
int nonNullCount;
%Docstring
The number of non NULL cells used to calculate histogram.
%End
/** \brief Whether histogram includes out of range values (in first and last bin) */
bool includeOutOfRange;
%Docstring
Whether histogram includes out of range values (in first and last bin)
%End
HistogramVector histogramVector;
%Docstring
Store the histogram for a given layer
.. note::
not available via Python binding
%End
/** \brief The maximum histogram value. */
double maximum;
%Docstring
The maximum histogram value.
%End
/** \brief The minimum histogram value. */
double minimum;
%Docstring
The minimum histogram value.
%End
/** \brief Number of columns used to calc histogram */
int width;
%Docstring
Number of columns used to calc histogram
%End
/** \brief Number of rows used to calc histogram */
int height;
%Docstring
Number of rows used to calc histogram
%End
/** \brief Extent used to calc histogram */
QgsRectangle extent;
%Docstring
Extent used to calc histogram
%End
/** \brief Histogram is valid */
bool valid;
%Docstring
Histogram is valid
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterhistogram.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,47 +1,92 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasteridentifyresult.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsRasterIdentifyResult
{
%Docstring
Raster identify results container.
%End
%TypeHeaderCode
#include <qgsrasteridentifyresult.h>
#include "qgsrasteridentifyresult.h"
%End
public:
QgsRasterIdentifyResult();
/** \brief Constructor. Creates valid result.
* @param format the result format
* @param results the results
*/
QgsRasterIdentifyResult( QgsRaster::IdentifyFormat format, const QMap<int, QVariant> &results );
%Docstring
Constructor. Creates valid result.
\param format the result format
\param results the results
%End
/** \brief Constructor. Creates invalid result with error.
* @param error the error
*/
QgsRasterIdentifyResult( const QgsError &error );
%Docstring
Constructor. Creates invalid result with error.
\param error the error
%End
virtual ~QgsRasterIdentifyResult();
/** \brief Returns true if valid */
bool isValid() const;
%Docstring
Returns true if valid
:rtype: bool
%End
/** \brief Get results format */
QgsRaster::IdentifyFormat format() const;
%Docstring
Get results format
:rtype: QgsRaster.IdentifyFormat
%End
/** \brief Get results. Results are different for each format:
* QgsRaster::IdentifyFormatValue: map of values for each band, keys are band numbers (from 1).
* QgsRaster::IdentifyFormatFeature: map of QgsRasterFeatureList for each sublayer (WMS)
* QgsRaster::IdentifyFormatHtml: map of HTML strings for each sublayer (WMS).
*/
QMap<int, QVariant> results() const;
%Docstring
Get results. Results are different for each format:
QgsRaster.IdentifyFormatValue: map of values for each band, keys are band numbers (from 1).
QgsRaster.IdentifyFormatFeature: map of QgsRasterFeatureList for each sublayer (WMS)
QgsRaster.IdentifyFormatHtml: map of HTML strings for each sublayer (WMS).
:rtype: QMap<int, QVariant>
%End
/** Set map of optional parameters */
void setParams( const QMap<QString, QVariant> &params );
%Docstring
Set map of optional parameters
%End
/** Get map of optional parameters */
QMap<QString, QVariant> params() const;
%Docstring
Get map of optional parameters
:rtype: QMap<str, QVariant>
%End
/** \brief Get error */
QgsError error() const;
%Docstring
Get error
:rtype: QgsError
%End
/** \brief Set error */
void setError( const QgsError &error );
%Docstring
Set error
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasteridentifyresult.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,49 +1,69 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterinterface.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
/** \ingroup core
* Feedback object tailored for raster block reading.
*
* @note added in QGIS 3.0
*/
class QgsRasterBlockFeedback : QgsFeedback
{
%TypeHeaderCode
#include <qgsrasterinterface.h>
%Docstring
Feedback object tailored for raster block reading.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsrasterinterface.h"
%End
public:
//! Construct a new raster block feedback object
QgsRasterBlockFeedback( QObject *parent = 0 );
%Docstring
Construct a new raster block feedback object
%End
//! May be emitted by raster data provider to indicate that some partial data are available
//! and a new preview image may be produced
virtual void onNewData();
%Docstring
and a new preview image may be produced
%End
//! Whether the raster provider should return only data that are already available
//! without waiting for full result. By default this flag is not enabled.
//! @see setPreviewOnly()
bool isPreviewOnly() const;
//! set flag whether the block request is for preview purposes only
//! @see isPreviewOnly()
%Docstring
.. seealso:: setPreviewOnly()
:rtype: bool
%End
void setPreviewOnly( bool preview );
%Docstring
.. seealso:: isPreviewOnly()
%End
//! Whether our painter is drawing to a temporary image used just by this layer
//! @see setRenderPartialOutput()
bool renderPartialOutput() const;
//! Set whether our painter is drawing to a temporary image used just by this layer
//! @see renderPartialOutput()
%Docstring
.. seealso:: setRenderPartialOutput()
:rtype: bool
%End
void setRenderPartialOutput( bool enable );
%Docstring
.. seealso:: renderPartialOutput()
%End
};
/** Base class for processing modules.
*
*/
class QgsRasterInterface
{
%Docstring
Base class for processing filters like renderers, reprojector, resampler etc.
%End
%TypeHeaderCode
#include <qgsrasterinterface.h>
#include "qgsrasterinterface.h"
// QgsRasterInterface subclasses
#include <qgsbrightnesscontrastfilter.h>
@ -64,46 +84,44 @@ class QgsRasterInterface
%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;
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;
else
sipType = sipType_QgsRasterRenderer;
}
else if (dynamic_cast<QgsRasterResampleFilter*>(sipCpp))
sipType = sipType_QgsRasterResampleFilter;
else
sipType = 0;
sipType = 0;
%End
public:
//! If you add to this, please also add to capabilitiesString()
enum Capability
{
NoCapabilities,
@ -122,151 +140,296 @@ class QgsRasterInterface
virtual ~QgsRasterInterface();
/** Clone itself, create deep copy */
virtual QgsRasterInterface *clone() const = 0 /Factory/;
%Docstring
Clone itself, create deep copy
:rtype: QgsRasterInterface
%End
/** Returns a bitmask containing the supported capabilities */
virtual int capabilities() const;
%Docstring
Returns a bitmask containing the supported capabilities
:rtype: int
%End
/**
* Returns the above in friendly format.
*/
QString capabilitiesString() const;
%Docstring
Returns the above in friendly format.
:rtype: str
%End
/** Returns data type for the band specified by number */
virtual Qgis::DataType dataType( int bandNo ) const = 0;
%Docstring
Returns data type for the band specified by number
:rtype: Qgis.DataType
%End
/** Returns source data type for the band specified by number,
* source data type may be shorter than dataType */
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 *
:rtype: Qgis.DataType
%End
/**
* Get the extent of the interface.
* @return QgsRectangle containing the extent of the layer
*/
virtual QgsRectangle extent() const;
%Docstring
Get the extent of the interface.
:return: QgsRectangle containing the extent of the layer
:rtype: QgsRectangle
%End
int dataTypeSize( int bandNo );
%Docstring
:rtype: int
%End
/** Get number of bands */
virtual int bandCount() const = 0;
%Docstring
Get number of bands
:rtype: int
%End
/** Get block size */
virtual int xBlockSize() const;
%Docstring
Get block size
:rtype: int
%End
virtual int yBlockSize() const;
%Docstring
:rtype: int
%End
/** Get raster size */
virtual int xSize() const;
%Docstring
Get raster size
:rtype: int
%End
virtual int ySize() const;
%Docstring
:rtype: int
%End
/** \brief helper function to create zero padded band names */
virtual QString generateBandName( int bandNumber ) const;
%Docstring
helper function to create zero padded band names
:rtype: str
%End
/** 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 cancelation/preview. Added in QGIS 3.0.
*/
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 cancelation/preview. Added in QGIS 3.0.
:rtype: QgsRasterBlock
%End
/** Set input.
* Returns true if set correctly, false if cannot use that input */
virtual bool setInput( QgsRasterInterface *input );
%Docstring
Set input.
Returns true if set correctly, false if cannot use that input *
:rtype: bool
%End
/** Current input */
virtual QgsRasterInterface *input() const;
%Docstring
Current input
:rtype: QgsRasterInterface
%End
/** Is on/off */
virtual bool on() const;
%Docstring
Is on/off
:rtype: bool
%End
/** Set on/off */
virtual void setOn( bool on );
%Docstring
Set on/off
%End
/** Get 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.
*/
virtual QgsRasterInterface *sourceInput();
%Docstring
Get 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.
:rtype: QgsRasterInterface
%End
/** \brief Get 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.
* @return Band statistics.
*/
virtual QgsRasterBandStats bandStatistics( int bandNo,
int stats = QgsRasterBandStats::All,
const QgsRectangle &extent = QgsRectangle(),
int sampleSize = 0, QgsRasterBlockFeedback *feedback = 0 );
%Docstring
Get 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
:return: Band statistics.
:rtype: QgsRasterBandStats
%End
virtual bool hasStatistics( int bandNo,
int stats = QgsRasterBandStats::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 bandStatistics()
:return: true if statistics are available (ready to use)
:rtype: bool
%End
virtual QgsRasterHistogram histogram( int bandNo,
int binCount,
double minimum,
double maximum,
const QgsRectangle &extent = QgsRectangle(),
int sampleSize = 0,
bool includeOutOfRange = false, QgsRasterBlockFeedback *feedback = 0 );
bool includeOutOfRange = false,
QgsRasterBlockFeedback *feedback = 0 );
%Docstring
Get 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 in Python), raster minimum value will be used.
\param maximum Maximum value, if NaN (None in 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
:rtype: QgsRasterHistogram
%End
virtual QgsRasterHistogram histogram( int bandNo,
int binCount = 0 );
%Docstring
Get 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.
.. note::
available in Python bindings only to call histogram with automatic minimum and maximum values
:rtype: QgsRasterHistogram
%End
virtual bool hasHistogram( int bandNo,
int binCount,
double minimum,
double maximum,
const QgsRectangle & extent,
int sampleSize,
bool includeOutOfRange );
const QgsRectangle &extent = QgsRectangle(),
int sampleSize = 0,
bool includeOutOfRange = false );
%Docstring
Returns true if histogram is available (cached, already calculated)
.. seealso:: histogram()
:rtype: bool
%End
virtual bool hasHistogram( int bandNo,
int binCount = 0 );
%Docstring
Returns true if histogram is available (cached, already calculated)
.. seealso:: histogram()
.. note::
available in Python bindings only to call hasHistogram with automatic minimum and maximum values
:rtype: bool
%End
/** \brief 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.
*/
virtual void cumulativeCut( int bandNo,
double lowerCount,
double upperCount,
double &lowerValue,
double &upperValue,
const QgsRectangle & extent = QgsRectangle(),
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
/** Write base class members to xml. */
virtual void writeXml( QDomDocument &doc, QDomElement &parentElem ) const;
/** Sets base class members from xml. Usually called from create() methods of subclasses */
%Docstring
Write base class members to xml.
%End
virtual void readXml( const QDomElement &filterElem );
%Docstring
Sets base class members from xml. Usually called from create() methods of subclasses
%End
protected:
/** Fill in histogram defaults if not specified
* @note binCount, minimum and maximum not optional in python bindings
*/
void initHistogram( QgsRasterHistogram &histogram, int bandNo,
int binCount /* = 0 */,
double minimum /*= std::numeric_limits<double>::quiet_NaN()*/,
double maximum /*= std::numeric_limits<double>::quiet_NaN()*/,
const QgsRectangle & boundingBox = QgsRectangle(),
void initHistogram( QgsRasterHistogram &histogram,
int bandNo,
int binCount,
double minimum,
double maximum,
const QgsRectangle &extent = QgsRectangle(),
int sampleSize = 0,
bool includeOutOfRange = false );
%Docstring
Fill in histogram defaults if not specified
.. seealso:: histogram()
%End
//! Fill in statistics defaults if not specified
void initStatistics(QgsRasterBandStats &statistics, int bandNo,
void initHistogram( QgsRasterHistogram &histogram,
int bandNo,
int binCount = 0 );
%Docstring
Fill in histogram defaults if not specified
.. seealso:: histogram()
.. note::
available in Python bindings only to call initHistogram with automatic minimum and maximum values
%End
void initStatistics( QgsRasterBandStats &statistics, int bandNo,
int stats = QgsRasterBandStats::All,
const QgsRectangle & boundingBox = QgsRectangle(),
const QgsRectangle &boundingBox = QgsRectangle(),
int binCount = 0 );
%Docstring
Fill in statistics defaults if not specified
%End
private:
QgsRasterInterface(const QgsRasterInterface &);
QgsRasterInterface &operator=(const QgsRasterInterface &);
QgsRasterInterface( const QgsRasterInterface & );
QgsRasterInterface &operator=( const QgsRasterInterface & );
%Docstring
:rtype: QgsRasterInterface
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterinterface.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,45 +1,81 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasteriterator.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsRasterIterator
{
%Docstring
Iterator for sequentially processing raster cells.
%End
%TypeHeaderCode
#include <qgsrasteriterator.h>
#include "qgsrasteriterator.h"
%End
public:
QgsRasterIterator( QgsRasterInterface *input );
/** Start reading of raster band. Raster data can then be retrieved by calling readNextRasterPart until it returns false.
@param bandNumber number of raster band to read
@param nCols number of columns
@param nRows number of rows
@param extent area to read
@param feedback optional raster feedback object for cancelation/preview. Added in QGIS 3.0.
*/
void startRasterRead( int bandNumber, int nCols, int nRows, const QgsRectangle &extent, QgsRasterBlockFeedback *feedback = 0 );
%Docstring
Start reading of raster band. Raster data can then be retrieved by calling readNextRasterPart until it returns false.
\param bandNumber number of raster band to read
\param nCols number of columns
\param nRows number of rows
\param extent area to read
\param feedback optional raster feedback object for cancelation/preview. Added in QGIS 3.0.
%End
/** Fetches next part of raster data, caller takes ownership of the block and
caller should delete the block.
@param bandNumber band to read
@param nCols number of columns on output device
@param nRows number of rows on output device
@param block address of block pointer
@param topLeftCol top left column
@param topLeftRow top left row
@return false if the last part was already returned*/
bool readNextRasterPart( int bandNumber,
int& nCols, int& nRows,
int &nCols, int &nRows,
QgsRasterBlock **block,
int &topLeftCol, int &topLeftRow );
%Docstring
Fetches next part of raster data, caller takes ownership of the block and
caller should delete the block.
\param bandNumber band to read
\param nCols number of columns on output device
\param nRows number of rows on output device
\param block address of block pointer
\param topLeftCol top left column
\param topLeftRow top left row
:return: false if the last part was already returned*
:rtype: bool
%End
void stopRasterRead( int bandNumber );
const QgsRasterInterface *input() const;
%Docstring
:rtype: QgsRasterInterface
%End
void setMaximumTileWidth( int w );
int maximumTileWidth() const;
%Docstring
:rtype: int
%End
void setMaximumTileHeight( int h );
int maximumTileHeight() const;
%Docstring
:rtype: int
%End
static const int DEFAULT_MAXIMUM_TILE_WIDTH;
static const int DEFAULT_MAXIMUM_TILE_HEIGHT;
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasteriterator.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,54 +1,185 @@
/** \class QgsRasterLayer
* \brief This class provides qgis with the ability to render raster datasets
* onto the mapcanvas..
*/
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterlayer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
typedef QList < QPair< QString, QColor > > QgsLegendColorList;
class QgsRasterLayer : QgsMapLayer
{
%TypeHeaderCode
#include <qgsrasterlayer.h>
%Docstring
This class provides qgis with the ability to render raster datasets
onto the mapcanvas.
The qgsrasterlayer class makes use of gdal for data io, and thus supports
any gdal supported format. The constructor attempts to infer what type of
file (LayerType) is being opened - not in terms of the file format (tif, ascii grid etc.)
but rather in terms of whether the image is a GRAYSCALE, PaletteD or Multiband,
Within the three allowable raster layer types, there are 8 permutations of
how a layer can actually be rendered. These are defined in the DrawingStyle enum
and consist of:
SingleBandGray -> a GRAYSCALE layer drawn as a range of gray colors (0-255)
SingleBandPseudoColor -> a GRAYSCALE layer drawn using a pseudocolor algorithm
PalettedSingleBandGray -> a PaletteD layer drawn in gray scale (using only one of the color components)
PalettedSingleBandPseudoColor -> a PaletteD layer having only one of its color components rendered as pseudo color
PalettedMultiBandColor -> a PaletteD image where the bands contains 24bit color info and 8 bits is pulled out per color
MultiBandSingleBandGray -> a layer containing 2 or more bands, but using only one band to produce a grayscale image
MultiBandSingleBandPseudoColor -> a layer containing 2 or more bands, but using only one band to produce a pseudocolor image
MultiBandColor -> a layer containing 2 or more bands, mapped to the three RGBcolors. In the case of a multiband with only two bands, one band will have to be mapped to more than one color
Each of the above mentioned drawing styles is implemented in its own draw* function.
Some of the drawing styles listed above require statistics about the layer such
as the min / max / mean / stddev etc. statistics for a band can be gathered using the
bandStatistics function. Note that statistics gathering is a slow process and
every effort should be made to call this function as few times as possible. For this
reason, qgsraster has a vector class member to store stats for each band. The
constructor initializes this vector on startup, but only populates the band name and
number fields.
Note that where bands are of gdal 'undefined' type, their values may exceed the
renderable range of 0-255. Because of this a linear scaling histogram enhanceContrast is
applied to undefined layers to normalise the data into the 0-255 range.
A qgsrasterlayer band can be referred to either by name or by number (base=1). It
should be noted that band names as stored in datafiles may not be unique, and
so the rasterlayer class appends the band number in brackets behind each band name.
Sample usage of the QgsRasterLayer class:
\code
QString myFileNameQString = "/path/to/file";
QFileInfo myFileInfo(myFileNameQString);
QString myBaseNameQString = myFileInfo.baseName();
QgsRasterLayer *myRasterLayer = new QgsRasterLayer(myFileNameQString, myBaseNameQString);
\endcode
In order to automate redrawing of a raster layer, you should like it to a map canvas like this :
\code
QObject.connect( myRasterLayer, SIGNAL(repaintRequested()), mapCanvas, SLOT(refresh()) );
\endcode
Once a layer has been created you can find out what type of layer it is (GrayOrUndefined, Palette or Multiband):
\code
if (rasterLayer->rasterType()==QgsRasterLayer.Multiband)
{
//do something
}
else if (rasterLayer->rasterType()==QgsRasterLayer.Palette)
{
//do something
}
else // QgsRasterLayer.GrayOrUndefined
{
//do something.
}
\endcode
Raster layers can also have an arbitrary level of transparency defined, and have their
color palettes inverted using the setTransparency and setInvertHistogram methods.
Pseudocolor images can have their output adjusted to a given number of standard
deviations using the setStandardDeviations method.
The final area of functionality you may be interested in is band mapping. Band mapping
allows you to choose arbitrary band -> color mappings and is applicable only to Palette
and Multiband rasters, There are four mappings that can be made: red, green, blue and gray.
Mappings are non-exclusive. That is a given band can be assigned to no, some or all
color mappings. The constructor sets sensible defaults for band mappings but these can be
overridden at run time using the setRedBandName, setGreenBandName, setBlueBandName and setGrayBandName
methods.
%End
%TypeHeaderCode
#include "qgsrasterlayer.h"
%End
public:
/** \brief Default sample size (number of pixels) for estimated statistics/histogram calculation */
static const double SAMPLE_SIZE;
%Docstring
Default sample size (number of pixels) for estimated statistics/histogram calculation
%End
static const QgsContrastEnhancement::ContrastEnhancementAlgorithm SINGLE_BAND_ENHANCEMENT_ALGORITHM;
%Docstring
Default enhancement algorithm for single band raster
%End
static const QgsContrastEnhancement::ContrastEnhancementAlgorithm MULTIPLE_BAND_SINGLE_BYTE_ENHANCEMENT_ALGORITHM;
%Docstring
Default enhancement algorithm for multiple band raster of type Byte
%End
static const QgsContrastEnhancement::ContrastEnhancementAlgorithm MULTIPLE_BAND_MULTI_BYTE_ENHANCEMENT_ALGORITHM;
%Docstring
Default enhancement algorithm for multiple band raster of type different from Byte
%End
static const QgsRasterMinMaxOrigin::Limits SINGLE_BAND_MIN_MAX_LIMITS;
%Docstring
Default enhancement limits for single band raster
%End
static const QgsRasterMinMaxOrigin::Limits MULTIPLE_BAND_SINGLE_BYTE_MIN_MAX_LIMITS;
%Docstring
Default enhancement limits for multiple band raster of type Byte
%End
static const QgsRasterMinMaxOrigin::Limits MULTIPLE_BAND_MULTI_BYTE_MIN_MAX_LIMITS;
%Docstring
Default enhancement limits for multiple band raster of type different from Byte
%End
/** \brief Constructor. Provider is not set. */
QgsRasterLayer();
%Docstring
Constructor. Provider is not set.
%End
/** \brief This is the constructor for the RasterLayer class.
*
* The main tasks carried out by the constructor are:
*
* -Load the rasters default style (.qml) file if it exists
*
* -Populate the RasterStatsVector with initial values for each band.
*
* -Calculate the layer extents
*
* -Determine whether the layer is gray, paletted or multiband.
*
* -Assign sensible defaults for the red, green, blue and gray bands.
*
* -
* */
QgsRasterLayer( const QString &uri,
const QString &baseName = QString(),
const QString &providerKey = "gdal",
bool loadDefaultStyleFlag = true );
%Docstring
This is the constructor for the RasterLayer class.
The main tasks carried out by the constructor are:
-Load the rasters default style (.qml) file if it exists
-Populate the RasterStatsVector with initial values for each band.
-Calculate the layer extents
-Determine whether the layer is gray, paletted or multiband.
-Assign sensible defaults for the red, green, blue and gray bands.
-
*
%End
/** \brief The destructor */
~QgsRasterLayer();
/** Returns a new instance equivalent to this one. A new provider is
* created for the same data source and renderer is cloned too.
* \returns a new layer instance
* \since QGIS 3.0
*/
virtual QgsRasterLayer *clone() const /Factory/;
%Docstring
Returns a new instance equivalent to this one. A new provider is
created for the same data source and renderer is cloned too.
:return: a new layer instance
.. versionadded:: 3.0
:rtype: QgsRasterLayer
%End
/** \brief This enumerator describes the types of shading that can be used */
enum ColorShadingAlgorithm
{
UndefinedShader,
@ -58,7 +189,6 @@ class QgsRasterLayer : QgsMapLayer
UserDefinedShader
};
/** \brief This enumerator describes the type of raster layer */
enum LayerType
{
GrayOrUndefined,
@ -67,155 +197,265 @@ class QgsRasterLayer : QgsMapLayer
ColorLayer
};
/** This helper checks to see whether the file name appears to be a valid
* raster file name. If the file name looks like it could be valid,
* but some sort of error occurs in processing the file, the error is
* returned in retError.
*/
static bool isValidRasterFileName( const QString &fileNameQString, QString &retError );
%Docstring
This helper checks to see whether the file name appears to be a valid
raster file name. If the file name looks like it could be valid,
but some sort of error occurs in processing the file, the error is
returned in retError.
:rtype: bool
%End
static bool isValidRasterFileName( const QString &fileNameQString );
%Docstring
:rtype: bool
%End
/** Return time stamp for given file name */
static QDateTime lastModified( const QString & name );
static QDateTime lastModified( const QString &name );
%Docstring
Return time stamp for given file name
:rtype: QDateTime
%End
/** [ data provider interface ] Set the data provider */
void setDataProvider( const QString &provider );
%Docstring
[ data provider interface ] Set the data provider
%End
/** \brief Accessor for raster layer type (which is a read only property) */
LayerType rasterType();
%Docstring
Accessor for raster layer type (which is a read only property)
:rtype: LayerType
%End
/** Set raster renderer. Takes ownership of the renderer object*/
void setRenderer( QgsRasterRenderer *renderer /Transfer/ );
%Docstring
Set raster renderer. Takes ownership of the renderer object
%End
QgsRasterRenderer *renderer() const;
%Docstring
:rtype: QgsRasterRenderer
%End
/** Set raster resample filter. Takes ownership of the resample filter object*/
QgsRasterResampleFilter *resampleFilter() const;
%Docstring
Set raster resample filter. Takes ownership of the resample filter object
:rtype: QgsRasterResampleFilter
%End
QgsBrightnessContrastFilter *brightnessFilter() const;
%Docstring
:rtype: QgsBrightnessContrastFilter
%End
QgsHueSaturationFilter *hueSaturationFilter() const;
%Docstring
:rtype: QgsHueSaturationFilter
%End
/** Get raster pipe */
QgsRasterPipe *pipe();
%Docstring
Get raster pipe
:rtype: QgsRasterPipe
%End
/** \brief Accessor that returns the width of the (unclipped) raster */
int width() const;
%Docstring
Accessor that returns the width of the (unclipped) raster
:rtype: int
%End
/** \brief Accessor that returns the height of the (unclipped) raster */
int height() const;
%Docstring
Accessor that returns the height of the (unclipped) raster
:rtype: int
%End
/** \brief Get the number of bands in this layer */
int bandCount() const;
%Docstring
Get the number of bands in this layer
:rtype: int
%End
/** \brief Get the name of a band given its number */
QString bandName( int bandNoInt ) const;
%Docstring
Get the name of a band given its number
:rtype: str
%End
/** Returns the data provider */
virtual QgsRasterDataProvider *dataProvider();
/** Returns the data provider in a const-correct manner
@note available in python bindings as constDataProvider()
*/
virtual const QgsRasterDataProvider *dataProvider() const /PyName=constDataProvider/;
/** Synchronises with changes in the datasource */
%Docstring
Returns the data provider in a const-correct manner
.. note::
available in Python bindings as constDataProvider()
:rtype: QgsRasterDataProvider
%End
virtual void reload();
%Docstring
Synchronises with changes in the datasource
%End
/** Return new instance of QgsMapLayerRenderer that will be used for rendering of given context
* @note added in 2.4
*/
virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) /Factory/;
%Docstring
Return new instance of QgsMapLayerRenderer that will be used for rendering of given context
.. versionadded:: 2.4
:rtype: QgsMapLayerRenderer
%End
/** \brief This is an overloaded version of the draw() function that is called by both draw() and thumbnailAsPixmap */
void draw( QPainter * theQPainter,
QgsRasterViewPort * myRasterViewPort,
void draw( QPainter *theQPainter,
QgsRasterViewPort *myRasterViewPort,
const QgsMapToPixel *qgsMapToPixel = 0 );
%Docstring
This is an overloaded version of the draw() function that is called by both draw() and thumbnailAsPixmap
%End
/** Returns a list with classification items (Text and color) */
QList< QPair< QString, QColor > > legendSymbologyItems() const;
QgsLegendColorList legendSymbologyItems() const;
%Docstring
Returns a list with classification items (Text and color)
:rtype: QgsLegendColorList
%End
virtual bool isSpatial() const;
QString htmlMetadata() const;
virtual QString htmlMetadata() const;
/** \brief Get an 100x100 pixmap of the color palette. If the layer has no palette a white pixmap will be returned */
QPixmap paletteAsPixmap( int bandNumber = 1 );
%Docstring
Get an 100x100 pixmap of the color palette. If the layer has no palette a white pixmap will be returned
:rtype: QPixmap
%End
/** \brief [ data provider interface ] Which provider is being used for this Raster Layer? */
QString providerType() const;
%Docstring
[ data provider interface ] Which provider is being used for this Raster Layer?
:rtype: str
%End
/** \brief Returns the number of raster units per each raster pixel. In a world file, this is normally the first row (without the sign) */
double rasterUnitsPerPixelX();
double rasterUnitsPerPixelY();
double rasterUnitsPerPixelX() const;
%Docstring
Returns the number of raster units per each raster pixel in X axis. In a world file, this is normally the first row (without the sign)
:rtype: float
%End
double rasterUnitsPerPixelY() const;
%Docstring
Returns the number of raster units per each raster pixel in Y axis. In a world file, this is normally the first row (without the sign)
:rtype: float
%End
/** \brief Set contrast enhancement algorithm
* @param algorithm Contrast enhancement algorithm
* @param limits Limits
* @param extent Extent used to calculate limits, if empty, use full layer extent
* @param sampleSize Size of data sample to calculate limits, if 0, use full resolution
* @param generateLookupTableFlag Generate lookup table. */
void setContrastEnhancement( QgsContrastEnhancement::ContrastEnhancementAlgorithm algorithm,
QgsRasterMinMaxOrigin::Limits limits = QgsRasterMinMaxOrigin::MinMax,
const QgsRectangle& extent = QgsRectangle(),
const QgsRectangle &extent = QgsRectangle(),
int sampleSize = QgsRasterLayer::SAMPLE_SIZE,
bool generateLookupTableFlag = true );
%Docstring
Set contrast enhancement algorithm
\param algorithm Contrast enhancement algorithm
\param limits Limits
\param extent Extent used to calculate limits, if empty, use full layer extent
\param sampleSize Size of data sample to calculate limits, if 0, use full resolution
\param generateLookupTableFlag Generate lookup table. *
%End
/** \brief Set default contrast enhancement */
void setDefaultContrastEnhancement();
%Docstring
Set default contrast enhancement
:rtype: bool
%End
/** \brief Returns the sublayers of this layer - Useful for providers that manage their own layers, such as WMS */
virtual QStringList subLayers() const;
%Docstring
Returns the sublayers of this layer - Useful for providers that manage their own layers, such as WMS
:rtype: list of str
%End
/** \brief Draws a preview of the rasterlayer into a QImage
@note added in 2.4 */
QImage previewAsImage( QSize size, const QColor& bgColor = QColor( 255, 255, 255 ),
QImage previewAsImage( QSize size, const QColor &bgColor = Qt::white,
QImage::Format format = QImage::Format_ARGB32_Premultiplied );
%Docstring
Draws a preview of the rasterlayer into a QImage
.. versionadded:: 2.4
:rtype: QImage
%End
/**
* Reorders the *previously selected* sublayers of this layer from bottom to top
*
* (Useful for providers that manage their own layers, such as WMS)
*
*/
virtual void setLayerOrder( const QStringList &layers );
%Docstring
Reorders the *previously selected* sublayers of this layer from bottom to top
(Useful for providers that manage their own layers, such as WMS)
%End
/**
* Set the visibility of the given sublayer name
*/
virtual void setSubLayerVisibility( const QString &name, bool vis );
%Docstring
Set the visibility of the given sublayer name
%End
/** Time stamp of data source in the moment when data/metadata were loaded by provider */
virtual QDateTime timestamp() const;
%Docstring
Time stamp of data source in the moment when data/metadata were loaded by provider
:rtype: QDateTime
%End
public slots:
void showStatusMessage( const QString &message );
signals:
/**
* This is emitted whenever data or metadata (e.g. color table, extent) has changed
*/
void dataChanged();
protected:
/** \brief Read the symbology for the current layer from the Dom node supplied */
bool readSymbology( const QDomNode& node, QString& errorMessage, const QgsReadWriteContext &context );
virtual bool readSymbology( const QDomNode &node, QString &errorMessage, const QgsReadWriteContext &context );
/** \brief Read the style information for the current layer from the Dom node supplied */
bool readStyle(const QDomNode &node, QString &errorMessage, const QgsReadWriteContext &context );
%Docstring
Read the symbology for the current layer from the Dom node supplied
:rtype: bool
%End
/** \brief Reads layer specific state from project file Dom node */
bool readXml( const QDomNode& layer_node, const QgsReadWriteContext &context );
virtual bool readStyle( const QDomNode &node, QString &errorMessage, const QgsReadWriteContext &context );
/** \brief Write the symbology for the layer into the docment provided */
bool writeSymbology( QDomNode&, QDomDocument& doc, QString& errorMessage, const QgsReadWriteContext &context ) const;
%Docstring
Read the style information for the current layer from the Dom node supplied
:rtype: bool
%End
/** \brief Write the style for the layer into the docment provided */
bool writeStyle(QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const;
virtual bool readXml( const QDomNode &layer_node, const QgsReadWriteContext &context );
%Docstring
Reads layer specific state from project file Dom node
:rtype: bool
%End
virtual bool writeSymbology( QDomNode &, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const;
%Docstring
Write the symbology for the layer into the docment provided
:rtype: bool
%End
virtual bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const;
%Docstring
Write the style for the layer into the docment provided
:rtype: bool
%End
virtual bool writeXml( QDomNode &layer_node, QDomDocument &doc, const QgsReadWriteContext &context ) const;
%Docstring
Write layer specific state to project file Dom node
:rtype: bool
%End
/** \brief Write layer specific state to project file Dom node */
bool writeXml( QDomNode & layer_node, QDomDocument & doc, const QgsReadWriteContext &context ) const;
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterlayer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,127 +1,205 @@
/** \class QgsRasterMinMaxOrigin
* This class describes the origin of min/max values. It does not store by
* itself the min/max values.
*/
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterminmaxorigin.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsRasterMinMaxOrigin
{
%Docstring
This class describes the origin of min/max values. It does not store by
itself the min/max values.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include <qgsrasterminmaxorigin.h>
#include "qgsrasterminmaxorigin.h"
%End
public:
//! \brief Default cumulative cut lower limit
static const double CUMULATIVE_CUT_LOWER;
%Docstring
Default cumulative cut lower limit
%End
//! \brief Default cumulative cut upper limit
static const double CUMULATIVE_CUT_UPPER;
%Docstring
Default cumulative cut upper limit
%End
//! \brief Default standard deviation factor
static const double DEFAULT_STDDEV_FACTOR;
%Docstring
Default standard deviation factor
%End
//! \brief This enumerator describes the limits used to compute min/max values
enum Limits
{
//! User defined.
None /PyName=None_/,
//! Real min-max values
//! User
None
//! Real
MinMax,
//! Range is [ mean - stdDevFactor() * stddev, mean + stdDevFactor() * stddev ]
//! Range
StdDev,
//! Range is [ min + cumulativeCutLower() * (max - min), min + cumulativeCutUpper() * (max - min) ]
//! Range
CumulativeCut
};
//! \brief This enumerator describes the extent used to compute min/max values
enum Extent
{
//! Whole raster is used to compute statistics.
WholeRaster,
//! Current extent of the canvas (at the time of computation) is used to compute statistics.
CurrentCanvas,
//! Constantly updated extent of the canvas is used to compute statistics.
UpdatedCanvas
//! Whole
WholeRaster,
//! Current
CurrentCanvas,
//! Constantly
UpdatedCanvas
};
//! \brief This enumerator describes the accuracy used to compute statistics.
enum StatAccuracy
{
//! Exact statistics.
Exact,
//! Approximated statistics.
Estimated
//! Exact
Exact,
//! Approximated
Estimated
};
//! \brief Default constructor.
QgsRasterMinMaxOrigin();
%Docstring
Default constructor.
%End
//! \brief Equality operator.
bool operator ==( const QgsRasterMinMaxOrigin &other ) const;
%Docstring
Equality operator.
%End
//////// Getter methods /////////////////////
//! \brief Return limits.
QgsRasterMinMaxOrigin::Limits limits() const;
Limits limits() const;
%Docstring
Return limits.
:rtype: Limits
%End
//! \brief Return extent.
QgsRasterMinMaxOrigin::Extent extent() const;
Extent extent() const;
%Docstring
Return extent.
:rtype: Extent
%End
//! \brief Return statistic accuracy.
QgsRasterMinMaxOrigin::StatAccuracy statAccuracy() const;
StatAccuracy statAccuracy() const;
%Docstring
Return statistic accuracy.
:rtype: StatAccuracy
%End
//! \brief Return lower bound of cumulative cut method (between 0 and 1).
double cumulativeCutLower() const;
%Docstring
Return lower bound of cumulative cut method (between 0 and 1).
:rtype: float
%End
//! \brief Return upper bound of cumulative cut method (between 0 and 1).
double cumulativeCutUpper() const;
%Docstring
Return upper bound of cumulative cut method (between 0 and 1).
:rtype: float
%End
//! \brief Return factor f so that the min/max range is [ mean - f * stddev , mean + f * stddev ]
double stdDevFactor() const;
%Docstring
Return factor f so that the min/max range is [ mean - f * stddev , mean + f * stddev ]
:rtype: float
%End
//////// Setter methods /////////////////////
//! \brief Set limits.
void setLimits(QgsRasterMinMaxOrigin::Limits limits);
void setLimits( Limits limits );
%Docstring
Set limits.
%End
//! \brief Set extent.
void setExtent(QgsRasterMinMaxOrigin::Extent extent);
void setExtent( Extent extent );
%Docstring
Set extent.
%End
//! \brief Set statistics accuracy.
void setStatAccuracy(QgsRasterMinMaxOrigin::StatAccuracy accuracy);
void setStatAccuracy( StatAccuracy accuracy );
%Docstring
Set statistics accuracy.
%End
//! \brief Set lower bound of cumulative cut method (between 0 and 1).
void setCumulativeCutLower(double val);
void setCumulativeCutLower( double val );
%Docstring
Set lower bound of cumulative cut method (between 0 and 1).
%End
//! \brief Set upper bound of cumulative cut method (between 0 and 1).
void setCumulativeCutUpper(double val);
void setCumulativeCutUpper( double val );
%Docstring
Set upper bound of cumulative cut method (between 0 and 1).
%End
//! \brief Set factor f so that the min/max range is [ mean - f * stddev , mean + f * stddev ]
void setStdDevFactor(double val);
void setStdDevFactor( double val );
%Docstring
Set factor f so that the min/max range is [ mean - f * stddev , mean + f * stddev ]
%End
//////// XML serialization /////////////////////
//! \brief Serialize object.
void writeXml( QDomDocument &doc, QDomElement &parentElem ) const;
%Docstring
Serialize object.
%End
//! \brief Deserialize object.
void readXml( const QDomElement &elem );
%Docstring
Deserialize object.
%End
//////// Static methods /////////////////////
//! \brief Return a string to serialize Limits
static QString limitsString( QgsRasterMinMaxOrigin::Limits limits );
static QString limitsString( Limits limits );
%Docstring
Return a string to serialize Limits
:rtype: str
%End
//! \brief Deserialize Limits
static QgsRasterMinMaxOrigin::Limits limitsFromString( const QString &limits );
static Limits limitsFromString( const QString &limits );
%Docstring
Deserialize Limits
:rtype: Limits
%End
//! \brief Return a string to serialize Extent
static QString extentString( QgsRasterMinMaxOrigin::Extent extent );
static QString extentString( Extent extent );
%Docstring
Return a string to serialize Extent
:rtype: str
%End
//! \brief Deserialize Extent
static QgsRasterMinMaxOrigin::Extent extentFromString( const QString &extent );
static Extent extentFromString( const QString &extent );
%Docstring
Deserialize Extent
:rtype: Extent
%End
//! \brief Return a string to serialize StatAccuracy
static QString statAccuracyString( QgsRasterMinMaxOrigin::StatAccuracy accuracy );
static QString statAccuracyString( StatAccuracy accuracy );
%Docstring
Return a string to serialize StatAccuracy
:rtype: str
%End
static StatAccuracy statAccuracyFromString( const QString &accuracy );
%Docstring
Deserialize StatAccuracy
:rtype: StatAccuracy
%End
//! \brief Deserialize StatAccuracy
static QgsRasterMinMaxOrigin::StatAccuracy statAccuracyFromString( const QString &accuracy );
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterminmaxorigin.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -1,11 +1,26 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasternuller.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsRasterNuller : QgsRasterInterface
{
%Docstring
Raster pipe that deals with null values.
%End
%TypeHeaderCode
#include <qgsrasternuller.h>
#include "qgsrasternuller.h"
%End
public:
QgsRasterNuller( QgsRasterInterface *input = 0 );
~QgsRasterNuller();
struct NoData
{
@ -15,16 +30,34 @@ class QgsRasterNuller : QgsRasterInterface
virtual QgsRasterNuller *clone() const /Factory/;
int bandCount() const;
Qgis::DataType dataType( int bandNo ) const;
virtual int bandCount() const;
virtual Qgis::DataType dataType( int bandNo ) const;
virtual QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = 0 );
QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = 0 ) / Factory /;
void setNoData( int bandNo, const QgsRasterRangeList &noData );
QgsRasterRangeList noData( int bandNo ) const;
%Docstring
:rtype: QgsRasterRangeList
%End
/** \brief Set output no data value. */
void setOutputNoDataValue( int bandNo, double noData );
%Docstring
Set output no data value.
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasternuller.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

View File

@ -164,6 +164,7 @@ sub remove_following_body_or_initializerlist {
sub fix_annotations(){
# printed annotations
$LINE =~ s/\bSIP_ABSTRACT\b/\/Abstract\//;
$LINE =~ s/\bSIP_ALLOWNONE\b/\/AllowNone\//;
$LINE =~ s/\bSIP_ARRAY\b/\/Array\//g;
$LINE =~ s/\bSIP_ARRAYSIZE\b/\/ArraySize\//g;
$LINE =~ s/\bSIP_DEPRECATED\b/\/Deprecated\//g;
@ -190,7 +191,7 @@ sub fix_annotations(){
};
# unprinted annotations
$LINE =~ s/(\w+)(\<(?>[^<>]|(?2))*\>)?\s+SIP_PYTYPE\(\s*\'?([^()']+)(\(\s*(?:[^()]++|(?2))*\s*\))?\'?\s*\)/$3/g;
$LINE =~ s/(\w+)(\<(?>[^<>]|(?2))*\>)?\s+SIP_PYALTERNATIVETYPE\(\s*\'?([^()']+)(\(\s*(?:[^()]++|(?2))*\s*\))?\'?\s*\)/$3/g;
$LINE =~ s/=\s+[^=]*?\s+SIP_PYARGDEFAULT\(\s*\'?([^()']+)(\(\s*(?:[^()]++|(?2))*\s*\))?\'?\s*\)/= $1/g;
# remove argument
if ($LINE =~ m/SIP_PYARGREMOVE/){
@ -628,7 +629,7 @@ while ($LINE_IDX < $LINE_COUNT){
# remove static const value assignment
# https://regex101.com/r/DyWkgn/4
$LINE !~ m/^\s*const static \w+/ or die "const static should be written static const in $CLASSNAME[$#CLASSNAME] at line $LINE_IDX";
$LINE =~ s/^(\s*static const \w+(?:<(?:[\w()<>, ]|::)+>)? \w+) = .*([|;])\s*(\/\/.*)?$/$1;/;
$LINE =~ s/^(\s*static const(?:expr)? \w+(?:<(?:[\w()<>, ]|::)+>)? \w+) = .*([|;])\s*(\/\/.*)?$/$1;/;
if ( defined $2 && $2 =~ m/\|/ ){
dbg_info("multiline const static assignment");
my $skip = '';
@ -691,6 +692,7 @@ while ($LINE_IDX < $LINE_COUNT){
$LINE =~ s/^(\s*template<)(?:class|typename) (\w+>)(.*)$/$1$2$3/;
$LINE =~ s/\s*\boverride\b//;
$LINE =~ s/^(\s*)?(const )?(virtual |static )?inline /$1$2$3/;
$LINE =~ s/\bconstexpr\b/const/;
$LINE =~ s/\bnullptr\b/0/g;
$LINE =~ s/\s*=\s*default\b//g;

View File

@ -40,7 +40,7 @@ class ANALYSIS_EXPORT QgsGraphAnalyzer
* \param resultTree array that represents shortest path tree. resultTree[ vertexIndex ] == inboundingArcIndex if vertex reachable, otherwise resultTree[ vertexIndex ] == -1
* \param resultCost array of the paths costs
*/
static void SIP_PYTYPE( SIP_PYLIST ) dijkstra( const QgsGraph *source, int startVertexIdx, int criterionNum, QVector<int> *resultTree = nullptr, QVector<double> *resultCost = nullptr );
static void SIP_PYALTERNATIVETYPE( SIP_PYLIST ) dijkstra( const QgsGraph *source, int startVertexIdx, int criterionNum, QVector<int> *resultTree = nullptr, QVector<double> *resultCost = nullptr );
#ifdef SIP_RUN
% MethodCode

View File

@ -178,7 +178,7 @@ class CORE_EXPORT QgsGeometryUtils
* \since 3.0
*/
static void segmentizeArc( const QgsPointV2 &p1, const QgsPointV2 &p2, const QgsPointV2 &p3,
QgsPointSequence SIP_PYTYPE( QList<QgsPointV2> ) &points SIP_OUT, double tolerance = M_PI_2 / 90,
QgsPointSequence SIP_PYALTERNATIVETYPE( QList<QgsPointV2> ) &points SIP_OUT, double tolerance = M_PI_2 / 90,
QgsAbstractGeometry::SegmentationToleranceType toleranceType = QgsAbstractGeometry::MaximumAngle,
bool hasZ = false, bool hasM = false );

View File

@ -96,6 +96,11 @@
*/
#define SIP_EXTERNAL
/*
* http://pyqt.sourceforge.net/Docs/sip4/annotations.html?highlight=allownone
*/
#define SIP_ALLOWNONE
/*
* discard line
*/
@ -109,7 +114,7 @@
/*
* specify an alternative type for SIP argument or return value
*/
#define SIP_PYTYPE(type)
#define SIP_PYALTERNATIVETYPE(type)
/*
* specify an alternative default value for SIP argument

View File

@ -103,7 +103,7 @@ class CORE_EXPORT QgsSpatialIndex
/* debugging */
//! get reference count - just for debugging!
QAtomicInt SIP_PYTYPE( int ) refs() const;
QAtomicInt SIP_PYALTERNATIVETYPE( int ) refs() const;
private:

View File

@ -449,7 +449,7 @@ class CORE_EXPORT QgsRasterBlock
QgsError mError;
};
inline double QgsRasterBlock::readValue( void *data, Qgis::DataType type, qgssize index )
inline double QgsRasterBlock::readValue( void *data, Qgis::DataType type, qgssize index ) SIP_SKIP
{
if ( !data )
{
@ -487,7 +487,7 @@ inline double QgsRasterBlock::readValue( void *data, Qgis::DataType type, qgssiz
return std::numeric_limits<double>::quiet_NaN();
}
inline void QgsRasterBlock::writeValue( void *data, Qgis::DataType type, qgssize index, double value )
inline void QgsRasterBlock::writeValue( void *data, Qgis::DataType type, qgssize index, double value ) SIP_SKIP
{
if ( !data ) return;
@ -520,7 +520,7 @@ inline void QgsRasterBlock::writeValue( void *data, Qgis::DataType type, qgssize
}
}
inline double QgsRasterBlock::value( qgssize index ) const
inline double QgsRasterBlock::value( qgssize index ) const SIP_SKIP
{
if ( !mData )
{
@ -530,7 +530,7 @@ inline double QgsRasterBlock::value( qgssize index ) const
return readValue( mData, mDataType, index );
}
inline bool QgsRasterBlock::isNoDataValue( double value ) const
inline bool QgsRasterBlock::isNoDataValue( double value ) const SIP_SKIP
{
return qIsNaN( value ) || qgsDoubleNear( value, mNoDataValue );
}

View File

@ -20,6 +20,7 @@
#include "qgis_core.h"
#include "qgis.h"
#include "qgis_sip.h"
#include <limits>
#include <QCoreApplication> // for tr()
@ -75,6 +76,7 @@ class CORE_EXPORT QgsRasterBlockFeedback : public QgsFeedback
* Base class for processing filters like renderers, reprojector, resampler etc.
*/
class CORE_EXPORT QgsRasterInterface
{
#ifdef SIP_RUN
// QgsRasterInterface subclasses
#include <qgsbrightnesscontrastfilter.h>
@ -93,7 +95,7 @@ class CORE_EXPORT QgsRasterInterface
#include <qgssinglebandgrayrenderer.h>
#include <qgssinglebandpseudocolorrenderer.h>
#endif
{
#ifdef SIP_RUN
SIP_CONVERT_TO_SUBCLASS_CODE
@ -231,8 +233,9 @@ class CORE_EXPORT QgsRasterInterface
/** Get 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.
* \note not available in Python bindings.
*/
virtual const QgsRasterInterface *sourceInput() const
virtual const QgsRasterInterface *sourceInput() const SIP_SKIP
{
QgsDebugMsgLevel( "Entered", 4 );
return mInput ? mInput->sourceInput() : this;
@ -269,11 +272,12 @@ class CORE_EXPORT QgsRasterInterface
const QgsRectangle &extent = QgsRectangle(),
int sampleSize = 0 );
/** \brief Get 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, raster minimum value will be used.
* \param maximum Maximum value, if NaN, raster minimum value will be used.
* \param minimum Minimum value, if NaN (None in Python), raster minimum value will be used.
* \param maximum Maximum value, if NaN (None in 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
@ -281,24 +285,63 @@ class CORE_EXPORT QgsRasterInterface
* \returns Vector of non NULL cell counts for each bin.
* \note binCount, minimum and maximum not optional in Python bindings
*/
#ifndef SIP_RUN
virtual QgsRasterHistogram histogram( int bandNo,
int binCount = 0,
double minimum = std::numeric_limits<double>::quiet_NaN(),
double maximum = std::numeric_limits<double>::quiet_NaN(),
const QgsRectangle &extent = QgsRectangle(),
int sampleSize = 0,
bool includeOutOfRange = false, QgsRasterBlockFeedback *feedback = nullptr );
bool includeOutOfRange = false,
QgsRasterBlockFeedback *feedback = nullptr );
#else
virtual QgsRasterHistogram histogram( int bandNo,
int binCount,
double minimum,
double maximum,
const QgsRectangle &extent = QgsRectangle(),
int sampleSize = 0,
bool includeOutOfRange = false,
QgsRasterBlockFeedback *feedback = nullptr );
/** \brief Returns true if histogram is available (cached, already calculated), the parameters are the same as in histogram()
* \note binCount, minimum and maximum not optional in Python bindings
/** \brief Get 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.
* \note available in Python bindings only to call histogram with automatic minimum and maximum values
*/
virtual QgsRasterHistogram histogram( int bandNo,
int binCount = 0 );
#endif
/** \brief Returns true if histogram is available (cached, already calculated)
* \note the parameters are the same as in \see histogram()
*/
#ifndef SIP_RUN
virtual bool hasHistogram( int bandNo,
int binCount,
int binCount = 0,
double minimum = std::numeric_limits<double>::quiet_NaN(),
double maximum = std::numeric_limits<double>::quiet_NaN(),
const QgsRectangle &extent = QgsRectangle(),
int sampleSize = 0,
bool includeOutOfRange = false );
#else
virtual bool hasHistogram( int bandNo,
int binCount,
double minimum,
double maximum,
const QgsRectangle &extent = QgsRectangle(),
int sampleSize = 0,
bool includeOutOfRange = false );
/** \brief Returns true if histogram is available (cached, already calculated)
* \note the parameters are the same as in \see histogram()
* \note available in Python bindings only to call hasHistogram with automatic minimum and maximum values
*/
virtual bool hasHistogram( int bandNo,
int binCount = 0 );
#endif
/** \brief Find values for cumulative pixel count cut.
* \param bandNo The band (number).
@ -327,24 +370,46 @@ class CORE_EXPORT QgsRasterInterface
QgsRasterInterface *mInput = nullptr;
//! \brief List of cached statistics, all bands mixed
QList <QgsRasterBandStats> mStatistics;
QList<QgsRasterBandStats> mStatistics;
//! \brief List of cached histograms, all bands mixed
QList <QgsRasterHistogram> mHistograms;
QList<QgsRasterHistogram> mHistograms;
// On/off state, if off, it does not do anything, replicates input
bool mOn;
/** Fill in histogram defaults if not specified
* \note binCount, minimum and maximum not optional in Python bindings
* \note the parameters are the same as in \see histogram()
*/
void initHistogram( QgsRasterHistogram &histogram, int bandNo,
#ifndef SIP_RUN
void initHistogram( QgsRasterHistogram &histogram,
int bandNo,
int binCount = 0,
double minimum = std::numeric_limits<double>::quiet_NaN(),
double maximum = std::numeric_limits<double>::quiet_NaN(),
const QgsRectangle &boundingBox = QgsRectangle(),
int sampleSize = 0,
bool includeOutOfRange = false );
#else
void initHistogram( QgsRasterHistogram &histogram,
int bandNo,
int binCount,
double minimum,
double maximum,
const QgsRectangle &extent = QgsRectangle(),
int sampleSize = 0,
bool includeOutOfRange = false );
/** \brief Fill in histogram defaults if not specified
* \note the parameters are the same as in \see histogram()
* \note available in Python bindings only to call initHistogram with automatic minimum and maximum values
*/
void initHistogram( QgsRasterHistogram &histogram,
int bandNo,
int binCount = 0 );
#endif
//! Fill in statistics defaults if not specified
void initStatistics( QgsRasterBandStats &statistics, int bandNo,
@ -353,6 +418,11 @@ class CORE_EXPORT QgsRasterInterface
int binCount = 0 );
private:
#ifdef SIP_RUN
QgsRasterInterface( const QgsRasterInterface & );
QgsRasterInterface &operator=( const QgsRasterInterface & );
#endif
Q_DISABLE_COPY( QgsRasterInterface ) // there is clone() for copying
};

View File

@ -305,7 +305,7 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
void setContrastEnhancement( QgsContrastEnhancement::ContrastEnhancementAlgorithm algorithm,
QgsRasterMinMaxOrigin::Limits limits = QgsRasterMinMaxOrigin::MinMax,
const QgsRectangle &extent = QgsRectangle(),
int sampleSize = SAMPLE_SIZE,
int sampleSize = QgsRasterLayer::SAMPLE_SIZE,
bool generateLookupTableFlag = true );
/** \brief Refresh contrast enhancement with new extent.

View File

@ -31,6 +31,7 @@
*/
class CORE_EXPORT QgsRasterMinMaxOrigin
{
public:
//! \brief Default cumulative cut lower limit

View File

@ -50,10 +50,10 @@ typedef qint64 QgsFeatureId;
typedef WhatEver ShouldNotBeDisplayed;
#endif
typedef QSet<QgsFeatureId SIP_PYTYPE( qint64 )> QgsFeatureIds;
typedef QMap<QgsFeatureId SIP_PYTYPE( qint64 ), QgsAttributeMap SIP_PYTYPE( 'QMap<int, QVariant>' )> QgsChangedAttributesMap;
typedef QMap<QgsFeatureId, QgsAttributeMap> SIP_PYTYPE( 'QMap<qint64, QMap<int, QVariant> >' ) QgsChangedAttributesMap;
typedef QMap<QgsFeatureId, QPair<QMap<Something, Complex> >> SIP_PYTYPE( 'QMap<qint64, QMap<int, QVariant>>' ) QgsChangedAttributesMap;
typedef QSet<QgsFeatureId SIP_PYALTERNATIVETYPE( qint64 )> QgsFeatureIds;
typedef QMap<QgsFeatureId SIP_PYALTERNATIVETYPE( qint64 ), QgsAttributeMap SIP_PYALTERNATIVETYPE( 'QMap<int, QVariant>' )> QgsChangedAttributesMap;
typedef QMap<QgsFeatureId, QgsAttributeMap> SIP_PYALTERNATIVETYPE( 'QMap<qint64, QMap<int, QVariant> >' ) QgsChangedAttributesMap;
typedef QMap<QgsFeatureId, QPair<QMap<Something, Complex> >> SIP_PYALTERNATIVETYPE( 'QMap<qint64, QMap<int, QVariant>>' ) QgsChangedAttributesMap;
/** \ingroup core
* A super QGIS class
@ -227,10 +227,10 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private Ui::QgsBas
void differentDefaultValue( bool defaultValue = true SIP_PYARGDEFAULT( false ), QWidget *parent = nullptr, QString msg = QString() SIP_PYARGDEFAULT( "hello" ) );
void differentType( QList<QgsFeatureId> SIP_PYTYPE( QList<qint64> ) & list );
void differentType( QList<QgsFeatureId> SIP_PYALTERNATIVETYPE( QList<qint64> ) & list );
//! complex default value and type (i.e. containing commas) should be given as a string with single quotes
void complexDefaultValueAndType( QList<QPair<QgsFeatureId SIP_PYTYPE( qint64 ), QMap<int, QString>>> list = QList<QPair<QgsFeatureId, QMap<int, QString>>>() SIP_PYARGDEFAULT( 'QList<QPair<qint64, QMap<int, QString>>>()' ) );
void complexDefaultValueAndType( QList<QPair<QgsFeatureId SIP_PYALTERNATIVETYPE( qint64 ), QMap<int, QString>>> list = QList<QPair<QgsFeatureId, QMap<int, QString>>>() SIP_PYARGDEFAULT( 'QList<QPair<qint64, QMap<int, QString>>>()' ) );
inline int inlineKeyWordShouldNotAppear();
@ -342,7 +342,7 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private Ui::QgsBas
void position( bool keep, bool middle_remove SIP_PYARGREMOVE, bool keep );
void position( bool keep, bool last_remove SIP_PYARGREMOVE );
static void SIP_PYTYPE( SIP_PYLIST ) changeReturnType( QVector<int> *resultTree = 0, QVector<double> &resultCost = 0 );
static void SIP_PYALTERNATIVETYPE( SIP_PYLIST ) changeReturnType( QVector<int> *resultTree = 0, QVector<double> &resultCost = 0 );
//! Some comment
Whatever &operator[]( int i ) SIP_FACTORY;