QGIS API Documentation 4.3.0-Master (389d690bb77)
Loading...
Searching...
No Matches
qgsstacobject.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsstacobject.cpp
3 ---------------------
4 begin : August 2024
5 copyright : (C) 2024 by Stefanos Natsis
6 email : uclaros at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#include "qgsstacobject.h"
17
18#include <QString>
19
20using namespace Qt::StringLiterals;
21
22QgsStacObject::QgsStacObject( const QString &id, const QString &version, const QVector< QgsStacLink > &links )
23 : mId( id )
24 , mStacVersion( version )
25 , mLinks( links )
26{}
27
29{
30 return mStacVersion;
31}
32
33void QgsStacObject::setStacVersion( const QString &version )
34{
35 mStacVersion = version;
36}
37
39{
40 return mStacExtensions;
41}
42
43void QgsStacObject::setStacExtensions( const QStringList &extensions )
44{
45 mStacExtensions = extensions;
46}
47
48QString QgsStacObject::id() const
49{
50 return mId;
51}
52
53void QgsStacObject::setId( const QString &id )
54{
55 mId = id;
56}
57
58QVector< QgsStacLink > QgsStacObject::links() const
59{
60 return mLinks;
61}
62
63void QgsStacObject::setLinks( const QVector< QgsStacLink > &links )
64{
65 mLinks = links;
66}
67
68QString QgsStacObject::url() const
69{
70 for ( const QgsStacLink &link : mLinks )
71 {
72 if ( link.relation() == "self"_L1 )
73 return link.href();
74 }
75 return QString();
76}
77
79{
80 for ( const QgsStacLink &link : mLinks )
81 {
82 if ( link.relation() == "root"_L1 )
83 return link.href();
84 }
85 return QString();
86}
87
89{
90 for ( const QgsStacLink &link : mLinks )
91 {
92 if ( link.relation() == "parent"_L1 )
93 return link.href();
94 }
95 return QString();
96}
QString stacVersion() const
Returns the STAC version the object implements.
QString id() const
Id of the STAC object.
QStringList stacExtensions() const
Returns the list of extensions the STAC object implements.
QString parentUrl() const
Returns the url stored in the object's "parent" link.
QString rootUrl() const
Returns the url stored in the object's "root" link.
void setStacExtensions(const QStringList &stacExtensions)
Sets the list of stacExtensions the object implements.
QVector< QgsStacLink > mLinks
QgsStacObject()=delete
Default constructor is used for creating invalid objects.
void setId(const QString &id)
Sets the id for the STAC object.
void setStacVersion(const QString &stacVersion)
Sets the STAC version the object implements.
void setLinks(const QVector< QgsStacLink > &links)
Sets the STAC links included in the object.
QString url() const
Returns the url stored in the object's "self" link.
QStringList mStacExtensions
QString mStacVersion
QVector< QgsStacLink > links() const
Returns the STAC links included in the object.