Skip to content

Commit

Permalink
RAT model inital implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso authored and nyalldawson committed Nov 8, 2022
1 parent 1704be7 commit 6184bd6
Show file tree
Hide file tree
Showing 5 changed files with 606 additions and 0 deletions.
114 changes: 114 additions & 0 deletions python/gui/auto_generated/raster/qgsrasterattributetablemodel.sip.in
@@ -0,0 +1,114 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/raster/qgsrasterattributetablemodel.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/


class QgsRasterAttributeTableModel : QAbstractTableModel
{
%Docstring(signature="appended")
The :py:class:`QgsRasterAttributeTableModel` class manages a :py:class:`QgsRasterAttributeTable`

.. versionadded:: 3.30
%End

%TypeHeaderCode
#include "qgsrasterattributetablemodel.h"
%End
public:

explicit QgsRasterAttributeTableModel( QgsRasterAttributeTable *rat, QObject *parent = 0 );
%Docstring
Creates a new QgsRasterAttributeTableModel from raster attribute table ``rat`` and optional ``parent``.
%End

bool editable() const;
%Docstring
Returns true if the RAT is editable.
%End

void setEditable( bool editable );
%Docstring
Sets the RAT editable state to ``editable``.
%End

bool hasColor() const;
%Docstring
Returns ``True`` if the RAT has color information.
%End

bool hasRamp() const;
%Docstring
Returns ``True`` if the RAT has ramp information.
%End

QStringList headerNames( ) const;
%Docstring
Returns all the header names, including the "virtual" color header if the RAT has color or ramp.
%End

QString headerTooltip( const int section ) const;
%Docstring
Returns the tooltip for the given ``section``.
%End


bool insertField( const QString &name, const Qgis::RasterAttributeTableFieldUsage usage, const QVariant::Type type, const int position, QString *errorMessage /Out/ = 0 );
%Docstring
Inserts a field at the given position.

:param name: field name
:param usage: field usage
:param type: field type
:param position: insertion point (before)

:return: - true on success
- errorMessage: error message
%End
bool removeField( const int position, QString *errorMessage /Out/ = 0 );

bool removeColorOrRamp( QString *errorMessage /Out/ = 0 );
%Docstring
Removes all color or ramp information, returns ``True`` on success.
%End

bool insertRow( const QVariantList &rowData, const int position, QString *errorMessage /Out/ = 0 );
%Docstring
Inserts a new row before ``position``, returns ``True`` on success.
%End

bool removeRow( const int position, QString *errorMessage /Out/ = 0 );
%Docstring
Removes the row at ``position``, returns ``True`` on success.
%End

static QString RAT_COLOR_HEADER_NAME;

public:
virtual int rowCount( const QModelIndex &parent ) const;

virtual int columnCount( const QModelIndex &parent ) const;

virtual QVariant data( const QModelIndex &index, int role ) const;

virtual bool setData( const QModelIndex &index, const QVariant &value, int role );

virtual QVariant headerData( int section, Qt::Orientation orientation, int role ) const;


virtual Qt::ItemFlags flags( const QModelIndex &index ) const;



};

/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/raster/qgsrasterattributetablemodel.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
1 change: 1 addition & 0 deletions python/gui/gui_auto.sip
Expand Up @@ -409,6 +409,7 @@
%Include auto_generated/raster/qgshillshaderendererwidget.sip
%Include auto_generated/raster/qgsmultibandcolorrendererwidget.sip
%Include auto_generated/raster/qgspalettedrendererwidget.sip
%Include auto_generated/raster/qgsrasterattributetablemodel.sip
%Include auto_generated/raster/qgsrasterbandcombobox.sip
%Include auto_generated/raster/qgsrastercontourrendererwidget.sip
%Include auto_generated/raster/qgsrasterhistogramwidget.sip
Expand Down
2 changes: 2 additions & 0 deletions src/gui/CMakeLists.txt
Expand Up @@ -2,6 +2,7 @@ set(QGIS_GUI_SRCS
raster/qgscolorrampshaderwidget.cpp
raster/qgsmultibandcolorrendererwidget.cpp
raster/qgspalettedrendererwidget.cpp
raster/qgsrasterattributetablemodel.cpp
raster/qgsrasterbandcombobox.cpp
raster/qgsrastercontourrendererwidget.cpp
raster/qgsrasterhistogramwidget.cpp
Expand Down Expand Up @@ -1282,6 +1283,7 @@ set(QGIS_GUI_HDRS
raster/qgshillshaderendererwidget.h
raster/qgsmultibandcolorrendererwidget.h
raster/qgspalettedrendererwidget.h
raster/qgsrasterattributetablemodel.h
raster/qgsrasterbandcombobox.h
raster/qgsrastercontourrendererwidget.h
raster/qgsrasterhistogramwidget.h
Expand Down

0 comments on commit 6184bd6

Please sign in to comment.