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

Additional Inherited Members

- Public Types inherited from QgsAbstractMetadataBase
typedef QList< QgsAbstractMetadataBase::ContactContactList
 A list of contacts.
 
typedef QMap< QString, QStringList > KeywordMap
 Map of vocabulary string to keyword list.
 
typedef QList< QgsAbstractMetadataBase::LinkLinkList
 A list of links.
 
- Protected Member Functions inherited from QgsAbstractMetadataBase
 QgsAbstractMetadataBase ()=default
 Constructor for QgsAbstractMetadataBase.
 
bool equals (const QgsAbstractMetadataBase &other) const
 Tests whether the common metadata fields in this object are equal to other.
 
- Protected Attributes inherited from QgsAbstractMetadataBase
QString mAbstract
 
QgsAbstractMetadataBase::ContactList mContacts
 
QMap< Qgis::MetadataDateType, QDateTime > mDates
 Metadata dates.
 
QStringList mHistory
 
QString mIdentifier
 
QgsAbstractMetadataBase::KeywordMap mKeywords
 Keywords map.
 
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 62 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 73 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 43 of file qgsprojectmetadata.cpp.


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