Skip to content
Permalink
Browse files

Split metadata into two classes

A new base class QgsMetadataBase has been split off QgsLayerMetadata,
containing all non-layer specific metadata items.

This allows us to reuse the common metadata settings for other
non-layer items, e.g. projects.
  • Loading branch information
nyalldawson committed Mar 19, 2018
1 parent 9c06d86 commit 5cf2656acefb15a3fcf1ef7b4a89f898ca492b04
@@ -172,6 +172,7 @@
%Include metadata/qgslayermetadata.sip
%Include metadata/qgslayermetadatavalidator.sip
%Include metadata/qgslayermetadataformatter.sip
%Include metadata/qgsmetadatabase.sip
%Include processing/qgsprocessing.sip
%Include processing/qgsprocessingalgorithm.sip
%Include processing/qgsprocessingcontext.sip
@@ -10,7 +10,7 @@



class QgsLayerMetadata
class QgsLayerMetadata : QgsMetadataBase
{
%Docstring
A structured metadata store for a map layer.
@@ -42,7 +42,8 @@ using QgsNativeMetadataValidator.
%End
public:

typedef QMap< QString, QStringList > KeywordMap;

typedef QgsMetadataBase::KeywordMap KeywordMap;

struct SpatialExtent
{
@@ -113,85 +114,19 @@ Constructor for Constraint.
typedef QList< QgsLayerMetadata::Constraint > ConstraintList;


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;
typedef QgsMetadataBase::Address Address;

QString country;

bool operator==( const QgsLayerMetadata::Address &other ) const;
};

struct Contact
{

Contact( const QString &name = QString() );
%Docstring
Constructor for Contact.
%End
typedef QgsMetadataBase::Contact Contact;

QString name;

QString organization;
typedef QgsMetadataBase::ContactList ContactList;

QString position;

QList< QgsLayerMetadata::Address > addresses;
typedef QgsMetadataBase::Link Link;

QString voice;

QString fax;

QString email;

QString role;

bool operator==( const QgsLayerMetadata::Contact &other ) const;
};

typedef QList< QgsLayerMetadata::Contact > ContactList;


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;

bool operator==( const QgsLayerMetadata::Link &other ) const;
};

typedef QList< QgsLayerMetadata::Link > LinkList;
typedef QgsMetadataBase::LinkList LinkList;

QgsLayerMetadata();
%Docstring
@@ -200,99 +135,6 @@ Constructor for QgsLayerMetadata.

virtual ~QgsLayerMetadata();

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

QString fees() const;
%Docstring
Returns any fees associated with using the resource.
@@ -359,32 +201,6 @@ Sets a list of ``licenses`` associated with the resource.
(examples: http://opendefinition.org/licenses/).

.. seealso:: :py:func:`licenses`
%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

QString encoding() const;
@@ -456,146 +272,6 @@ or the CRS from the data provider.
This property should also match the CRS property used in the spatial extent.

.. seealso:: :py:func:`crs`
%End

KeywordMap keywords() const;
%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

void setKeywords( const KeywordMap &keywords );
%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

QgsLayerMetadata::ContactList contacts() const;
%Docstring
Returns a list of contact persons or entities associated with the resource.

.. seealso:: :py:func:`setContacts`
%End

void setContacts( const QgsLayerMetadata::ContactList &contacts );
%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

void addContact( const QgsLayerMetadata::Contact &contact );
%Docstring
Adds an individual ``contact`` to the existing contacts.

.. seealso:: :py:func:`contacts`

.. seealso:: :py:func:`setContacts`
%End

QgsLayerMetadata::LinkList links() const;
%Docstring
Returns a list of online resources associated with the resource.

.. seealso:: :py:func:`setLinks`
%End

void setLinks( const QgsLayerMetadata::LinkList &links );
%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

void addLink( const QgsLayerMetadata::Link &link );
%Docstring
Adds an individual ``link`` to the existing links.

.. seealso:: :py:func:`links`

.. seealso:: :py:func:`setLinks`
%End

void saveToLayer( QgsMapLayer *layer ) const;

0 comments on commit 5cf2656

Please sign in to comment.
You can’t perform that action at this time.