2018-03-19 12:35:09 +10:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
2018-03-19 15:57:58 +10:00
|
|
|
* src/core/metadata/qgsabstractmetadatabase.h *
|
2018-03-19 12:35:09 +10:00
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
class QgsAbstractMetadataBase
|
2018-03-19 12:35:09 +10:00
|
|
|
{
|
|
|
|
%Docstring
|
2018-03-19 15:57:58 +10:00
|
|
|
An abstract base class for metadata stores.
|
2018-03-19 12:35:09 +10:00
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
QgsAbstractMetadataBase is the base class for handling storage and management of the metadata
|
2018-03-19 12:35:09 +10:00
|
|
|
for various map related assets. This class is an internal QGIS format with a common
|
|
|
|
metadata structure. It is subclassed by layer and project specific metadata classes,
|
2018-03-19 15:57:58 +10:00
|
|
|
such as QgsLayerMetadata and QgsProjectMetadata.
|
2018-03-19 12:35:09 +10:00
|
|
|
|
|
|
|
The metadata store is designed to be compatible with the Dublin Core metadata
|
|
|
|
specifications, and will be expanded to allow compatibility with ISO specifications
|
|
|
|
in future releases. However, the QGIS internal schema does not represent a superset
|
|
|
|
of all existing metadata schemas and accordingly conversion from specific
|
2018-03-19 15:57:58 +10:00
|
|
|
metadata formats to QgsAbstractMetadataBase may result in a loss of information.
|
2018-03-19 12:35:09 +10:00
|
|
|
|
|
|
|
This class is designed to follow the specifications detailed in
|
2018-03-19 16:16:04 +10:00
|
|
|
the schema definition available at resources/qgis-base-metadata.xsd
|
2018-03-19 12:35:09 +10:00
|
|
|
within the QGIS source code.
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
Metadata can be validated through the use of QgsAbstractMetadataBaseValidator
|
2018-03-19 12:35:09 +10:00
|
|
|
subclasses. E.g. validating against the native QGIS metadata schema can be performed
|
|
|
|
using QgsNativeMetadataValidator.
|
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
%End
|
|
|
|
|
|
|
|
%TypeHeaderCode
|
2018-03-19 15:57:58 +10:00
|
|
|
#include "qgsabstractmetadatabase.h"
|
2018-03-19 17:34:52 +10:00
|
|
|
%End
|
|
|
|
%ConvertToSubClassCode
|
|
|
|
if ( dynamic_cast< QgsLayerMetadata * >( sipCpp ) != NULL )
|
|
|
|
sipType = sipType_QgsLayerMetadata;
|
2018-03-20 08:33:43 +10:00
|
|
|
else if ( dynamic_cast< QgsProjectMetadata * >( sipCpp ) != NULL )
|
2018-03-19 17:34:52 +10:00
|
|
|
sipType = sipType_QgsProjectMetadata;
|
|
|
|
else
|
|
|
|
sipType = NULL;
|
2018-03-19 12:35:09 +10:00
|
|
|
%End
|
|
|
|
public:
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
|
2018-03-19 12:35:09 +10:00
|
|
|
typedef QMap< QString, QStringList > KeywordMap;
|
|
|
|
|
|
|
|
struct Address
|
|
|
|
{
|
|
|
|
|
|
|
|
Address( const QString &type = QString(), const QString &address = QString(), const QString &city = QString(), const QString &administrativeArea = QString(), const QString &postalCode = QString(), const QString &country = QString() );
|
|
|
|
%Docstring
|
|
|
|
Constructor for Address.
|
|
|
|
%End
|
|
|
|
|
|
|
|
QString type;
|
|
|
|
|
|
|
|
QString address;
|
|
|
|
|
|
|
|
QString city;
|
|
|
|
|
|
|
|
QString administrativeArea;
|
|
|
|
|
|
|
|
QString postalCode;
|
|
|
|
|
|
|
|
QString country;
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
bool operator==( const QgsAbstractMetadataBase::Address &other ) const;
|
2018-03-19 12:35:09 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Contact
|
|
|
|
{
|
|
|
|
|
|
|
|
Contact( const QString &name = QString() );
|
|
|
|
%Docstring
|
|
|
|
Constructor for Contact.
|
|
|
|
%End
|
|
|
|
|
|
|
|
QString name;
|
|
|
|
|
|
|
|
QString organization;
|
|
|
|
|
|
|
|
QString position;
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
QList< QgsAbstractMetadataBase::Address > addresses;
|
2018-03-19 12:35:09 +10:00
|
|
|
|
|
|
|
QString voice;
|
|
|
|
|
|
|
|
QString fax;
|
|
|
|
|
|
|
|
QString email;
|
|
|
|
|
|
|
|
QString role;
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
bool operator==( const QgsAbstractMetadataBase::Contact &other ) const;
|
2018-03-19 12:35:09 +10:00
|
|
|
};
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
typedef QList< QgsAbstractMetadataBase::Contact > ContactList;
|
2018-03-19 12:35:09 +10:00
|
|
|
|
|
|
|
|
|
|
|
struct Link
|
|
|
|
{
|
|
|
|
|
|
|
|
Link( const QString &name = QString(), const QString &type = QString(), const QString &url = QString() );
|
|
|
|
%Docstring
|
|
|
|
Constructor for Link.
|
|
|
|
%End
|
|
|
|
|
|
|
|
QString name;
|
|
|
|
|
|
|
|
QString type;
|
|
|
|
|
|
|
|
QString description;
|
|
|
|
|
|
|
|
QString url;
|
|
|
|
|
|
|
|
QString format;
|
|
|
|
|
|
|
|
QString mimeType;
|
|
|
|
|
|
|
|
QString size;
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
bool operator==( const QgsAbstractMetadataBase::Link &other ) const;
|
2018-03-19 12:35:09 +10:00
|
|
|
};
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
typedef QList< QgsAbstractMetadataBase::Link > LinkList;
|
2018-03-19 12:35:09 +10:00
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
virtual ~QgsAbstractMetadataBase();
|
2018-03-19 12:35:09 +10:00
|
|
|
|
2018-03-19 17:34:52 +10:00
|
|
|
virtual QgsAbstractMetadataBase *clone() const = 0 /Factory/;
|
|
|
|
%Docstring
|
|
|
|
Clones the metadata object.
|
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
%End
|
|
|
|
|
2018-03-19 12:35:09 +10:00
|
|
|
QString identifier() const;
|
|
|
|
%Docstring
|
|
|
|
A reference, URI, URL or some other mechanism to identify the resource.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setIdentifier`
|
|
|
|
%End
|
|
|
|
|
|
|
|
void setIdentifier( const QString &identifier );
|
|
|
|
%Docstring
|
|
|
|
Sets the reference, URI, URL or some other mechanism to identify the resource.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`identifier`
|
|
|
|
%End
|
|
|
|
|
|
|
|
QString parentIdentifier() const;
|
|
|
|
%Docstring
|
|
|
|
A reference, URI, URL or some other mechanism to identify the parent resource that this resource is a part (child) of.
|
|
|
|
Returns an empty string if no parent identifier is set.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setParentIdentifier`
|
|
|
|
%End
|
|
|
|
|
|
|
|
void setParentIdentifier( const QString &parentIdentifier );
|
|
|
|
%Docstring
|
|
|
|
Sets a reference, URI, URL or some other mechanism to identify the parent resource that this resource is a part (child) of.
|
|
|
|
Set an empty string if no parent identifier is required.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`parentIdentifier`
|
|
|
|
%End
|
|
|
|
|
|
|
|
QString language() const;
|
|
|
|
%Docstring
|
|
|
|
Returns the human language associated with the resource. Usually the returned string
|
|
|
|
will follow either the ISO 639.2 or ISO 3166 specifications, e.g. 'ENG' or 'SPA', however
|
|
|
|
this is not a hard requirement and the caller must account for non compliant
|
|
|
|
values.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setLanguage`
|
|
|
|
%End
|
|
|
|
|
|
|
|
void setLanguage( const QString &language );
|
|
|
|
%Docstring
|
|
|
|
Sets the human ``language`` associated with the resource. While a formal vocabulary is not imposed,
|
|
|
|
ideally values should be taken from the ISO 639.2 or ISO 3166 specifications,
|
|
|
|
e.g. 'ENG' or 'SPA' (ISO 639.2) or 'EN-AU' (ISO 3166).
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`language`
|
|
|
|
%End
|
|
|
|
|
|
|
|
QString type() const;
|
|
|
|
%Docstring
|
|
|
|
Returns the nature of the resource. While a formal vocabulary is not imposed, it is advised
|
|
|
|
to use the ISO 19115 MD_ScopeCode values. E.g. 'dataset' or 'series'.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setType`
|
|
|
|
%End
|
|
|
|
|
|
|
|
void setType( const QString &type );
|
|
|
|
%Docstring
|
|
|
|
Sets the ``type`` (nature) of the resource. While a formal vocabulary is not imposed, it is advised
|
|
|
|
to use the ISO 19115 MD_ScopeCode values. E.g. 'dataset' or 'series'.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`type`
|
|
|
|
%End
|
|
|
|
|
|
|
|
QString title() const;
|
|
|
|
%Docstring
|
|
|
|
Returns the human readable name of the resource, typically displayed in search results.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setTitle`
|
|
|
|
%End
|
|
|
|
|
|
|
|
void setTitle( const QString &title );
|
|
|
|
%Docstring
|
|
|
|
Sets the human readable ``title`` (name) of the resource, typically displayed in search results.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`title`
|
|
|
|
%End
|
|
|
|
|
|
|
|
QString abstract() const;
|
|
|
|
%Docstring
|
|
|
|
Returns a free-form description of the resource.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setAbstract`
|
|
|
|
%End
|
|
|
|
|
|
|
|
void setAbstract( const QString &abstract );
|
|
|
|
%Docstring
|
|
|
|
Sets a free-form ``abstract`` (description) of the resource.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`abstract`
|
|
|
|
%End
|
|
|
|
|
|
|
|
QStringList history() const;
|
|
|
|
%Docstring
|
|
|
|
Returns a freeform description of the history or lineage of the resource.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setHistory`
|
|
|
|
%End
|
|
|
|
|
|
|
|
void setHistory( const QStringList &history );
|
|
|
|
%Docstring
|
|
|
|
Sets the freeform description of the ``history`` or lineage of the resource.
|
|
|
|
Any existing history items will be overwritten.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`addHistoryItem`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`history`
|
|
|
|
%End
|
|
|
|
|
|
|
|
void addHistoryItem( const QString &text );
|
|
|
|
%Docstring
|
|
|
|
Adds a single history ``text`` to the end of the existing history list.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`history`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setHistory`
|
|
|
|
%End
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
QgsAbstractMetadataBase::KeywordMap keywords() const;
|
2018-03-19 12:35:09 +10:00
|
|
|
%Docstring
|
|
|
|
Returns the keywords map, which is a set of descriptive keywords associated with the resource.
|
|
|
|
|
|
|
|
The map key is the vocabulary string and map value is a list of keywords for that vocabulary.
|
|
|
|
|
|
|
|
The vocabulary string is a reference (URI/URL preferred) to a codelist or vocabulary
|
|
|
|
associated with keyword list.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setKeywords`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`keywordVocabularies`
|
|
|
|
%End
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
void setKeywords( const QgsAbstractMetadataBase::KeywordMap &keywords );
|
2018-03-19 12:35:09 +10:00
|
|
|
%Docstring
|
|
|
|
Sets the ``keywords`` map, which is a set of descriptive keywords associated with the resource.
|
|
|
|
|
|
|
|
The map key is the vocabulary string and map value is a list of keywords for that vocabulary.
|
|
|
|
Calling this replaces any existing keyword vocabularies.
|
|
|
|
|
|
|
|
The vocabulary string is a reference (URI/URL preferred) to a codelist or vocabulary
|
|
|
|
associated with keyword list.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`keywords`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`addKeywords`
|
|
|
|
%End
|
|
|
|
|
|
|
|
void addKeywords( const QString &vocabulary, const QStringList &keywords );
|
|
|
|
%Docstring
|
|
|
|
Adds a list of descriptive ``keywords`` for a specified ``vocabulary``. Any existing
|
|
|
|
keywords for the same vocabulary will be replaced. Other vocabularies
|
|
|
|
will not be affected.
|
|
|
|
|
|
|
|
The vocabulary string is a reference (URI/URL preferred) to a codelist or vocabulary
|
|
|
|
associated with keyword list.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setKeywords`
|
|
|
|
%End
|
|
|
|
|
|
|
|
bool removeKeywords( const QString &vocabulary );
|
|
|
|
%Docstring
|
|
|
|
Remove a vocabulary from the list.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setKeywords`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`addKeywords`
|
|
|
|
%End
|
|
|
|
|
|
|
|
QStringList keywordVocabularies() const;
|
|
|
|
%Docstring
|
|
|
|
Returns a list of keyword vocabularies contained in the metadata.
|
|
|
|
|
|
|
|
The vocabulary string is a reference (URI/URL preferred) to a codelist or vocabulary
|
|
|
|
associated with keyword list.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`keywords`
|
|
|
|
%End
|
|
|
|
|
|
|
|
QStringList keywords( const QString &vocabulary ) const;
|
|
|
|
%Docstring
|
|
|
|
Returns a list of keywords for the specified ``vocabulary``.
|
|
|
|
If the vocabulary is not contained in the metadata, an empty
|
|
|
|
list will be returned.
|
|
|
|
|
|
|
|
The vocabulary string is a reference (URI/URL preferred) to a codelist or vocabulary
|
|
|
|
associated with keyword list.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`keywordVocabularies`
|
|
|
|
%End
|
|
|
|
|
|
|
|
QStringList categories() const;
|
|
|
|
%Docstring
|
|
|
|
Returns categories of the resource.
|
|
|
|
Categories are stored using a special vocabulary 'gmd:topicCategory' in keywords.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`keywords`
|
|
|
|
%End
|
|
|
|
|
|
|
|
void setCategories( const QStringList &categories );
|
|
|
|
%Docstring
|
|
|
|
Sets categories of the resource.
|
|
|
|
Categories are stored using a special vocabulary 'gmd:topicCategory' in keywords.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`keywords`
|
|
|
|
%End
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
QgsAbstractMetadataBase::ContactList contacts() const;
|
2018-03-19 12:35:09 +10:00
|
|
|
%Docstring
|
|
|
|
Returns a list of contact persons or entities associated with the resource.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setContacts`
|
|
|
|
%End
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
void setContacts( const QgsAbstractMetadataBase::ContactList &contacts );
|
2018-03-19 12:35:09 +10:00
|
|
|
%Docstring
|
|
|
|
Sets the list of ``contacts`` or entities associated with the resource. Any existing contacts
|
|
|
|
will be replaced.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`contacts`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`addContact`
|
|
|
|
%End
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
void addContact( const QgsAbstractMetadataBase::Contact &contact );
|
2018-03-19 12:35:09 +10:00
|
|
|
%Docstring
|
|
|
|
Adds an individual ``contact`` to the existing contacts.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`contacts`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setContacts`
|
|
|
|
%End
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
QgsAbstractMetadataBase::LinkList links() const;
|
2018-03-19 12:35:09 +10:00
|
|
|
%Docstring
|
|
|
|
Returns a list of online resources associated with the resource.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setLinks`
|
|
|
|
%End
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
void setLinks( const QgsAbstractMetadataBase::LinkList &links );
|
2018-03-19 12:35:09 +10:00
|
|
|
%Docstring
|
|
|
|
Sets the list of online resources associated with the resource. Any existing links
|
|
|
|
will be replaced.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`links`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`addLink`
|
|
|
|
%End
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
void addLink( const QgsAbstractMetadataBase::Link &link );
|
2018-03-19 12:35:09 +10:00
|
|
|
%Docstring
|
|
|
|
Adds an individual ``link`` to the existing links.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`links`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setLinks`
|
|
|
|
%End
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
virtual bool readMetadataXml( const QDomElement &metadataElement );
|
2018-03-19 12:35:09 +10:00
|
|
|
%Docstring
|
2018-03-19 15:57:58 +10:00
|
|
|
Sets state from DOM document.
|
2018-03-19 12:35:09 +10:00
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
:param metadataElement: The DOM element corresponding to ``resourceMetadata'' tag
|
2018-03-19 12:35:09 +10:00
|
|
|
|
|
|
|
:return: true if successful
|
2018-03-19 15:57:58 +10:00
|
|
|
|
|
|
|
Subclasses which override this method should take care to also call the base
|
|
|
|
class method in order to read common metadata properties.
|
2018-03-19 12:35:09 +10:00
|
|
|
%End
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
virtual bool writeMetadataXml( QDomElement &metadataElement, QDomDocument &document ) const;
|
2018-03-19 12:35:09 +10:00
|
|
|
%Docstring
|
2018-03-19 15:57:58 +10:00
|
|
|
Stores state in a DOM node.
|
2018-03-19 12:35:09 +10:00
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
:param metadataElement: is a DOM element corresponding to ``resourceMetadata'' tag
|
|
|
|
:param document: is a the DOM document being written
|
2018-03-19 12:35:09 +10:00
|
|
|
|
|
|
|
:return: true if successful
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
Subclasses which override this method should take care to also call the base
|
|
|
|
class method in order to write common metadata properties.
|
|
|
|
%End
|
2018-03-19 12:35:09 +10:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
QgsAbstractMetadataBase();
|
|
|
|
%Docstring
|
|
|
|
Constructor for QgsAbstractMetadataBase.
|
|
|
|
|
|
|
|
QgsAbstractMetadataBase cannot be instantiated directly, it must be subclassed.
|
|
|
|
%End
|
|
|
|
|
|
|
|
|
2018-03-19 12:35:09 +10:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-03-19 15:57:58 +10:00
|
|
|
bool equals( const QgsAbstractMetadataBase &other ) const;
|
|
|
|
%Docstring
|
|
|
|
Tests whether the common metadata fields in this object are equal to ``other``.
|
|
|
|
|
2018-03-20 08:20:42 +10:00
|
|
|
Subclasses should utilize this method from their equality operators to test
|
2018-03-19 15:57:58 +10:00
|
|
|
equality of base class members.
|
|
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
|
|
%End
|
|
|
|
|
2018-03-19 12:35:09 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
2018-03-19 15:57:58 +10:00
|
|
|
* src/core/metadata/qgsabstractmetadatabase.h *
|
2018-03-19 12:35:09 +10:00
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|