QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
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#include "qgsmaplayer.h"
20#include <QRegularExpression>
21
23{
24 return new QgsLayerMetadata( *this );
25}
26
28{
29 return mFees;
30}
31
32void QgsLayerMetadata::setFees( const QString &fees )
33{
34 mFees = fees;
35}
36
38{
39 mConstraints << constraint;
40}
41
42QList<QgsLayerMetadata::Constraint> QgsLayerMetadata::constraints() const
43{
44 return mConstraints;
45}
46
47void QgsLayerMetadata::setConstraints( const QList<Constraint> &constraints )
48{
49 mConstraints = constraints;
50}
51
52QStringList QgsLayerMetadata::rights() const
53{
54 return mRights;
55}
56
57void QgsLayerMetadata::setRights( const QStringList &rights )
58{
59 mRights = rights;
60}
61
62QStringList QgsLayerMetadata::licenses() const
63{
64 return mLicenses;
65}
66
67void QgsLayerMetadata::setLicenses( const QStringList &licenses )
68{
69 mLicenses = licenses;
70}
71
73{
74 return mEncoding;
75}
76
77void QgsLayerMetadata::setEncoding( const QString &encoding )
78{
79 mEncoding = encoding;
80}
81
83{
84 return mCrs;
85}
86
88{
89 mCrs = crs;
90}
91
93{
94 layer->setCustomProperty( QStringLiteral( "metadata/identifier" ), mIdentifier );
95 layer->setCustomProperty( QStringLiteral( "metadata/parentIdentifier" ), mParentIdentifier );
96 layer->setCustomProperty( QStringLiteral( "metadata/language" ), mLanguage );
97 layer->setCustomProperty( QStringLiteral( "metadata/type" ), mType );
98 layer->setCustomProperty( QStringLiteral( "metadata/title" ), mTitle );
99 layer->setCustomProperty( QStringLiteral( "metadata/extent" ), QVariant::fromValue( mExtent ) );
100 layer->setCustomProperty( QStringLiteral( "metadata/abstract" ), mAbstract );
101 layer->setCustomProperty( QStringLiteral( "metadata/fees" ), mFees );
102 layer->setCustomProperty( QStringLiteral( "metadata/rights" ), mRights );
103 layer->setCustomProperty( QStringLiteral( "metadata/licenses" ), mLicenses );
104 layer->setCustomProperty( QStringLiteral( "metadata/history" ), mHistory );
105 layer->setCustomProperty( QStringLiteral( "metadata/encoding" ), mEncoding );
106 layer->setCustomProperty( QStringLiteral( "metadata/crs" ), mCrs.authid() );
107 layer->setCustomProperty( QStringLiteral( "metadata/constraints" ), QVariant::fromValue( mConstraints ) );
108 layer->setCustomProperty( QStringLiteral( "metadata/keywords" ), QVariant::fromValue( mKeywords ) );
109 layer->setCustomProperty( QStringLiteral( "metadata/contacts" ), QVariant::fromValue( mContacts ) );
110 layer->setCustomProperty( QStringLiteral( "metadata/links" ), QVariant::fromValue( mLinks ) );
111}
112
114{
115 mIdentifier = layer->customProperty( QStringLiteral( "metadata/identifier" ) ).toString();
116 mParentIdentifier = layer->customProperty( QStringLiteral( "metadata/parentIdentifier" ) ).toString();
117 mLanguage = layer->customProperty( QStringLiteral( "metadata/language" ) ).toString();
118 mType = layer->customProperty( QStringLiteral( "metadata/type" ) ).toString();
119 mTitle = layer->customProperty( QStringLiteral( "metadata/title" ) ).toString();
120 mAbstract = layer->customProperty( QStringLiteral( "metadata/abstract" ) ).toString();
121 mFees = layer->customProperty( QStringLiteral( "metadata/fees" ) ).toString();
122 mRights = layer->customProperty( QStringLiteral( "metadata/rights" ) ).toStringList();
123 mLicenses = layer->customProperty( QStringLiteral( "metadata/licenses" ) ).toStringList();
124 mHistory = layer->customProperty( QStringLiteral( "metadata/history" ) ).toStringList();
125 mEncoding = layer->customProperty( QStringLiteral( "metadata/encoding" ) ).toString();
126 const QString crsAuthId = layer->customProperty( QStringLiteral( "metadata/crs" ) ).toString();
128 mExtent = layer->customProperty( QStringLiteral( "metadata/extent" ) ).value<Extent>();
129 mConstraints = layer->customProperty( QStringLiteral( "metadata/constraints" ) ).value<ConstraintList>();
130 mKeywords = layer->customProperty( QStringLiteral( "metadata/keywords" ) ).value<QgsAbstractMetadataBase::KeywordMap>();
131 mContacts = layer->customProperty( QStringLiteral( "metadata/contacts" ) ).value<QgsAbstractMetadataBase::ContactList>();
132 mLinks = layer->customProperty( QStringLiteral( "metadata/links" ) ).value<QgsAbstractMetadataBase::LinkList>();
133}
134
135bool QgsLayerMetadata::readMetadataXml( const QDomElement &metadataElement )
136{
138
139 QDomNode mnl;
140 QDomElement mne;
141
142 // set fees
143 mnl = metadataElement.namedItem( QStringLiteral( "fees" ) );
144 mFees = mnl.toElement().text();
145
146 // constraints
147 const QDomNodeList constraintsList = metadataElement.elementsByTagName( QStringLiteral( "constraints" ) );
148 mConstraints.clear();
149 for ( int i = 0; i < constraintsList.size(); i++ )
150 {
151 mnl = constraintsList.at( i );
152 mne = mnl.toElement();
153 addConstraint( QgsLayerMetadata::Constraint( mne.text(), mne.attribute( QStringLiteral( "type" ) ) ) );
154 }
155
156 // rights
157 const QDomNodeList rightsNodeList = metadataElement.elementsByTagName( QStringLiteral( "rights" ) );
158 QStringList rightsList;
159 for ( int i = 0; i < rightsNodeList.size(); i++ )
160 {
161 mnl = rightsNodeList.at( i );
162 mne = mnl.toElement();
163 rightsList.append( mne.text() );
164 }
165 setRights( rightsList );
166
167 // licenses
168 const QDomNodeList licensesNodeList = metadataElement.elementsByTagName( QStringLiteral( "license" ) );
169 QStringList licensesList;
170 for ( int i = 0; i < licensesNodeList.size(); i++ )
171 {
172 mnl = licensesNodeList.at( i );
173 mne = mnl.toElement();
174 licensesList.append( mne.text() );
175 }
176 setLicenses( licensesList );
177
178 // encoding
179 mnl = metadataElement.namedItem( QStringLiteral( "encoding" ) );
180 mEncoding = mnl.toElement().text();
181
182 // crs
183 mnl = metadataElement.namedItem( QStringLiteral( "crs" ) );
184 if ( !mCrs.readXml( mnl ) )
186
187 // extent
188 mnl = metadataElement.namedItem( QStringLiteral( "extent" ) );
189 QgsLayerMetadata::Extent metadataExtent;
190
191 // spatial extent
192 const QDomNodeList spatialList = mnl.toElement().elementsByTagName( QStringLiteral( "spatial" ) );
193 QList< QgsLayerMetadata::SpatialExtent > metadataSpatialExtents;
194 for ( int i = 0; i < spatialList.size(); i++ )
195 {
196 mnl = spatialList.at( i );
197 mne = mnl.toElement();
199 se.extentCrs = QgsCoordinateReferenceSystem( mne.attribute( QStringLiteral( "crs" ) ) );
200 se.bounds = QgsBox3d();
201 se.bounds.setXMinimum( mne.attribute( QStringLiteral( "minx" ) ).toDouble() );
202 se.bounds.setYMinimum( mne.attribute( QStringLiteral( "miny" ) ).toDouble() );
203 se.bounds.setZMinimum( mne.attribute( QStringLiteral( "minz" ) ).toDouble() );
204 se.bounds.setXMaximum( mne.attribute( QStringLiteral( "maxx" ) ).toDouble() );
205 se.bounds.setYMaximum( mne.attribute( QStringLiteral( "maxy" ) ).toDouble() );
206 se.bounds.setZMaximum( mne.attribute( QStringLiteral( "maxz" ) ).toDouble() );
207 metadataSpatialExtents.append( se );
208 }
209 metadataExtent.setSpatialExtents( metadataSpatialExtents );
210
211 // temporal extent
212 mnl = metadataElement.namedItem( QStringLiteral( "extent" ) );
213 const QDomNodeList temporalList = mnl.toElement().elementsByTagName( QStringLiteral( "temporal" ) );
214 QList<QgsDateTimeRange> metadataDates;
215 for ( int j = 0; j < temporalList.size(); j++ )
216 {
217 mnl = temporalList.at( j );
218 const QDomNodeList instantList = mnl.toElement().elementsByTagName( QStringLiteral( "instant" ) );
219 for ( int i = 0; i < instantList.size(); i++ )
220 {
221 mnl = instantList.at( i );
222 const QDateTime d = QDateTime::fromString( mnl.toElement().text(), Qt::ISODate );
223 const QgsDateTimeRange date = QgsDateTimeRange( d, d );
224 metadataDates << date;
225 }
226 const QDomNodeList periodList = mnl.toElement().elementsByTagName( QStringLiteral( "period" ) );
227 for ( int i = 0; i < periodList.size(); i++ )
228 {
229 const QDomNode begin = periodList.at( i ).namedItem( QStringLiteral( "start" ) );
230 const QDomNode end = periodList.at( i ).namedItem( QStringLiteral( "end" ) );
231 const QDateTime beginDate = QDateTime::fromString( begin.toElement().text(), Qt::ISODate );
232 const QDateTime endDate = QDateTime::fromString( end.toElement().text(), Qt::ISODate );
233 const QgsDateTimeRange date = QgsDateTimeRange( beginDate, endDate );
234 metadataDates << date;
235 }
236 }
237 metadataExtent.setTemporalExtents( metadataDates );
238 setExtent( metadataExtent );
239
240 return true;
241}
242
243bool QgsLayerMetadata::writeMetadataXml( QDomElement &metadataElement, QDomDocument &document ) const
244{
245 QgsAbstractMetadataBase::writeMetadataXml( metadataElement, document );
246
247 // fees
248 QDomElement fees = document.createElement( QStringLiteral( "fees" ) );
249 const QDomText feesText = document.createTextNode( mFees );
250 fees.appendChild( feesText );
251 metadataElement.appendChild( fees );
252
253 // constraints
254 for ( const QgsLayerMetadata::Constraint &constraint : mConstraints )
255 {
256 QDomElement constraintElement = document.createElement( QStringLiteral( "constraints" ) );
257 constraintElement.setAttribute( QStringLiteral( "type" ), constraint.type );
258 const QDomText constraintText = document.createTextNode( constraint.constraint );
259 constraintElement.appendChild( constraintText );
260 metadataElement.appendChild( constraintElement );
261 }
262
263 // rights
264 for ( const QString &right : mRights )
265 {
266 QDomElement rightElement = document.createElement( QStringLiteral( "rights" ) );
267 const QDomText rightText = document.createTextNode( right );
268 rightElement.appendChild( rightText );
269 metadataElement.appendChild( rightElement );
270 }
271
272 // license
273 for ( const QString &license : mLicenses )
274 {
275 QDomElement licenseElement = document.createElement( QStringLiteral( "license" ) );
276 const QDomText licenseText = document.createTextNode( license );
277 licenseElement.appendChild( licenseText );
278 metadataElement.appendChild( licenseElement );
279 }
280
281 // encoding
282 QDomElement encoding = document.createElement( QStringLiteral( "encoding" ) );
283 const QDomText encodingText = document.createTextNode( mEncoding );
284 encoding.appendChild( encodingText );
285 metadataElement.appendChild( encoding );
286
287 // crs
288 QDomElement crsElement = document.createElement( QStringLiteral( "crs" ) );
289 mCrs.writeXml( crsElement, document );
290 metadataElement.appendChild( crsElement );
291
292 // extent
293 QDomElement extentElement = document.createElement( QStringLiteral( "extent" ) );
294
295 // spatial extents
296 const QList< QgsLayerMetadata::SpatialExtent > sExtents = extent().spatialExtents();
297 for ( const QgsLayerMetadata::SpatialExtent &spatialExtent : sExtents )
298 {
299 QDomElement spatialElement = document.createElement( QStringLiteral( "spatial" ) );
300 // Dimensions fixed in the XSD
301 spatialElement.setAttribute( QStringLiteral( "dimensions" ), QStringLiteral( "2" ) );
302 spatialElement.setAttribute( QStringLiteral( "crs" ), spatialExtent.extentCrs.authid() );
303 spatialElement.setAttribute( QStringLiteral( "minx" ), qgsDoubleToString( spatialExtent.bounds.xMinimum() ) );
304 spatialElement.setAttribute( QStringLiteral( "miny" ), qgsDoubleToString( spatialExtent.bounds.yMinimum() ) );
305 spatialElement.setAttribute( QStringLiteral( "minz" ), qgsDoubleToString( spatialExtent.bounds.zMinimum() ) );
306 spatialElement.setAttribute( QStringLiteral( "maxx" ), qgsDoubleToString( spatialExtent.bounds.xMaximum() ) );
307 spatialElement.setAttribute( QStringLiteral( "maxy" ), qgsDoubleToString( spatialExtent.bounds.yMaximum() ) );
308 spatialElement.setAttribute( QStringLiteral( "maxz" ), qgsDoubleToString( spatialExtent.bounds.zMaximum() ) );
309 extentElement.appendChild( spatialElement );
310 }
311
312 // temporal extents
313 const QList< QgsDateTimeRange > tExtents = extent().temporalExtents();
314 for ( const QgsDateTimeRange &temporalExtent : tExtents )
315 {
316 QDomElement temporalElement = document.createElement( QStringLiteral( "temporal" ) );
317 if ( temporalExtent.isInstant() )
318 {
319 QDomElement instantElement = document.createElement( QStringLiteral( "instant" ) );
320 const QDomText instantText = document.createTextNode( temporalExtent.begin().toTimeSpec( Qt::OffsetFromUTC ).toString( Qt::ISODate ) );
321 instantElement.appendChild( instantText );
322 temporalElement.appendChild( instantElement );
323 }
324 else
325 {
326 QDomElement periodElement = document.createElement( QStringLiteral( "period" ) );
327 QDomElement startElement = document.createElement( QStringLiteral( "start" ) );
328 QDomElement endElement = document.createElement( QStringLiteral( "end" ) );
329 const QDomText startText = document.createTextNode( temporalExtent.begin().toTimeSpec( Qt::OffsetFromUTC ).toString( Qt::ISODate ) );
330 const QDomText endText = document.createTextNode( temporalExtent.end().toTimeSpec( Qt::OffsetFromUTC ).toString( Qt::ISODate ) );
331 startElement.appendChild( startText );
332 endElement.appendChild( endText );
333 periodElement.appendChild( startElement );
334 periodElement.appendChild( endElement );
335 temporalElement.appendChild( periodElement );
336 }
337 extentElement.appendChild( temporalElement );
338 }
339
340 metadataElement.appendChild( extentElement );
341
342 return true;
343}
344
346{
348
349 if ( const QgsLayerMetadata *otherLayerMetadata = dynamic_cast< const QgsLayerMetadata * >( other ) )
350 {
351 if ( !otherLayerMetadata->fees().isEmpty() )
352 mFees = otherLayerMetadata->fees();
353
354 if ( !otherLayerMetadata->constraints().isEmpty() )
355 mConstraints = otherLayerMetadata->constraints();
356
357 if ( !otherLayerMetadata->rights().isEmpty() )
358 mRights = otherLayerMetadata->rights();
359
360 if ( !otherLayerMetadata->licenses().isEmpty() )
361 mLicenses = otherLayerMetadata->licenses();
362
363 if ( !otherLayerMetadata->encoding().isEmpty() )
364 mEncoding = otherLayerMetadata->encoding();
365
366 if ( otherLayerMetadata->crs().isValid() )
367 mCrs = otherLayerMetadata->crs();
368
369 if ( !otherLayerMetadata->extent().spatialExtents().isEmpty() )
370 mExtent.setSpatialExtents( otherLayerMetadata->extent().spatialExtents() );
371
372 if ( !otherLayerMetadata->extent().temporalExtents().isEmpty() )
373 mExtent.setTemporalExtents( otherLayerMetadata->extent().temporalExtents() );
374 }
375}
376
378{
379 return mExtent;
380}
381
383{
384 return mExtent;
385}
386
388{
389 mExtent = extent;
390}
391
392QList<QgsLayerMetadata::SpatialExtent> QgsLayerMetadata::Extent::spatialExtents() const
393{
394 return mSpatialExtents;
395}
396
397void QgsLayerMetadata::Extent::setSpatialExtents( const QList<QgsLayerMetadata::SpatialExtent> &spatialExtents )
398{
399 mSpatialExtents = spatialExtents;
400}
401
402QList<QgsDateTimeRange> QgsLayerMetadata::Extent::temporalExtents() const
403{
404 return mTemporalExtents;
405}
406
407void QgsLayerMetadata::Extent::setTemporalExtents( const QList<QgsDateTimeRange> &temporalExtents )
408{
409 mTemporalExtents = temporalExtents;
410}
411
413{
414 return mSpatialExtents == other.mSpatialExtents && mTemporalExtents == other.mTemporalExtents;
415}
416
418{
419 return equals( other ) &&
420 mFees == other.mFees &&
421 mConstraints == other.mConstraints &&
422 mRights == other.mRights &&
423 mLicenses == other.mLicenses &&
424 mEncoding == other.mEncoding &&
425 mCrs == other.mCrs &&
426 mExtent == other.mExtent;
427}
428
429bool QgsLayerMetadata::contains( const QString &searchString ) const
430{
431
432 if ( searchString.trimmed().isEmpty() )
433 {
434 return false;
435 }
436
437 if ( title().contains( searchString, Qt::CaseInsensitive ) ||
438 identifier().contains( searchString, Qt::CaseInsensitive ) ||
439 abstract().contains( searchString, Qt::CaseInsensitive ) )
440 {
441 return true;
442 }
443
444 const QList<QStringList> keyVals { keywords().values() };
445 for ( const QStringList &kws : std::as_const( keyVals ) )
446 {
447 for ( const QString &kw : std::as_const( kws ) )
448 {
449 if ( kw.contains( searchString, Qt::CaseSensitivity::CaseInsensitive ) )
450 {
451 return true;
452 }
453 }
454 }
455
456 const QStringList constCat { categories() };
457 for ( const QString &cat : std::as_const( constCat ) )
458 {
459 if ( cat.contains( searchString, Qt::CaseSensitivity::CaseInsensitive ) )
460 {
461 return true;
462 }
463 }
464
465 return false;
466}
467
468bool QgsLayerMetadata::matches( const QVector<QRegularExpression> &searchReList ) const
469{
470 for ( const QRegularExpression &re : std::as_const( searchReList ) )
471 {
472 if ( re.match( title() ).hasMatch() ||
473 re.match( identifier() ).hasMatch() ||
474 re.match( abstract() ).hasMatch() )
475 {
476 return true;
477 }
478
479 const QList<QStringList> keyVals { keywords().values() };
480 for ( const QStringList &kws : std::as_const( keyVals ) )
481 {
482 for ( const QString &kw : std::as_const( kws ) )
483 {
484 if ( re.match( kw ).hasMatch() )
485 {
486 return true;
487 }
488 }
489 }
490
491 const QStringList constCat { categories() };
492 for ( const QString &cat : std::as_const( constCat ) )
493 {
494 if ( re.match( cat ).hasMatch() )
495 {
496 return true;
497 }
498 }
499
500 }
501
502 return false;
503}
504
506{
507 return extentCrs == other.extentCrs &&
508 bounds == other.bounds;
509}
510
512{
513 return type == other.type && constraint == other.constraint;
514}
An abstract base class for metadata stores.
QgsAbstractMetadataBase::ContactList mContacts
virtual bool writeMetadataXml(QDomElement &metadataElement, QDomDocument &document) const
Stores state in a DOM node.
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.
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 bool readMetadataXml(const QDomElement &metadataElement)
Sets state from DOM document.
QgsAbstractMetadataBase::LinkList mLinks
QString type() const
Returns the nature of the resource.
QString identifier() const
A reference, URI, URL or some other mechanism to identify the resource.
A 3-dimensional box composed of x, y, z coordinates.
Definition: qgsbox3d.h:39
void setXMaximum(double x) SIP_HOLDGIL
Sets the maximum x value.
Definition: qgsbox3d.cpp:44
void setYMaximum(double y) SIP_HOLDGIL
Sets the maximum y value.
Definition: qgsbox3d.cpp:54
void setZMinimum(double z) SIP_HOLDGIL
Sets the minimum z value.
Definition: qgsbox3d.cpp:59
void setZMaximum(double z) SIP_HOLDGIL
Sets the maximum z value.
Definition: qgsbox3d.cpp:64
void setYMinimum(double y) SIP_HOLDGIL
Sets the minimum y value.
Definition: qgsbox3d.cpp:49
void setXMinimum(double x) SIP_HOLDGIL
Sets the minimum x value.
Definition: qgsbox3d.cpp:39
This class 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.
bool readXml(const QDomNode &node)
Restores state from the given DOM node.
bool writeXml(QDomNode &node, QDomDocument &doc) const
Stores state to the given Dom node in the given document.
A structured metadata store for a map layer.
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
Constructor for QgsLayerMetadata.
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.
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....
bool readMetadataXml(const QDomElement &metadataElement) override
Sets state from DOM document.
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 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...
bool writeMetadataXml(QDomElement &metadataElement, QDomDocument &document) const override
Stores state in a DOM node.
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:73
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.
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
Definition: qgis.h:3448
const QgsCoordinateReferenceSystem & crs
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.
bool operator==(const QgsLayerMetadata::SpatialExtent &other) const
QgsBox3d bounds
Geospatial extent of the resource.