mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-17 00:09:36 -04:00
473 lines
13 KiB
Plaintext
473 lines
13 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/symbology/qgscptcityarchive.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QgsCptCityArchive
|
|
{
|
|
%Docstring(signature="appended")
|
|
Represents a CPT City color scheme.
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgscptcityarchive.h"
|
|
%End
|
|
public:
|
|
QgsCptCityArchive( const QString &archiveName = DEFAULT_CPTCITY_ARCHIVE,
|
|
const QString &baseDir = QString() );
|
|
~QgsCptCityArchive();
|
|
|
|
|
|
QString baseDir() const;
|
|
static QString baseDir( QString archiveName );
|
|
static QString defaultBaseDir();
|
|
void setBaseDir( const QString &dirName );
|
|
|
|
QString copyingFileName( const QString &dirName ) const;
|
|
QString descFileName( const QString &dirName ) const;
|
|
static QString findFileName( const QString &target, const QString &startDir, const QString &baseDir );
|
|
static QMap< QString, QString > copyingInfo( const QString &fileName );
|
|
static QMap< QString, QString > description( const QString &fileName );
|
|
|
|
bool isEmpty() const;
|
|
%Docstring
|
|
Returns ``True`` if archive is empty
|
|
%End
|
|
QString archiveName() const;
|
|
static void initArchives( bool loadAll = false );
|
|
static void initArchive( const QString &archiveName, const QString &archiveBaseDir );
|
|
static void initDefaultArchive();
|
|
static void clearArchives();
|
|
static QgsCptCityArchive *defaultArchive();
|
|
static QMap< QString, QgsCptCityArchive * > archiveRegistry();
|
|
|
|
QVector< QgsCptCityDataItem * > rootItems() const;
|
|
QVector< QgsCptCityDataItem * > selectionItems() const;
|
|
|
|
private:
|
|
QgsCptCityArchive( const QgsCptCityArchive &rh );
|
|
};
|
|
|
|
class QgsCptCityDataItem : QObject
|
|
{
|
|
%Docstring(signature="appended")
|
|
Base class for all items in a :py:class:`QgsCptCityBrowserModel` model.
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgscptcityarchive.h"
|
|
%End
|
|
public:
|
|
enum Type
|
|
{
|
|
ColorRamp,
|
|
Collection,
|
|
Directory,
|
|
Selection,
|
|
AllRamps
|
|
};
|
|
|
|
QgsCptCityDataItem( QgsCptCityDataItem::Type type, QgsCptCityDataItem *parent,
|
|
const QString &name, const QString &path );
|
|
|
|
bool hasChildren();
|
|
|
|
int rowCount();
|
|
|
|
virtual int leafCount() const;
|
|
%Docstring
|
|
Returns the total count of "leaf" items (all children which are end
|
|
nodes).
|
|
%End
|
|
|
|
|
|
virtual void refresh();
|
|
|
|
virtual QVector<QgsCptCityDataItem *> createChildren();
|
|
%Docstring
|
|
Returns a vector of children items.
|
|
%End
|
|
|
|
virtual void populate();
|
|
%Docstring
|
|
Populates children using children vector created by
|
|
:py:func:`~QgsCptCityDataItem.createChildren`.
|
|
%End
|
|
|
|
bool isPopulated();
|
|
%Docstring
|
|
Returns ``True`` if the item is already populated.
|
|
%End
|
|
|
|
virtual void addChildItem( QgsCptCityDataItem *child /Transfer/, bool refresh = false );
|
|
%Docstring
|
|
Inserts a new ``child`` using alphabetical order based on mName, emits
|
|
necessary signal to model before and after, sets parent and connects
|
|
signals.
|
|
|
|
The ``refresh`` argument will refresh the populated item by emitting
|
|
signals to the model.
|
|
%End
|
|
|
|
virtual void deleteChildItem( QgsCptCityDataItem *child );
|
|
%Docstring
|
|
Removes and deletes a child ``item``, signals to browser are emitted.
|
|
%End
|
|
|
|
virtual QgsCptCityDataItem *removeChildItem( QgsCptCityDataItem *child ) /TransferBack/;
|
|
%Docstring
|
|
Removes a ``child`` item but doesn't delete it, signals to browser are
|
|
emitted.
|
|
|
|
:return: pointer to the removed item or ``None`` if no such item was
|
|
found
|
|
%End
|
|
|
|
virtual bool equal( const QgsCptCityDataItem *other );
|
|
%Docstring
|
|
Returns ``True`` if this item is equal to an ``other`` item.
|
|
%End
|
|
|
|
virtual QWidget *paramWidget() /Deprecated="Since 3.40. Is unused and will be removed in QGIS 4.0."/;
|
|
%Docstring
|
|
.. deprecated:: 3.40
|
|
|
|
Is unused and will be removed in QGIS 4.0.
|
|
%End
|
|
|
|
virtual bool acceptDrop() /Deprecated="Since 3.40. Is unused and will be removed in QGIS 4.0."/;
|
|
%Docstring
|
|
Returns ``True`` if the item accepts drag & dropped layers - e.g. for
|
|
import.
|
|
|
|
.. deprecated:: 3.40
|
|
|
|
Is unused and will be removed in QGIS 4.0.
|
|
%End
|
|
|
|
virtual bool handleDrop( const QMimeData *data, Qt::DropAction action ) /Deprecated="Since 3.40. Is unused and will be removed in QGIS 4.0."/;
|
|
%Docstring
|
|
Tries to process the ``data`` dropped on this item.
|
|
|
|
.. deprecated:: 3.40
|
|
|
|
Is unused and will be removed in QGIS 4.0.
|
|
%End
|
|
|
|
|
|
static int findItem( QVector<QgsCptCityDataItem *> items, QgsCptCityDataItem *item );
|
|
%Docstring
|
|
Finds a child index in vector of items using '==' operator.
|
|
%End
|
|
|
|
|
|
Type type() const;
|
|
QgsCptCityDataItem *parent() const;
|
|
void setParent( QgsCptCityDataItem *parent );
|
|
QVector<QgsCptCityDataItem *> children() const;
|
|
virtual QIcon icon();
|
|
virtual QIcon icon( QSize size );
|
|
QString name() const;
|
|
QString path() const;
|
|
QString info() const;
|
|
QString shortInfo() const;
|
|
|
|
void setIcon( const QIcon &icon );
|
|
|
|
void setToolTip( const QString &msg );
|
|
QString toolTip() const;
|
|
|
|
bool isValid();
|
|
|
|
protected:
|
|
|
|
|
|
signals:
|
|
|
|
void beginInsertItems( QgsCptCityDataItem *parent, int first, int last );
|
|
%Docstring
|
|
Emitted before child items are added to this item.
|
|
|
|
This signal *must* be followed by
|
|
:py:func:`~QgsCptCityDataItem.endInsertItems`.
|
|
|
|
:param parent: the parent item having children added
|
|
:param first: index of first child item to be added
|
|
:param last: index last child item, after the addition has occurred
|
|
|
|
.. seealso:: :py:func:`endInsertItems`
|
|
%End
|
|
|
|
void endInsertItems();
|
|
%Docstring
|
|
Emitted after child items have been added to this data item.
|
|
|
|
This signal will always be preceded by
|
|
:py:func:`~QgsCptCityDataItem.beginInsertItems`.
|
|
|
|
.. seealso:: :py:func:`beginInsertItems`
|
|
%End
|
|
|
|
void beginRemoveItems( QgsCptCityDataItem *parent, int first, int last );
|
|
%Docstring
|
|
Emitted before child items are removed from this data item.
|
|
|
|
This signal *must* be followed by
|
|
:py:func:`~QgsCptCityDataItem.endRemoveItems`.
|
|
|
|
:param parent: the parent item having children removed
|
|
:param first: index of first child item to be removed
|
|
:param last: index of the last child item to be removed
|
|
|
|
.. seealso:: :py:func:`endRemoveItems`
|
|
%End
|
|
|
|
void endRemoveItems();
|
|
%Docstring
|
|
Emitted after child items have been removed from this data item.
|
|
|
|
This signal will always be preceded by
|
|
:py:func:`~QgsCptCityDataItem.beginRemoveItems`.
|
|
|
|
.. seealso:: :py:func:`beginRemoveItems`
|
|
%End
|
|
};
|
|
|
|
class QgsCptCityColorRampItem : QgsCptCityDataItem
|
|
{
|
|
%Docstring(signature="appended")
|
|
An item that represents a layer that can be opened with one of the
|
|
providers for a :py:class:`QgsCptCityBrowserModel`.
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgscptcityarchive.h"
|
|
%End
|
|
public:
|
|
QgsCptCityColorRampItem( QgsCptCityDataItem *parent,
|
|
const QString &name, const QString &path,
|
|
const QString &variantName = QString(),
|
|
bool initialize = false );
|
|
QgsCptCityColorRampItem( QgsCptCityDataItem *parent,
|
|
const QString &name, const QString &path,
|
|
const QStringList &variantList,
|
|
bool initialize = false );
|
|
|
|
|
|
virtual bool equal( const QgsCptCityDataItem *other );
|
|
|
|
virtual int leafCount() const;
|
|
|
|
const QgsCptCityColorRamp &ramp() const;
|
|
virtual QIcon icon();
|
|
|
|
virtual QIcon icon( QSize size );
|
|
|
|
void init();
|
|
|
|
protected:
|
|
|
|
};
|
|
|
|
|
|
class QgsCptCityCollectionItem : QgsCptCityDataItem
|
|
{
|
|
%Docstring(signature="appended")
|
|
A logical collection of subcollections and color ramps for use in
|
|
:py:class:`QgsCptCityBrowserModel`.
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgscptcityarchive.h"
|
|
%End
|
|
public:
|
|
QgsCptCityCollectionItem( QgsCptCityDataItem *parent,
|
|
const QString &name, const QString &path );
|
|
~QgsCptCityCollectionItem();
|
|
|
|
void setPopulated();
|
|
void addChild( QgsCptCityDataItem *item /Transfer/ );
|
|
QVector<QgsCptCityDataItem *> childrenRamps( bool recursive );
|
|
|
|
protected:
|
|
};
|
|
|
|
class QgsCptCityDirectoryItem : QgsCptCityCollectionItem
|
|
{
|
|
%Docstring(signature="appended")
|
|
A directory which contains subdirectories and color ramps for use in
|
|
:py:class:`QgsCptCityBrowserModel`.
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgscptcityarchive.h"
|
|
%End
|
|
public:
|
|
QgsCptCityDirectoryItem( QgsCptCityDataItem *parent,
|
|
const QString &name, const QString &path );
|
|
|
|
virtual QVector<QgsCptCityDataItem *> createChildren();
|
|
|
|
|
|
virtual bool equal( const QgsCptCityDataItem *other );
|
|
|
|
|
|
static QgsCptCityDataItem *dataItem( QgsCptCityDataItem *parent,
|
|
const QString &name, const QString &path );
|
|
|
|
protected:
|
|
QMap< QString, QStringList > rampsMap();
|
|
QStringList dirEntries() const;
|
|
};
|
|
|
|
class QgsCptCitySelectionItem : QgsCptCityCollectionItem
|
|
{
|
|
%Docstring(signature="appended")
|
|
A selection which contains subdirectories and color ramps for use in
|
|
:py:class:`QgsCptCityBrowserModel`.
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgscptcityarchive.h"
|
|
%End
|
|
public:
|
|
QgsCptCitySelectionItem( QgsCptCityDataItem *parent, const QString &name, const QString &path );
|
|
|
|
virtual QVector<QgsCptCityDataItem *> createChildren();
|
|
|
|
|
|
virtual bool equal( const QgsCptCityDataItem *other );
|
|
|
|
|
|
QStringList selectionsList() const;
|
|
|
|
protected:
|
|
void parseXml();
|
|
};
|
|
|
|
class QgsCptCityAllRampsItem : QgsCptCityCollectionItem
|
|
{
|
|
%Docstring(signature="appended")
|
|
An "All ramps item", which contains all items in a flat hierarchy.
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgscptcityarchive.h"
|
|
%End
|
|
public:
|
|
QgsCptCityAllRampsItem( QgsCptCityDataItem *parent, const QString &name,
|
|
const QVector<QgsCptCityDataItem *> &items );
|
|
|
|
virtual QVector<QgsCptCityDataItem *> createChildren();
|
|
|
|
|
|
protected:
|
|
};
|
|
|
|
class QgsCptCityBrowserModel : QAbstractItemModel
|
|
{
|
|
%Docstring(signature="appended")
|
|
A custom item model for display of CPT City color palettes.
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgscptcityarchive.h"
|
|
%End
|
|
public:
|
|
|
|
enum ViewType
|
|
{
|
|
Authors,
|
|
Selections,
|
|
List
|
|
};
|
|
|
|
QgsCptCityBrowserModel( QObject *parent /TransferThis/ = 0,
|
|
QgsCptCityArchive *archive = QgsCptCityArchive::defaultArchive(),
|
|
ViewType Type = Authors );
|
|
~QgsCptCityBrowserModel();
|
|
|
|
virtual Qt::ItemFlags flags( const QModelIndex &index ) const;
|
|
|
|
virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
|
|
|
|
virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
|
|
|
|
virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const;
|
|
|
|
virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const;
|
|
|
|
virtual QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const;
|
|
|
|
|
|
QModelIndex findItem( QgsCptCityDataItem *item, QgsCptCityDataItem *parent = 0 ) const;
|
|
|
|
virtual QModelIndex parent( const QModelIndex &index ) const;
|
|
|
|
|
|
QgsCptCityDataItem *dataItem( const QModelIndex &idx ) const;
|
|
%Docstring
|
|
Returns the data item corresponding to the given index.
|
|
%End
|
|
|
|
virtual bool hasChildren( const QModelIndex &parent = QModelIndex() ) const;
|
|
|
|
|
|
void reload();
|
|
%Docstring
|
|
Reload the whole model
|
|
%End
|
|
|
|
void refresh( const QString &path );
|
|
%Docstring
|
|
Refresh the item specified by ``path``
|
|
%End
|
|
|
|
void refresh( const QModelIndex &index = QModelIndex() );
|
|
%Docstring
|
|
Refresh item children
|
|
%End
|
|
|
|
QModelIndex findPath( const QString &path );
|
|
%Docstring
|
|
Returns index of a path
|
|
%End
|
|
|
|
void connectItem( QgsCptCityDataItem *item );
|
|
|
|
virtual bool canFetchMore( const QModelIndex &parent ) const;
|
|
|
|
virtual void fetchMore( const QModelIndex &parent );
|
|
|
|
|
|
public slots:
|
|
|
|
void beginInsertItems( QgsCptCityDataItem *parent, int first, int last );
|
|
void endInsertItems();
|
|
void beginRemoveItems( QgsCptCityDataItem *parent, int first, int last );
|
|
void endRemoveItems();
|
|
|
|
protected:
|
|
|
|
void addRootItems();
|
|
void removeRootItems();
|
|
|
|
};
|
|
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/symbology/qgscptcityarchive.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|