QGIS API Documentation
3.20.0-Odense (decaadbb31)
|
A structured metadata store for a map layer. More...
#include <qgsprojectmetadata.h>
Public Member Functions | |
QgsProjectMetadata ()=default | |
Constructor for QgsProjectMetadata. More... | |
QString | author () const |
Returns the project author string. More... | |
QgsProjectMetadata * | clone () 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::Contact > | ContactList |
A list of contacts. More... | |
typedef QMap< QString, QStringList > | KeywordMap |
Map of vocabulary string to keyword list. More... | |
typedef QList< QgsAbstractMetadataBase::Link > | LinkList |
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 |
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.
Definition at line 53 of file qgsprojectmetadata.h.
|
default |
Constructor for QgsProjectMetadata.
QString QgsProjectMetadata::author | ( | ) | const |
Returns the project author string.
Definition at line 84 of file qgsprojectmetadata.cpp.
|
overridevirtual |
Clones the metadata object.
Implements QgsAbstractMetadataBase.
Definition at line 79 of file qgsprojectmetadata.cpp.
|
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.
Reimplemented from QgsAbstractMetadataBase.
Definition at line 58 of file qgsprojectmetadata.cpp.
QDateTime QgsProjectMetadata::creationDateTime | ( | ) | const |
Returns the project's creation date/timestamp.
Definition at line 94 of file qgsprojectmetadata.cpp.
bool QgsProjectMetadata::operator== | ( | const QgsProjectMetadata & | metadataOther | ) | const |
Definition at line 72 of file qgsprojectmetadata.cpp.
|
overridevirtual |
Sets state from DOM document.
metadataElement | The DOM element corresponding to `‘resourceMetadata’' tag |
true
if successfulSubclasses 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.
void QgsProjectMetadata::setAuthor | ( | const QString & | author | ) |
Sets the project author string.
Definition at line 89 of file qgsprojectmetadata.cpp.
void QgsProjectMetadata::setCreationDateTime | ( | const QDateTime & | creationDateTime | ) |
Sets the project's creation date/timestamp.
Definition at line 99 of file qgsprojectmetadata.cpp.
|
overridevirtual |
Stores state in a DOM node.
metadataElement | is a DOM element corresponding to `‘resourceMetadata’' tag |
document | is a the DOM document being written |
true
if successfulSubclasses 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.