QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
stac
qgsstaccatalog.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsstaccatalog.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 "
qgsstaccatalog.h
"
17
18
#include <QString>
19
20
using namespace
Qt::StringLiterals;
21
22
QgsStacCatalog::QgsStacCatalog
(
const
QString &
id
,
const
QString &version,
const
QString &
description
,
const
QVector< QgsStacLink > &
links
)
23
:
QgsStacObject
(
id
, version,
links
)
24
,
mDescription
(
description
)
25
{}
26
27
Qgis::StacObjectType
QgsStacCatalog::type
()
const
28
{
29
return
Qgis::StacObjectType::Catalog
;
30
}
31
32
QString
QgsStacCatalog::toHtml
()
const
33
{
34
QString html = u
"<html><head></head>\n<body>\n"
_s;
35
36
html += u
"<h1>%1</h1>\n<hr>\n"
_s.arg(
"Catalog"
_L1 );
37
html +=
"<table class=\"list-view\">\n"
_L1;
38
html += u
"<tr><td class=\"highlight\">%1</td><td>%2</td></tr>\n"
_s.arg( u
"id"
_s,
id
() );
39
html += u
"<tr><td class=\"highlight\">%1</td><td>%2</td></tr>\n"
_s.arg( u
"stac_version"
_s,
stacVersion
() );
40
html += u
"<tr><td class=\"highlight\">%1</td><td>%2</td></tr>\n"
_s.arg( u
"title"
_s,
title
() );
41
html += u
"<tr><td class=\"highlight\">%1</td><td>%2</td></tr>\n"
_s.arg( u
"description"
_s,
description
() );
42
html +=
"</table>\n"
_L1;
43
44
if
( !
mStacExtensions
.isEmpty() )
45
{
46
html += u
"<h1>%1</h1>\n<hr>\n"
_s.arg(
"Extensions"
_L1 );
47
html +=
"<ul>\n"
_L1;
48
for
(
const
QString &extension :
mStacExtensions
)
49
{
50
html += u
"<li>%1</li>\n"
_s.arg( extension );
51
}
52
html +=
"</ul>\n"
_L1;
53
}
54
55
if
( !
mConformanceClasses
.isEmpty() )
56
{
57
html += u
"<h1>%1</h1>\n<hr>\n"
_s.arg(
"Conformance Classes"
_L1 );
58
html +=
"<ul>\n"
_L1;
59
for
(
const
QString &cc :
mConformanceClasses
)
60
{
61
html += u
"<li>%1</li>\n"
_s.arg( cc );
62
}
63
html +=
"</ul>\n"
_L1;
64
}
65
66
html += u
"<h1>%1</h1>\n<hr>\n"
_s.arg(
"Links"
_L1 );
67
for
(
const
QgsStacLink
&link :
mLinks
)
68
{
69
html +=
"<table class=\"list-view\">\n"
_L1;
70
html += u
"<tr><td class=\"highlight\">%1</td><td>%2</td></tr>\n"
_s.arg( u
"relation"
_s, link.relation() );
71
html += u
"<tr><td class=\"highlight\">%1</td><td>%2</td></tr>\n"
_s.arg( u
"title"
_s, link.title() );
72
html += u
"<tr><td class=\"highlight\">%1</td><td><a href=\"%2\">%2</a></td></tr>\n"
_s.arg( u
"url"
_s, link.href() );
73
html += u
"<tr><td class=\"highlight\">%1</td><td>%2</td></tr>\n"
_s.arg( u
"type"
_s, link.mediaType() );
74
html +=
"</table><br/>\n"
_L1;
75
}
76
77
html +=
"\n</body>\n</html>\n"
_L1;
78
return
html;
79
}
80
81
QString
QgsStacCatalog::title
()
const
82
{
83
return
mTitle
;
84
}
85
86
void
QgsStacCatalog::setTitle
(
const
QString &
title
)
87
{
88
mTitle
=
title
;
89
}
90
91
QString
QgsStacCatalog::description
()
const
92
{
93
return
mDescription
;
94
}
95
96
void
QgsStacCatalog::setDescription
(
const
QString &
description
)
97
{
98
mDescription
=
description
;
99
}
100
101
bool
QgsStacCatalog::conformsTo
(
const
QString &conformanceClass )
const
102
{
103
return
mConformanceClasses
.contains( conformanceClass );
104
}
105
106
void
QgsStacCatalog::setConformanceClasses
(
const
QStringList &conformanceClasses )
107
{
108
mConformanceClasses
= QSet< QString >( conformanceClasses.constBegin(), conformanceClasses.constEnd() );
109
}
110
111
void
QgsStacCatalog::addConformanceClass
(
const
QString &conformanceClass )
112
{
113
mConformanceClasses
.insert( conformanceClass );
114
}
Qgis::StacObjectType
StacObjectType
Available types of stac objects.
Definition
qgis.h:7007
Qgis::StacObjectType::Catalog
@ Catalog
STAC catalog.
Definition
qgis.h:7009
QgsStacCatalog::addConformanceClass
void addConformanceClass(const QString &conformanceClass)
Adds conformanceClass to the list of catalog's conformance classes.
Definition
qgsstaccatalog.cpp:111
QgsStacCatalog::toHtml
QString toHtml() const override
Returns an HTML representation of the STAC object.
Definition
qgsstaccatalog.cpp:32
QgsStacCatalog::setTitle
void setTitle(const QString &title)
Sets a short descriptive one-line title for the Catalog.
Definition
qgsstaccatalog.cpp:86
QgsStacCatalog::description
QString description() const
Returns a Detailed multi-line description to fully explain the Catalog.
Definition
qgsstaccatalog.cpp:91
QgsStacCatalog::type
Qgis::StacObjectType type() const override
Returns the Type of the STAC object.
Definition
qgsstaccatalog.cpp:27
QgsStacCatalog::mConformanceClasses
QSet< QString > mConformanceClasses
Definition
qgsstaccatalog.h:80
QgsStacCatalog::mDescription
QString mDescription
Definition
qgsstaccatalog.h:79
QgsStacCatalog::mTitle
QString mTitle
Definition
qgsstaccatalog.h:78
QgsStacCatalog::setConformanceClasses
void setConformanceClasses(const QStringList &conformanceClasses)
Sets the list of conformanceClasses this catalog conforms to.
Definition
qgsstaccatalog.cpp:106
QgsStacCatalog::QgsStacCatalog
QgsStacCatalog()=delete
Default constructor deleted, use the variant with required parameters.
QgsStacCatalog::conformsTo
bool conformsTo(const QString &conformanceClass) const
Checks if the catalog is a STAC API conforming to the specified conformanceClass.
Definition
qgsstaccatalog.cpp:101
QgsStacCatalog::setDescription
void setDescription(const QString &description)
Sets a detailed multi-line description to fully explain the Catalog.
Definition
qgsstaccatalog.cpp:96
QgsStacCatalog::title
QString title() const
Returns a short descriptive one-line title for the Catalog.
Definition
qgsstaccatalog.cpp:81
QgsStacLink
Stores data associated with a STAC link.
Definition
qgsstaclink.h:31
QgsStacObject::stacVersion
QString stacVersion() const
Returns the STAC version the object implements.
Definition
qgsstacobject.cpp:28
QgsStacObject::id
QString id() const
Id of the STAC object.
Definition
qgsstacobject.cpp:48
QgsStacObject::mLinks
QVector< QgsStacLink > mLinks
Definition
qgsstacobject.h:116
QgsStacObject::QgsStacObject
QgsStacObject()=delete
Default constructor is used for creating invalid objects.
QgsStacObject::mStacExtensions
QStringList mStacExtensions
Definition
qgsstacobject.h:115
QgsStacObject::links
QVector< QgsStacLink > links() const
Returns the STAC links included in the object.
Definition
qgsstacobject.cpp:58
qgsstaccatalog.h
Generated on
for QGIS API Documentation by
1.17.0