QGIS API Documentation 3.99.0-Master (d270888f95f)
Loading...
Searching...
No Matches
qgslayermetadata.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgslayermetadata.cpp
3 --------------------
4 begin : April 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#include "qgslayermetadata.h"
19
20#include "qgsmaplayer.h"
22
23#include <QRegularExpression>
24#include <QString>
25
26using namespace Qt::StringLiterals;
27
29{
30 return new QgsLayerMetadata( *this );
31}
32
34{
35 return mFees;
36}
37
38void QgsLayerMetadata::setFees( const QString &fees )
39{
40 mFees = fees;
41}
42
44{
45 mConstraints << constraint;
46}
47
48QList<QgsLayerMetadata::Constraint> QgsLayerMetadata::constraints() const
49{
50 return mConstraints;
51}
52
53void QgsLayerMetadata::setConstraints( const QList<Constraint> &constraints )
54{
55 mConstraints = constraints;
56}
57
58QStringList QgsLayerMetadata::rights() const
59{
60 return mRights;
61}
62
63void QgsLayerMetadata::setRights( const QStringList &rights )
64{
65 mRights = rights;
66}
67
68QStringList QgsLayerMetadata::licenses() const
69{
70 return mLicenses;
71}
72
73void QgsLayerMetadata::setLicenses( const QStringList &licenses )
74{
75 mLicenses = licenses;
76}
77
79{
80 return mEncoding;
81}
82
84{
85 mEncoding = encoding;
86}
87
92
97
99{
100 layer->setCustomProperty( u"metadata/identifier"_s, mIdentifier );
101 layer->setCustomProperty( u"metadata/parentIdentifier"_s, mParentIdentifier );
102 layer->setCustomProperty( u"metadata/language"_s, mLanguage );
103 layer->setCustomProperty( u"metadata/type"_s, mType );
104 layer->setCustomProperty( u"metadata/title"_s, mTitle );
105 layer->setCustomProperty( u"metadata/extent"_s, QVariant::fromValue( mExtent ) );
106 layer->setCustomProperty( u"metadata/abstract"_s, mAbstract );
107 layer->setCustomProperty( u"metadata/fees"_s, mFees );
108 layer->setCustomProperty( u"metadata/rights"_s, mRights );
109 layer->setCustomProperty( u"metadata/licenses"_s, mLicenses );
110 layer->setCustomProperty( u"metadata/history"_s, mHistory );
111 layer->setCustomProperty( u"metadata/encoding"_s, mEncoding );
112 layer->setCustomProperty( u"metadata/crs"_s, mCrs.authid() );
113 layer->setCustomProperty( u"metadata/constraints"_s, QVariant::fromValue( mConstraints ) );
114 layer->setCustomProperty( u"metadata/keywords"_s, QVariant::fromValue( mKeywords ) );
115 layer->setCustomProperty( u"metadata/contacts"_s, QVariant::fromValue( mContacts ) );
116 layer->setCustomProperty( u"metadata/links"_s, QVariant::fromValue( mLinks ) );
117}
118
120{
121 mIdentifier = layer->customProperty( u"metadata/identifier"_s ).toString();
122 mParentIdentifier = layer->customProperty( u"metadata/parentIdentifier"_s ).toString();
123 mLanguage = layer->customProperty( u"metadata/language"_s ).toString();
124 mType = layer->customProperty( u"metadata/type"_s ).toString();
125 mTitle = layer->customProperty( u"metadata/title"_s ).toString();
126 mAbstract = layer->customProperty( u"metadata/abstract"_s ).toString();
127 mFees = layer->customProperty( u"metadata/fees"_s ).toString();
128 mRights = layer->customProperty( u"metadata/rights"_s ).toStringList();
129 mLicenses = layer->customProperty( u"metadata/licenses"_s ).toStringList();
130 mHistory = layer->customProperty( u"metadata/history"_s ).toStringList();
131 mEncoding = layer->customProperty( u"metadata/encoding"_s ).toString();
132 const QString crsAuthId = layer->customProperty( u"metadata/crs"_s ).toString();
134 mExtent = layer->customProperty( u"metadata/extent"_s ).value<Extent>();
135 mConstraints = layer->customProperty( u"metadata/constraints"_s ).value<ConstraintList>();
136 mKeywords = layer->customProperty( u"metadata/keywords"_s ).value<QgsAbstractMetadataBase::KeywordMap>();
137 mContacts = layer->customProperty( u"metadata/contacts"_s ).value<QgsAbstractMetadataBase::ContactList>();
138 mLinks = layer->customProperty( u"metadata/links"_s ).value<QgsAbstractMetadataBase::LinkList>();
139}
140
141bool QgsLayerMetadata::readMetadataXml( const QDomElement &metadataElement, const QgsReadWriteContext &context )
142{
143 QgsAbstractMetadataBase::readMetadataXml( metadataElement, context );
144
145 QDomNode mnl;
146 QDomElement mne;
147
148 // set fees
149 mnl = metadataElement.namedItem( u"fees"_s );
150 mFees = mnl.toElement().text();
151
152 // constraints
153 const QDomNodeList constraintsList = metadataElement.elementsByTagName( u"constraints"_s );
154 mConstraints.clear();
155 for ( int i = 0; i < constraintsList.size(); i++ )
156 {
157 mnl = constraintsList.at( i );
158 mne = mnl.toElement();
159 addConstraint( QgsLayerMetadata::Constraint( mne.text(), mne.attribute( u"type"_s ) ) );
160 }
161
162 // rights
163 const QDomNodeList rightsNodeList = metadataElement.elementsByTagName( u"rights"_s );
164 QStringList rightsList;
165 for ( int i = 0; i < rightsNodeList.size(); i++ )
166 {
167 mnl = rightsNodeList.at( i );
168 mne = mnl.toElement();
169 const QString right = context.projectTranslator()->translate( "metadata", mne.text() );
170 rightsList.append( right );
171 }
172 setRights( rightsList );
173
174 // licenses
175 const QDomNodeList licensesNodeList = metadataElement.elementsByTagName( u"license"_s );
176 QStringList licensesList;
177 for ( int i = 0; i < licensesNodeList.size(); i++ )
178 {
179 mnl = licensesNodeList.at( i );
180 mne = mnl.toElement();
181 licensesList.append( mne.text() );
182 }
183 setLicenses( licensesList );
184
185 // encoding
186 mnl = metadataElement.namedItem( u"encoding"_s );
187 mEncoding = mnl.toElement().text();
188
189 // crs
190 mnl = metadataElement.namedItem( u"crs"_s );
191 if ( !mCrs.readXml( mnl ) )
193
194 // extent
195 mnl = metadataElement.namedItem( u"extent"_s );
196 QgsLayerMetadata::Extent metadataExtent;
197
198 // spatial extent
199 const QDomNodeList spatialList = mnl.toElement().elementsByTagName( u"spatial"_s );
200 QList< QgsLayerMetadata::SpatialExtent > metadataSpatialExtents;
201 for ( int i = 0; i < spatialList.size(); i++ )
202 {
203 mnl = spatialList.at( i );
204 mne = mnl.toElement();
206 se.extentCrs = QgsCoordinateReferenceSystem( mne.attribute( u"crs"_s ) );
207 se.bounds = QgsBox3D();
208 se.bounds.setXMinimum( mne.attribute( u"minx"_s ).toDouble() );
209 se.bounds.setYMinimum( mne.attribute( u"miny"_s ).toDouble() );
210 se.bounds.setZMinimum( mne.attribute( u"minz"_s ).toDouble() );
211 se.bounds.setXMaximum( mne.attribute( u"maxx"_s ).toDouble() );
212 se.bounds.setYMaximum( mne.attribute( u"maxy"_s ).toDouble() );
213 se.bounds.setZMaximum( mne.attribute( u"maxz"_s ).toDouble() );
214 metadataSpatialExtents.append( se );
215 }
216 metadataExtent.setSpatialExtents( metadataSpatialExtents );
217
218 // temporal extent
219 mnl = metadataElement.namedItem( u"extent"_s );
220 const QDomNodeList temporalList = mnl.toElement().elementsByTagName( u"temporal"_s );
221 QList<QgsDateTimeRange> metadataDates;
222 for ( int j = 0; j < temporalList.size(); j++ )
223 {
224 mnl = temporalList.at( j );
225 const QDomNodeList instantList = mnl.toElement().elementsByTagName( u"instant"_s );
226 for ( int i = 0; i < instantList.size(); i++ )
227 {
228 mnl = instantList.at( i );
229 const QDateTime d = QDateTime::fromString( mnl.toElement().text(), Qt::ISODate );
230 const QgsDateTimeRange date = QgsDateTimeRange( d, d );
231 metadataDates << date;
232 }
233 const QDomNodeList periodList = mnl.toElement().elementsByTagName( u"period"_s );
234 for ( int i = 0; i < periodList.size(); i++ )
235 {
236 const QDomNode begin = periodList.at( i ).namedItem( u"start"_s );
237 const QDomNode end = periodList.at( i ).namedItem( u"end"_s );
238 const QDateTime beginDate = QDateTime::fromString( begin.toElement().text(), Qt::ISODate );
239 const QDateTime endDate = QDateTime::fromString( end.toElement().text(), Qt::ISODate );
240 const QgsDateTimeRange date = QgsDateTimeRange( beginDate, endDate );
241 metadataDates << date;
242 }
243 }
244 metadataExtent.setTemporalExtents( metadataDates );
245 setExtent( metadataExtent );
246
247 return true;
248}
249
250bool QgsLayerMetadata::writeMetadataXml( QDomElement &metadataElement, QDomDocument &document, const QgsReadWriteContext &context ) const
251{
252 QgsAbstractMetadataBase::writeMetadataXml( metadataElement, document, context );
253
254 // fees
255 QDomElement fees = document.createElement( u"fees"_s );
256 const QDomText feesText = document.createTextNode( mFees );
257 fees.appendChild( feesText );
258 metadataElement.appendChild( fees );
259
260 // constraints
261 for ( const QgsLayerMetadata::Constraint &constraint : mConstraints )
262 {
263 QDomElement constraintElement = document.createElement( u"constraints"_s );
264 constraintElement.setAttribute( u"type"_s, constraint.type );
265 const QDomText constraintText = document.createTextNode( constraint.constraint );
266 constraintElement.appendChild( constraintText );
267 metadataElement.appendChild( constraintElement );
268 }
269
270 // rights
271 for ( const QString &right : mRights )
272 {
273 QDomElement rightElement = document.createElement( u"rights"_s );
274 const QDomText rightText = document.createTextNode( right );
275 rightElement.appendChild( rightText );
276 metadataElement.appendChild( rightElement );
277 }
278
279 // license
280 for ( const QString &license : mLicenses )
281 {
282 QDomElement licenseElement = document.createElement( u"license"_s );
283 const QDomText licenseText = document.createTextNode( license );
284 licenseElement.appendChild( licenseText );
285 metadataElement.appendChild( licenseElement );
286 }
287
288 // encoding
289 QDomElement encoding = document.createElement( u"encoding"_s );
290 const QDomText encodingText = document.createTextNode( mEncoding );
291 encoding.appendChild( encodingText );
292 metadataElement.appendChild( encoding );
293
294 // crs
295 QDomElement crsElement = document.createElement( u"crs"_s );
296 mCrs.writeXml( crsElement, document );
297 metadataElement.appendChild( crsElement );
298
299 // extent
300 QDomElement extentElement = document.createElement( u"extent"_s );
301
302 // spatial extents
303 const QList< QgsLayerMetadata::SpatialExtent > sExtents = extent().spatialExtents();
304 for ( const QgsLayerMetadata::SpatialExtent &spatialExtent : sExtents )
305 {
306 QDomElement spatialElement = document.createElement( u"spatial"_s );
307 // Dimensions fixed in the XSD
308 spatialElement.setAttribute( u"dimensions"_s, u"2"_s );
309 spatialElement.setAttribute( u"crs"_s, spatialExtent.extentCrs.authid() );
310 spatialElement.setAttribute( u"minx"_s, qgsDoubleToString( spatialExtent.bounds.xMinimum() ) );
311 spatialElement.setAttribute( u"miny"_s, qgsDoubleToString( spatialExtent.bounds.yMinimum() ) );
312 spatialElement.setAttribute( u"minz"_s, qgsDoubleToString( spatialExtent.bounds.zMinimum() ) );
313 spatialElement.setAttribute( u"maxx"_s, qgsDoubleToString( spatialExtent.bounds.xMaximum() ) );
314 spatialElement.setAttribute( u"maxy"_s, qgsDoubleToString( spatialExtent.bounds.yMaximum() ) );
315 spatialElement.setAttribute( u"maxz"_s, qgsDoubleToString( spatialExtent.bounds.zMaximum() ) );
316 extentElement.appendChild( spatialElement );
317 }
318
319 // temporal extents
320 const QList< QgsDateTimeRange > tExtents = extent().temporalExtents();
321 for ( const QgsDateTimeRange &temporalExtent : tExtents )
322 {
323 QDomElement temporalElement = document.createElement( u"temporal"_s );
324 if ( temporalExtent.isInstant() )
325 {
326 QDomElement instantElement = document.createElement( u"instant"_s );
327 const QDomText instantText = document.createTextNode( temporalExtent.begin().toTimeSpec( Qt::OffsetFromUTC ).toString( Qt::ISODate ) );
328 instantElement.appendChild( instantText );
329 temporalElement.appendChild( instantElement );
330 }
331 else
332 {
333 QDomElement periodElement = document.createElement( u"period"_s );
334 QDomElement startElement = document.createElement( u"start"_s );
335 QDomElement endElement = document.createElement( u"end"_s );
336 const QDomText startText = document.createTextNode( temporalExtent.begin().toTimeSpec( Qt::OffsetFromUTC ).toString( Qt::ISODate ) );
337 const QDomText endText = document.createTextNode( temporalExtent.end().toTimeSpec( Qt::OffsetFromUTC ).toString( Qt::ISODate ) );
338 startElement.appendChild( startText );
339 endElement.appendChild( endText );
340 periodElement.appendChild( startElement );
341 periodElement.appendChild( endElement );
342 temporalElement.appendChild( periodElement );
343 }
344 extentElement.appendChild( temporalElement );
345 }
346
347 metadataElement.appendChild( extentElement );
348
349 return true;
350}
351
353{
355
356 for ( const QString &right : std::as_const( mRights ) )
357 {
358 translationContext->registerTranslation( u"metadata"_s, right );
359 }
360}
361
363{
365
366 if ( const QgsLayerMetadata *otherLayerMetadata = dynamic_cast< const QgsLayerMetadata * >( other ) )
367 {
368 if ( !otherLayerMetadata->fees().isEmpty() )
369 mFees = otherLayerMetadata->fees();
370
371 if ( !otherLayerMetadata->constraints().isEmpty() )
372 mConstraints = otherLayerMetadata->constraints();
373
374 if ( !otherLayerMetadata->rights().isEmpty() )
375 mRights = otherLayerMetadata->rights();
376
377 if ( !otherLayerMetadata->licenses().isEmpty() )
378 mLicenses = otherLayerMetadata->licenses();
379
380 if ( !otherLayerMetadata->encoding().isEmpty() )
381 mEncoding = otherLayerMetadata->encoding();
382
383 if ( otherLayerMetadata->crs().isValid() )
384 mCrs = otherLayerMetadata->crs();
385
386 if ( !otherLayerMetadata->extent().spatialExtents().isEmpty() )
387 mExtent.setSpatialExtents( otherLayerMetadata->extent().spatialExtents() );
388
389 if ( !otherLayerMetadata->extent().temporalExtents().isEmpty() )
390 mExtent.setTemporalExtents( otherLayerMetadata->extent().temporalExtents() );
391 }
392}
393
395{
396 return mExtent;
397}
398
400{
401 return mExtent;
402}
403
405{
406 mExtent = extent;
407}
408
409QList<QgsLayerMetadata::SpatialExtent> QgsLayerMetadata::Extent::spatialExtents() const
410{
411 return mSpatialExtents;
412}
413
414void QgsLayerMetadata::Extent::setSpatialExtents( const QList<QgsLayerMetadata::SpatialExtent> &spatialExtents )
415{
416 mSpatialExtents = spatialExtents;
417}
418
419QList<QgsDateTimeRange> QgsLayerMetadata::Extent::temporalExtents() const
420{
421 return mTemporalExtents;
422}
423
425{
426 mTemporalExtents = temporalExtents;
427}
428
430{
431 return mSpatialExtents == other.mSpatialExtents && mTemporalExtents == other.mTemporalExtents;
432}
433
435{
436 return equals( other ) &&
437 mFees == other.mFees &&
438 mConstraints == other.mConstraints &&
439 mRights == other.mRights &&
440 mLicenses == other.mLicenses &&
441 mEncoding == other.mEncoding &&
442 mCrs == other.mCrs &&
443 mExtent == other.mExtent;
444}
445
446bool QgsLayerMetadata::contains( const QString &searchString ) const
447{
448
449 if ( searchString.trimmed().isEmpty() )
450 {
451 return false;
452 }
453
454 if ( title().contains( searchString, Qt::CaseInsensitive ) ||
455 identifier().contains( searchString, Qt::CaseInsensitive ) ||
456 abstract().contains( searchString, Qt::CaseInsensitive ) )
457 {
458 return true;
459 }
460
461 const QList<QStringList> keyVals { keywords().values() };
462 for ( const QStringList &kws : std::as_const( keyVals ) )
463 {
464 for ( const QString &kw : std::as_const( kws ) )
465 {
466 if ( kw.contains( searchString, Qt::CaseSensitivity::CaseInsensitive ) )
467 {
468 return true;
469 }
470 }
471 }
472
473 const QStringList constCat { categories() };
474 for ( const QString &cat : std::as_const( constCat ) )
475 {
476 if ( cat.contains( searchString, Qt::CaseSensitivity::CaseInsensitive ) )
477 {
478 return true;
479 }
480 }
481
482 return false;
483}
484
485bool QgsLayerMetadata::matches( const QVector<QRegularExpression> &searchReList ) const
486{
487 for ( const QRegularExpression &re : std::as_const( searchReList ) )
488 {
489 if ( re.match( title() ).hasMatch() ||
490 re.match( identifier() ).hasMatch() ||
491 re.match( abstract() ).hasMatch() )
492 {
493 return true;
494 }
495
496 const QList<QStringList> keyVals { keywords().values() };
497 for ( const QStringList &kws : std::as_const( keyVals ) )
498 {
499 for ( const QString &kw : std::as_const( kws ) )
500 {
501 if ( re.match( kw ).hasMatch() )
502 {
503 return true;
504 }
505 }
506 }
507
508 const QStringList constCat { categories() };
509 for ( const QString &cat : std::as_const( constCat ) )
510 {
511 if ( re.match( cat ).hasMatch() )
512 {
513 return true;
514 }
515 }
516
517 }
518
519 return false;
520}
521
523{
524 return extentCrs == other.extentCrs &&
525 bounds == other.bounds;
526}
527
529{
530 return type == other.type && constraint == other.constraint;
531}
QgsAbstractMetadataBase::ContactList mContacts
QMap< QString, QStringList > KeywordMap
Map of vocabulary string to keyword list.
virtual void combine(const QgsAbstractMetadataBase *other)
Combines the metadata from this object with the metadata from an other object.
QStringList categories() const
Returns categories of the resource.
QString abstract() const
Returns a free-form description of the resource.
QString title() const
Returns the human readable name of the resource, typically displayed in search results.
virtual bool writeMetadataXml(QDomElement &metadataElement, QDomDocument &document, const QgsReadWriteContext &context=QgsReadWriteContext()) const
Stores state in a DOM node.
QgsAbstractMetadataBase::KeywordMap mKeywords
Keywords map.
QgsAbstractMetadataBase::KeywordMap keywords() const
Returns the keywords map, which is a set of descriptive keywords associated with the resource.
bool equals(const QgsAbstractMetadataBase &other) const
Tests whether the common metadata fields in this object are equal to other.
virtual void registerTranslations(QgsTranslationContext *translationContext) const
Registers metadata translation strings.
QgsAbstractMetadataBase::LinkList mLinks
QString identifier() const
A reference, URI, URL or some other mechanism to identify the resource.
QgsAbstractMetadataBase()=default
Constructor for QgsAbstractMetadataBase.
virtual bool readMetadataXml(const QDomElement &metadataElement, const QgsReadWriteContext &context=QgsReadWriteContext())
Sets state from DOM document.
A 3-dimensional box composed of x, y, z coordinates.
Definition qgsbox3d.h:45
void setZMinimum(double z)
Sets the minimum z value.
Definition qgsbox3d.cpp:94
void setYMaximum(double y)
Sets the maximum y value.
Definition qgsbox3d.cpp:89
void setZMaximum(double z)
Sets the maximum z value.
Definition qgsbox3d.cpp:99
void setXMaximum(double x)
Sets the maximum x value.
Definition qgsbox3d.cpp:79
void setYMinimum(double y)
Sets the minimum y value.
Definition qgsbox3d.cpp:84
void setXMinimum(double x)
Sets the minimum x value.
Definition qgsbox3d.cpp:74
Represents a coordinate reference system (CRS).
static QgsCoordinateReferenceSystem fromOgcWmsCrs(const QString &ogcCrs)
Creates a CRS from a given OGC WMS-format Coordinate Reference System string.
void addConstraint(const QgsLayerMetadata::Constraint &constraint)
Adds an individual constraint to the existing constraints.
const QgsLayerMetadata::Extent & extent() const
Returns the spatial and temporal extents associated with the resource.
void setConstraints(const QgsLayerMetadata::ConstraintList &constraints)
Sets the list of constraints associated with using the resource.
QgsLayerMetadata()=default
void setFees(const QString &fees)
Sets the fees associated with using the resource.
void setLicenses(const QStringList &licenses)
Sets a list of licenses associated with the resource.
bool operator==(const QgsLayerMetadata &metadataOther) const
QgsLayerMetadata::ConstraintList constraints() const
Returns a list of constraints associated with using the resource.
bool writeMetadataXml(QDomElement &metadataElement, QDomDocument &document, const QgsReadWriteContext &context=QgsReadWriteContext()) const override
Stores state in a DOM node.
void setRights(const QStringList &rights)
Sets a list of rights (attribution or copyright strings) associated with the resource.
QgsCoordinateReferenceSystem crs() const
Returns the coordinate reference system described by the layer's metadata.
void setEncoding(const QString &encoding)
Sets the character encoding of the data in the resource.
QString encoding() const
Returns the character encoding of the data in the resource.
void combine(const QgsAbstractMetadataBase *other) override
Combines the metadata from this object with the metadata from an other object.
QStringList licenses() const
Returns a list of licenses associated with the resource (examples: http://opendefinition....
void registerTranslations(QgsTranslationContext *translationContext) const override
Registers metadata translation strings.
void readFromLayer(const QgsMapLayer *layer)
Reads the metadata state from a layer's custom properties (see QgsMapLayer::customProperty() ).
void saveToLayer(QgsMapLayer *layer) const
Saves the metadata to a layer's custom properties (see QgsMapLayer::setCustomProperty() ).
QStringList rights() const
Returns a list of attribution or copyright strings associated with the resource.
QgsLayerMetadata * clone() const override
Clones the metadata object.
void setExtent(const QgsLayerMetadata::Extent &extent)
Sets the spatial and temporal extents associated with the resource.
bool readMetadataXml(const QDomElement &metadataElement, const QgsReadWriteContext &context=QgsReadWriteContext()) override
Sets state from DOM document.
bool matches(const QVector< QRegularExpression > &searchReList) const
Returns true if the metadata identifier, title, abstract, keywords or categories matches any regular ...
bool contains(const QString &searchString) const
Returns true if the metadata identifier, title, abstract, keywords or categories contain searchString...
QList< QgsLayerMetadata::Constraint > ConstraintList
A list of constraints.
QString fees() const
Returns any fees associated with using the resource.
void setCrs(const QgsCoordinateReferenceSystem &crs)
Sets the coordinate reference system for the layer's metadata.
Base class for all map layer types.
Definition qgsmaplayer.h:83
Q_INVOKABLE QVariant customProperty(const QString &value, const QVariant &defaultValue=QVariant()) const
Read a custom property from layer.
Q_INVOKABLE void setCustomProperty(const QString &key, const QVariant &value)
Set a custom property for layer.
virtual QString translate(const QString &context, const QString &sourceText, const char *disambiguation=nullptr, int n=-1) const =0
Translates a string using the Qt QTranslator mechanism.
A container for the context for various read/write operations on objects.
const QgsProjectTranslator * projectTranslator() const
Returns the project translator.
Used for the collecting of strings from projects for translation and creation of ts files.
void registerTranslation(const QString &context, const QString &source)
Registers the source to be translated.
QList< QgsAbstractMetadataBase::Link > LinkList
A list of links.
QList< QgsAbstractMetadataBase::Contact > ContactList
A list of contacts.
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
Definition qgis.h:6817
QgsTemporalRange< QDateTime > QgsDateTimeRange
QgsRange which stores a range of date times.
Definition qgsrange.h:764
Metadata constraint structure.
bool operator==(const QgsLayerMetadata::Constraint &other) const
QString constraint
Free-form constraint string.
QString type
Constraint type.
Metadata extent structure.
QList< QgsLayerMetadata::SpatialExtent > spatialExtents() const
Spatial extents of the resource.
void setSpatialExtents(const QList< QgsLayerMetadata::SpatialExtent > &extents)
Sets the spatial extents of the resource.
bool operator==(const QgsLayerMetadata::Extent &other) const
void setTemporalExtents(const QList< QgsDateTimeRange > &extents)
Sets the temporal extents of the resource.
QList< QgsDateTimeRange > temporalExtents() const
Temporal extents of the resource.
Metadata spatial extent structure.
QgsCoordinateReferenceSystem extentCrs
Coordinate reference system for spatial extent.
QgsBox3D bounds
Geospatial extent of the resource.
bool operator==(const QgsLayerMetadata::SpatialExtent &other) const