QGIS API Documentation 4.3.0-Master (389d690bb77)
Loading...
Searching...
No Matches
qgsstaccollectionlist.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsstaccollectionlist.cpp
3 ---------------------
4 begin : October 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
17
18#include "qgsstaccollection.h"
19
20#include <QString>
21
22using namespace Qt::StringLiterals;
23
24QgsStacCollectionList::QgsStacCollectionList( const QVector< QgsStacCollection * > collections, const QVector< QgsStacLink > links, int numberMatched )
25 : mCollections( collections )
26 , mNumberMatched( numberMatched )
27{
28 for ( const QgsStacLink &link : links )
29 {
30 if ( link.relation() == "self"_L1 || link.relation() == "root"_L1 || link.relation() == "next"_L1 || link.relation() == "prev"_L1 )
31 mUrls.insert( link.relation(), link.href() );
32 }
33}
34
35
37{
38 qDeleteAll( mCollections );
39}
40
41QVector<QgsStacCollection *> QgsStacCollectionList::collections() const
42{
43 return mCollections;
44}
45
46QVector<QgsStacCollection *> QgsStacCollectionList::takeCollections()
47{
48 QVector< QgsStacCollection * > cols = mCollections;
49 mCollections.clear(); // detach
50 return cols;
51}
52
54{
55 return mCollections.size();
56}
57
59{
60 return mNumberMatched;
61}
62
64{
65 return QUrl( mUrls.value( u"self"_s, QString() ) );
66}
67
69{
70 return QUrl( mUrls.value( u"root"_s, QString() ) );
71}
72
74{
75 return QUrl( mUrls.value( u"next"_s, QString() ) );
76}
77
79{
80 return QUrl( mUrls.value( u"prev"_s, QString() ) );
81}
QUrl prevUrl() const
Returns the url of the collections' "prev" link.
QVector< QgsStacCollection * > collections() const
Returns the collections Ownership is not transferred.
QgsStacCollectionList()=delete
Default constructor deleted, use the variant with required parameters.
int numberReturned() const
Returns the number of returned collections.
QUrl rootUrl() const
Returns the url of the collections' "root" link.
QUrl nextUrl() const
Returns the url of the collections' "next" link.
QUrl url() const
Returns the url of the collections' "self" link.
QVector< QgsStacCollection * > takeCollections()
Returns the collections Caller takes ownership of the returned collections.
int numberMatched() const
Returns the total number of available collections If this information was not available by the STAC s...