QGIS/python/core/auto_generated/raster/qgsrasterblock.sip.in

451 lines
10 KiB
Plaintext
Raw Normal View History

2017-06-01 15:39:31 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterblock.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
2012-10-11 16:11:45 +02:00
class QgsRasterBlock
{
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Raster data container.
2012-10-11 16:11:45 +02:00
%End
2017-06-01 15:39:31 +02:00
%TypeHeaderCode
#include "qgsrasterblock.h"
%End
2012-10-11 16:11:45 +02:00
public:
QgsRasterBlock();
QgsRasterBlock( Qgis::DataType dataType, int width, int height );
2017-06-01 15:39:31 +02:00
%Docstring
Constructor which allocates data block in memory
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param dataType: raster data type
:param width: width of data matrix
:param height: height of data matrix
2017-06-01 15:39:31 +02:00
%End
2012-10-11 16:11:45 +02:00
virtual ~QgsRasterBlock();
bool reset( Qgis::DataType dataType, int width, int height );
2017-06-01 15:39:31 +02:00
%Docstring
Reset block
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param dataType: raster data type
:param width: width of data matrix
:param height: height of data matrix
:return: true on success
2017-06-01 15:39:31 +02:00
%End
2012-10-11 16:11:45 +02:00
bool isValid() const;
2017-06-01 15:39:31 +02:00
%Docstring
Returns true if the block is valid (correctly filled with data).
2017-12-15 10:36:55 -04:00
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.
2017-06-01 15:39:31 +02:00
%End
void setValid( bool valid );
2017-06-01 15:39:31 +02:00
%Docstring
Mark block as valid or invalid
2017-06-01 15:39:31 +02:00
%End
2012-10-11 16:11:45 +02:00
bool isEmpty() const;
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
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).
2017-06-01 15:39:31 +02:00
%End
2012-10-11 16:11:45 +02:00
static int typeSize( int dataType );
2012-10-11 16:11:45 +02:00
2013-04-15 15:51:40 +02:00
int dataTypeSize() const;
2012-10-11 16:11:45 +02:00
static bool typeIsNumeric( Qgis::DataType type );
2017-06-01 15:39:31 +02:00
%Docstring
Returns true if data type is numeric
%End
2012-10-11 16:11:45 +02:00
static bool typeIsColor( Qgis::DataType type );
2017-06-01 15:39:31 +02:00
%Docstring
Returns true if data type is color
%End
2012-10-11 16:11:45 +02:00
Qgis::DataType dataType() const;
2017-06-01 15:39:31 +02:00
%Docstring
Returns data type
%End
2012-10-11 16:11:45 +02:00
static Qgis::DataType typeWithNoDataValue( Qgis::DataType dataType, double *noDataValue );
2017-06-01 15:39:31 +02:00
%Docstring
For given data type returns wider type and sets no data value
%End
2012-10-11 16:11:45 +02:00
2013-04-12 18:32:46 +02:00
bool hasNoDataValue() const;
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
True if the block has no data value.
:return: true if the block has no data value
.. seealso:: :py:func:`noDataValue`
2017-06-01 15:39:31 +02:00
%End
bool hasNoData() const;
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
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 *
2017-06-01 15:39:31 +02:00
%End
2013-04-12 18:32:46 +02:00
void setNoDataValue( double noDataValue );
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Sets cell value that will be considered as "no data".
.. seealso:: :py:func:`noDataValue`
2018-05-28 11:31:08 -04:00
.. versionadded:: 3.0
2017-06-01 15:39:31 +02:00
%End
void resetNoDataValue();
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Reset no data value: if there was a no data value previously set,
it will be discarded.
.. seealso:: :py:func:`noDataValue`
2018-05-28 11:31:08 -04:00
.. versionadded:: 3.0
2017-06-01 15:39:31 +02:00
%End
double noDataValue() const;
2017-06-01 15:39:31 +02:00
%Docstring
Returns no data value. If the block does not have a no data value the
2017-12-15 10:36:55 -04:00
returned value is undefined.
:return: No data value
.. seealso:: :py:func:`hasNoDataValue`
2017-06-01 15:39:31 +02:00
%End
2012-10-11 16:11:45 +02:00
static QByteArray valueBytes( Qgis::DataType dataType, double value );
2017-06-01 15:39:31 +02:00
%Docstring
Gets byte array representing a value.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param dataType: data type
:param value: value
:return: byte array representing the value *
2017-06-01 15:39:31 +02:00
%End
double value( int row, int column ) const;
2017-06-01 15:39:31 +02:00
%Docstring
Read a single value if type of block is numeric. If type is color,
2017-12-15 10:36:55 -04:00
returned value is undefined.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param row: row index
:param column: column index
:return: value *
2017-06-01 15:39:31 +02:00
%End
2012-10-11 16:11:45 +02:00
double value( qgssize index ) const;
2017-06-01 15:39:31 +02:00
%Docstring
Read a single value if type of block is numeric. If type is color,
2017-12-15 10:36:55 -04:00
returned value is undefined.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param index: data matrix index (long type in Python)
:return: value *
2017-06-01 15:39:31 +02:00
%End
2012-10-11 16:11:45 +02:00
2012-10-11 16:11:45 +02:00
QRgb color( int row, int column ) const;
2017-06-01 15:39:31 +02:00
%Docstring
Read a single color
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param row: row index
:param column: column index
:return: color *
2017-06-01 15:39:31 +02:00
%End
QRgb color( qgssize index ) const;
2017-06-01 15:39:31 +02:00
%Docstring
Read a single value
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param index: data matrix index (long type in Python)
:return: color *
2017-06-01 15:39:31 +02:00
%End
2018-07-23 12:35:49 +02:00
bool isNoData( int row, int column ) const;
2017-06-01 15:39:31 +02:00
%Docstring
Check if value at position is no data
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param row: row index
:param column: column index
:return: true if value is no data *
%End
2018-07-23 12:35:49 +02:00
bool isNoData( qgssize row, qgssize column ) const;
%Docstring
Check if value at position is no data
:param row: row index
2017-12-15 10:36:55 -04:00
:param column: column index
:return: true if value is no data *
2017-06-01 15:39:31 +02:00
%End
2018-07-23 12:35:49 +02:00
bool isNoData( qgssize index ) const;
2017-06-01 15:39:31 +02:00
%Docstring
Check if value at position is no data
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param index: data matrix index (long type in Python)
:return: true if value is no data *
2017-06-01 15:39:31 +02:00
%End
2012-10-11 16:11:45 +02:00
bool setValue( int row, int column, double value );
2017-06-01 15:39:31 +02:00
%Docstring
Set value on position
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param row: row index
:param column: column index
:param value: the value to be set
:return: true on success *
2017-06-01 15:39:31 +02:00
%End
bool setValue( qgssize index, double value );
2017-06-01 15:39:31 +02:00
%Docstring
Set value on index (indexed line by line)
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param index: data matrix index (long type in Python)
:param value: the value to be set
:return: true on success *
2017-06-01 15:39:31 +02:00
%End
2012-10-11 16:11:45 +02:00
bool setColor( int row, int column, QRgb color );
2017-06-01 15:39:31 +02:00
%Docstring
Set color on position
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param row: row index
:param column: column index
:param color: the color to be set, QRgb value
:return: true on success *
2017-06-01 15:39:31 +02:00
%End
bool setColor( qgssize index, QRgb color );
2017-06-01 15:39:31 +02:00
%Docstring
Set color on index (indexed line by line)
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param index: data matrix index (long type in Python)
:param color: the color to be set, QRgb value
:return: true on success *
2017-06-01 15:39:31 +02:00
%End
bool setIsNoData( int row, int column );
2017-06-01 15:39:31 +02:00
%Docstring
Set no data on pixel
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param row: row index
:param column: column index
:return: true on success *
2017-06-01 15:39:31 +02:00
%End
bool setIsNoData( qgssize index );
2017-06-01 15:39:31 +02:00
%Docstring
Set no data on pixel
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param index: data matrix index (long type in Python)
:return: true on success *
2017-06-01 15:39:31 +02:00
%End
bool setIsNoData();
2017-06-01 15:39:31 +02:00
%Docstring
Set the whole block to no data
2017-12-15 10:36:55 -04:00
:return: true on success *
2017-06-01 15:39:31 +02:00
%End
bool setIsNoDataExcept( QRect exceptRect );
2017-06-01 15:39:31 +02:00
%Docstring
Set the whole block to no data except specified rectangle
2017-12-15 10:36:55 -04:00
:return: true on success *
2017-06-01 15:39:31 +02:00
%End
void setIsData( int row, int column );
2017-06-01 15:39:31 +02:00
%Docstring
Remove no data flag on pixel. If the raster block does not have an explicit
2017-12-15 10:36:55 -04:00
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.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param row: row index
:param column: column index
2017-06-01 15:39:31 +02:00
.. versionadded:: 2.10
%End
void setIsData( qgssize index );
2017-06-01 15:39:31 +02:00
%Docstring
Remove no data flag on pixel. If the raster block does not have an explicit
2017-12-15 10:36:55 -04:00
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.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param index: data matrix index (long type in Python)
2017-06-01 15:39:31 +02:00
.. versionadded:: 2.10
%End
QByteArray data() const;
2017-06-01 15:39:31 +02:00
%Docstring
Gets access to raw data.
2017-12-15 10:36:55 -04:00
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.
2017-06-01 15:39:31 +02:00
.. note::
in Python the method returns ordinary bytes object as the
2017-12-15 10:36:55 -04:00
2017-06-01 15:39:31 +02:00
.. versionadded:: 3.0
%End
void setData( const QByteArray &data, int offset = 0 );
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
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.
2017-06-01 15:39:31 +02:00
.. versionadded:: 3.0
%End
2012-10-11 16:11:45 +02:00
static QString printValue( double value );
2017-06-01 15:39:31 +02:00
%Docstring
Print double value with all necessary significant digits.
2017-12-15 10:36:55 -04:00
It is ensured that conversion back to double gives the same number.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param value: the value to be printed
:return: string representing the value*
2017-06-01 15:39:31 +02:00
%End
2012-10-11 16:11:45 +02:00
bool convert( Qgis::DataType destDataType );
2017-06-01 15:39:31 +02:00
%Docstring
Convert data to different type.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param destDataType: dest data type
:return: true on success *
2017-06-01 15:39:31 +02:00
%End
2012-10-11 16:11:45 +02:00
QImage image() const;
2017-06-01 15:39:31 +02:00
%Docstring
Returns an image containing the block data, if the block's data type is color.
2017-06-01 15:39:31 +02:00
%End
bool setImage( const QImage *image );
2017-06-01 15:39:31 +02:00
%Docstring
Sets the block data via an ``image``.
2017-12-15 10:36:55 -04:00
:return: true on success
2017-06-01 15:39:31 +02:00
%End
2014-01-26 18:35:21 +01:00
void applyNoDataValues( const QgsRasterRangeList &rangeList );
void applyScaleOffset( double scale, double offset );
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Apply band scale and offset to raster block values
2017-06-01 15:39:31 +02:00
.. versionadded:: 2.3
%End
QgsError error() const;
2017-06-01 15:39:31 +02:00
%Docstring
Returns the last error
2017-06-01 15:39:31 +02:00
%End
void setError( const QgsError &error );
2017-06-01 15:39:31 +02:00
%Docstring
Sets the last error
2017-06-01 15:39:31 +02:00
%End
QString toString() const;
static QRect subRect( const QgsRectangle &extent, int width, int height, const QgsRectangle &subExtent );
2017-06-01 15:39:31 +02:00
%Docstring
For extent and width, height find rectangle covered by subextent.
2017-12-15 10:36:55 -04:00
The output rect has x oriented from left to right and y from top to bottom
(upper-left to lower-right orientation).
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
: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
2017-06-01 15:39:31 +02:00
%End
int width() const;
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the width (number of columns) of the raster block.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`height`
2017-12-15 10:36:55 -04:00
2017-06-01 15:39:31 +02:00
.. versionadded:: 2.10
%End
int height() const;
2017-06-01 15:39:31 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the height (number of rows) of the raster block.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`width`
2017-12-15 10:36:55 -04:00
2017-06-01 15:39:31 +02:00
.. versionadded:: 2.10
%End
2012-10-11 16:11:45 +02:00
};
2017-06-01 15:39:31 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/raster/qgsrasterblock.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/