QGIS API Documentation  3.20.0-Odense (decaadbb31)
Public Member Functions | List of all members
QgsProjectMetadata Class Reference

A structured metadata store for a map layer. More...

#include <qgsprojectmetadata.h>

Inheritance diagram for QgsProjectMetadata:
Inheritance graph
[legend]

Public Member Functions

 QgsProjectMetadata ()=default
 Constructor for QgsProjectMetadata. More...
 
QString author () const
 Returns the project author string. More...
 
QgsProjectMetadataclone () const override
 Clones the metadata object. More...
 
void combine (const QgsAbstractMetadataBase *other) override
 Combines the metadata from this object with the metadata from an other object. More...
 
QDateTime creationDateTime () const
 Returns the project's creation date/timestamp. More...
 
bool operator== (const QgsProjectMetadata &metadataOther) const
 
bool readMetadataXml (const QDomElement &metadataElement) override
 Sets state from DOM document. More...
 
void setAuthor (const QString &author)
 Sets the project author string. More...
 
void setCreationDateTime (const QDateTime &creationDateTime)
 Sets the project's creation date/timestamp. More...
 
bool writeMetadataXml (QDomElement &metadataElement, QDomDocument &document) const override
 Stores state in a DOM node. More...
 
- Public Member Functions inherited from QgsAbstractMetadataBase
virtual ~QgsAbstractMetadataBase ()=default
 
QString abstract () const
 Returns a free-form description of the resource. More...
 
void addContact (const QgsAbstractMetadataBase::Contact &contact)
 Adds an individual contact to the existing contacts. More...
 
void addHistoryItem (const QString &text)
 Adds a single history text to the end of the existing history list. More...
 
void addKeywords (const QString &vocabulary, const QStringList &keywords)
 Adds a list of descriptive keywords for a specified vocabulary. More...
 
void addLink (const QgsAbstractMetadataBase::Link &link)
 Adds an individual link to the existing links. More...
 
QStringList categories () const
 Returns categories of the resource. More...
 
QgsAbstractMetadataBase::ContactList contacts () const
 Returns a list of contact persons or entities associated with the resource. More...
 
QStringList history () const
 Returns a freeform description of the history or lineage of the resource. More...
 
QString identifier () const
 A reference, URI, URL or some other mechanism to identify the resource. More...
 
QgsAbstractMetadataBase::KeywordMap keywords () const
 Returns the keywords map, which is a set of descriptive keywords associated with the resource. More...
 
QStringList keywords (const QString &vocabulary) const
 Returns a list of keywords for the specified vocabulary. More...
 
QStringList keywordVocabularies () const
 Returns a list of keyword vocabularies contained in the metadata. More...
 
QString language () const
 Returns the human language associated with the resource. More...
 
QgsAbstractMetadataBase::LinkList links () const
 Returns a list of online resources associated with the resource. More...
 
QString parentIdentifier () const
 A reference, URI, URL or some other mechanism to identify the parent resource that this resource is a part (child) of. More...
 
bool removeKeywords (const QString &vocabulary)
 Remove a vocabulary from the list. More...
 
void setAbstract (const QString &abstract)
 Sets a free-form abstract (description) of the resource. More...
 
void setCategories (const QStringList &categories)
 Sets categories of the resource. More...
 
void setContacts (const QgsAbstractMetadataBase::ContactList &contacts)
 Sets the list of contacts or entities associated with the resource. More...
 
void setHistory (const QStringList &history)
 Sets the freeform description of the history or lineage of the resource. More...
 
void setIdentifier (const QString &identifier)
 Sets the reference, URI, URL or some other mechanism to identify the resource. More...
 
void setKeywords (const QgsAbstractMetadataBase::KeywordMap &keywords)
 Sets the keywords map, which is a set of descriptive keywords associated with the resource. More...
 
void setLanguage (const QString &language)
 Sets the human language associated with the resource. More...
 
void setLinks (const QgsAbstractMetadataBase::LinkList &links)
 Sets the list of online resources associated with the resource. More...
 
void setParentIdentifier (const QString &parentIdentifier)
 Sets a reference, URI, URL or some other mechanism to identify the parent resource that this resource is a part (child) of. More...
 
void setTitle (const QString &title)
 Sets the human readable title (name) of the resource, typically displayed in search results. More...
 
void setType (const QString &type)
 Sets the type (nature) of the resource. More...
 
QString title () const
 Returns the human readable name of the resource, typically displayed in search results. More...
 
QString type () const
 Returns the nature of the resource. More...
 

Additional Inherited Members

- Public Types inherited from QgsAbstractMetadataBase
typedef QList< QgsAbstractMetadataBase::ContactContactList
 A list of contacts. More...
 
