mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-16 00:05:45 -04:00
177 lines
4.8 KiB
Plaintext
177 lines
4.8 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/raster/qgsrasterattributetable.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
class QgsRasterAttributeTable
|
|
{
|
|
%Docstring(signature="appended")
|
|
The :py:class:`QgsRasterAttributeTable` class represents a raster attribute table (RAT).
|
|
|
|
This class is modeled after the GDAL RAT implementation, it adds some convenience
|
|
methods to handle data from QGIS and to import/export a RAT from/to a DBF VAT file.
|
|
|
|
.. versionadded:: 3.30
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgsrasterattributetable.h"
|
|
%End
|
|
public:
|
|
|
|
enum class FieldUsage
|
|
{
|
|
Generic,
|
|
PixelCount,
|
|
Name,
|
|
Min,
|
|
Max,
|
|
MinMax,
|
|
Red,
|
|
Green,
|
|
Blue,
|
|
Alpha,
|
|
RedMin,
|
|
GreenMin,
|
|
BlueMin,
|
|
AlphaMin,
|
|
RedMax,
|
|
GreenMax,
|
|
BlueMax,
|
|
AlphaMax,
|
|
MaxCount
|
|
};
|
|
|
|
enum class RatType
|
|
{
|
|
Thematic,
|
|
Athematic
|
|
};
|
|
|
|
struct Field
|
|
{
|
|
|
|
Field( const QString &name, const FieldUsage &usage, const QVariant::Type type );
|
|
%Docstring
|
|
Creates a new Field with ``name``, ``type`` and ``usage``.
|
|
%End
|
|
QString name;
|
|
FieldUsage usage;
|
|
QVariant::Type type;
|
|
};
|
|
|
|
const RatType &type() const;
|
|
%Docstring
|
|
Returns the RAT type.
|
|
%End
|
|
|
|
void setType( const RatType &newType );
|
|
%Docstring
|
|
Sets the RAT ``type``
|
|
%End
|
|
|
|
bool hasColor();
|
|
%Docstring
|
|
Returns ``True`` if the RAT has RGB information.
|
|
%End
|
|
|
|
QList<QgsRasterAttributeTable::Field> fields() const;
|
|
%Docstring
|
|
Returns the RAT fields.
|
|
%End
|
|
|
|
QgsFields qgisFields() const;
|
|
%Docstring
|
|
Return the RAT fields as :py:class:`QgsFields`.
|
|
%End
|
|
|
|
QgsFeatureList qgisFeatures( ) const;
|
|
%Docstring
|
|
Returns the RAT rows as a list of :py:class:`QgsFeature`.
|
|
%End
|
|
|
|
bool isDirty() const;
|
|
%Docstring
|
|
Returns ``True`` if the RAT was modified from its last reading from the storage.
|
|
%End
|
|
|
|
void setIsDirty( bool isDirty );
|
|
%Docstring
|
|
Sets the RAT dirty state to ``isDirty``;
|
|
%End
|
|
|
|
bool isValid() const;
|
|
%Docstring
|
|
Returs ``True`` if the RAT is valid.
|
|
%End
|
|
|
|
bool insertField( const QgsRasterAttributeTable::Field &field, int position = 0 );
|
|
%Docstring
|
|
Insert a new ``field`` at ``position`` and returns ``True`` on success.
|
|
%End
|
|
|
|
bool insertField( const QString &name, QgsRasterAttributeTable::FieldUsage usage, QVariant::Type type, int position = 0 );
|
|
%Docstring
|
|
Creates a new field from ``name``, ``usage`` and ``type`` and inserts it at ``position``, returns ``True`` on success.
|
|
%End
|
|
|
|
bool appendField( const QString &name, QgsRasterAttributeTable::FieldUsage usage, QVariant::Type type );
|
|
%Docstring
|
|
Creates a new field from ``name``, ``usage`` and ``type`` and appends it to the fields, returns ``True`` on success.
|
|
%End
|
|
|
|
bool appendField( const QgsRasterAttributeTable::Field &field );
|
|
%Docstring
|
|
Appends a new ``field`` and returns ``True`` on success.
|
|
%End
|
|
|
|
bool removeField( const QString &name );
|
|
%Docstring
|
|
Removes the field with ``name``, returns ``True`` on success.
|
|
%End
|
|
|
|
bool insertRow( const QVariantList data, int position = 0 );
|
|
%Docstring
|
|
Inserts a row of ``data`` in the RAT at ``position``, returns ``True`` on success.
|
|
%End
|
|
|
|
bool appendRow( const QVariantList data );
|
|
%Docstring
|
|
Appends a row of ``data`` to the RAT, returns ``True`` on success.
|
|
%End
|
|
|
|
bool writeToFile( const QString &path, QString *errorMessage /Out/ = 0 );
|
|
%Docstring
|
|
Writes the RAT to a DBF file specified by ``path``, optionally reporting any error in ``errorMessage``, returns ``True`` on success.
|
|
%End
|
|
|
|
bool readFromFile( const QString &path, QString *errorMessage /Out/ = 0 );
|
|
%Docstring
|
|
Reads the RAT from a DBF file specified by ``path``, optionally reporting any error in ``errorMessage``, returns ``True`` on success.
|
|
%End
|
|
|
|
const QList<QList<QVariant>> &data() const;
|
|
%Docstring
|
|
Returs the RAT rows.
|
|
%End
|
|
|
|
static FieldUsage guessFieldUsage( const QString &name, const QVariant::Type type );
|
|
%Docstring
|
|
Try to determine the field usage from its ``name`` and ``type``.
|
|
%End
|
|
|
|
};
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/raster/qgsrasterattributetable.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|