QGIS API Documentation 4.3.0-Master (389d690bb77)
Loading...
Searching...
No Matches
qgsstacobject.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsstacobject.h
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#ifndef QGSSTACOBJECT_H
17#define QGSSTACOBJECT_H
18
19#include "qgis.h"
20#include "qgis_core.h"
21#include "qgsstaclink.h"
22
23#include <QObject>
24#include <QString>
25#include <QStringList>
26
33class CORE_EXPORT QgsStacObject
34{
35 //SIP_TYPEHEADER_INCLUDE( "qgsstacitem.h" );
36 //SIP_TYPEHEADER_INCLUDE( "qgsstaccollection.h" );
37 //SIP_TYPEHEADER_INCLUDE( "qgsstaccatalog.h" );
38
39#ifdef SIP_RUN
41 if ( QgsStacItem *item = dynamic_cast< QgsStacItem * >( sipCpp ) )
42 {
43 sipType = sipType_QgsStacItem;
44 }
45 else if ( QgsStacCollection *item = dynamic_cast< QgsStacCollection * >( sipCpp ) )
46 {
47 sipType = sipType_QgsStacCollection;
48 }
49 else if ( QgsStacCatalog *item = dynamic_cast< QgsStacCatalog * >( sipCpp ) )
50 {
51 sipType = sipType_QgsStacCatalog;
52 }
53 else
54 {
55 sipType = NULL;
56 }
58#endif
59
60 public:
61
63 QgsStacObject() = delete;
64
66 QgsStacObject( const QString &id, const QString &version, const QVector< QgsStacLink > &links );
67
69 virtual ~QgsStacObject() = default;
70
72 virtual Qgis::StacObjectType type() const = 0;
73
75 virtual QString toHtml() const = 0;
76
78 QString stacVersion() const;
79
81 void setStacVersion( const QString &stacVersion );
82
84 QStringList stacExtensions() const;
85
87 void setStacExtensions( const QStringList &stacExtensions );
88
90 QString id() const;
91
93 void setId( const QString &id );
94
96 QVector< QgsStacLink > links() const;
97
99 void setLinks( const QVector< QgsStacLink > &links );
100
102 QString url() const;
103
105 QString rootUrl() const;
106
108 QString parentUrl() const;
109
110
111 protected:
113 QString mId;
115 QStringList mStacExtensions;
116 QVector< QgsStacLink > mLinks;
117};
118
119// we'll store STAC object pointers in QVariants in item models
121
122#endif // QGSSTACOBJECT_H
StacObjectType
Available types of stac objects.
Definition qgis.h:6885
@ Unknown
Type is not known.
Definition qgis.h:6886
Stores data associated with a STAC Catalog.
Stores data associated with a STAC Collection.
Stores data associated with a STAC Item.
Definition qgsstacitem.h:35
Abstract base class for storing STAC objects.
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.
virtual QString toHtml() const =0
Returns an HTML representation of the STAC object.
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.
virtual ~QgsStacObject()=default
Destructor.
Qgis::StacObjectType mType
QString url() const
Returns the url stored in the object's "self" link.
QStringList mStacExtensions
QString mStacVersion
virtual Qgis::StacObjectType type() const =0
Returns the Type of the STAC object.
QVector< QgsStacLink > links() const
Returns the STAC links included in the object.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:203
#define SIP_END
Definition qgis_sip.h:220
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)