typedef QMap< QString, QStringList > KeywordMap
 Map of vocabulary string to keyword list. More...
 
typedef QList< QgsAbstractMetadataBase::LinkLinkList
 A list of links. More...
 
- Protected Member Functions inherited from QgsAbstractMetadataBase
 QgsAbstractMetadataBase ()=default
 Constructor for QgsAbstractMetadataBase. More...
 
bool equals (const QgsAbstractMetadataBase &other) const
 Tests whether the common metadata fields in this object are equal to other. More...
 
- Protected Attributes inherited from QgsAbstractMetadataBase
QString mAbstract
 
QgsAbstractMetadataBase::ContactList mContacts
 
QStringList mHistory
 
QString mIdentifier
 
QgsAbstractMetadataBase::KeywordMap mKeywords
 Keywords map. More...
 
QString mLanguage
 
QgsAbstractMetadataBase::LinkList mLinks
 
QString mParentIdentifier
 
QString mTitle
 
QString mType
 

Detailed Description

A structured metadata store for a map layer.

QgsProjectMetadata handles storage and management of the metadata for a QgsProject. This class is an internal QGIS format with a common metadata structure, which allows for code to access the metadata properties for projects in a uniform way.

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 metadata formats to QgsProjectMetadata may result in a loss of information.

This class is designed to follow the specifications detailed in the schema definition available at resources/qgis-project-metadata.xsd within the QGIS source code.

Metadata can be validated through the use of QgsLayerMetadataValidator subclasses. E.g. validating against the native QGIS metadata schema can be performed using QgsNativeProjectMetadataValidator.

Since
QGIS 3.2

Definition at line 53 of file qgsprojectmetadata.h.

Constructor & Destructor Documentation

◆ QgsProjectMetadata()

QgsProjectMetadata::QgsProjectMetadata ( )
default

Constructor for QgsProjectMetadata.

Member Function Documentation

◆ author()

QString QgsProjectMetadata::author ( ) const

Returns the project author string.

See also
setAuthor()

Definition at line 84 of file qgsprojectmetadata.cpp.

◆ clone()

QgsProjectMetadata * QgsProjectMetadata::clone ( ) const
overridevirtual

Clones the metadata object.

Since
QGIS 3.2

Implements QgsAbstractMetadataBase.

Definition at line 79 of file qgsprojectmetadata.cpp.

◆ combine()

void QgsProjectMetadata::combine ( const QgsAbstractMetadataBase other)
overridevirtual

Combines the metadata from this object with the metadata from an other object.

Any existing values in this object will be overwritten by non-empty values from other.

Since
QGIS 3.20

Reimplemented from QgsAbstractMetadataBase.

Definition at line 58 of file qgsprojectmetadata.cpp.

◆ creationDateTime()

QDateTime QgsProjectMetadata::creationDateTime ( ) const

Returns the project's creation date/timestamp.

See also
setCreationDateTime()

Definition at line 94 of file qgsprojectmetadata.cpp.

◆ operator==()

bool QgsProjectMetadata::operator== ( const QgsProjectMetadata metadataOther) const

Definition at line 72 of file qgsprojectmetadata.cpp.

◆ readMetadataXml()

bool QgsProjectMetadata::readMetadataXml ( const QDomElement &  metadataElement)
overridevirtual

Sets state from DOM document.

Parameters
metadataElementThe DOM element corresponding to `‘resourceMetadata’' tag
Returns
true if successful

Subclasses which override this method should take care to also call the base class method in order to read common metadata properties.

Reimplemented from QgsAbstractMetadataBase.

Definition at line 22 of file qgsprojectmetadata.cpp.

◆ setAuthor()

void QgsProjectMetadata::setAuthor ( const QString &  author)

Sets the project author string.

See also
author()

Definition at line 89 of file qgsprojectmetadata.cpp.

◆ setCreationDateTime()

void QgsProjectMetadata::setCreationDateTime ( const QDateTime &  creationDateTime)

Sets the project's creation date/timestamp.

See also
creationDateTime()

Definition at line 99 of file qgsprojectmetadata.cpp.

◆ writeMetadataXml()

bool QgsProjectMetadata::writeMetadataXml ( QDomElement &  metadataElement,
QDomDocument &  document 
) const
overridevirtual

Stores state in a DOM node.

Parameters
metadataElementis a DOM element corresponding to `‘resourceMetadata’' tag
documentis a the DOM document being written
Returns
true if successful

Subclasses which override this method should take care to also call the base class method in order to write common metadata properties.

Reimplemented from QgsAbstractMetadataBase.

Definition at line 39 of file qgsprojectmetadata.cpp.


The documentation for this class was generated from the following files: