QGIS API Documentation 4.3.0-Master (389d690bb77)
Loading...
Searching...
No Matches
qgsstacdataitems.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsstacdataitems.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 "qgsstacdataitems.h"
17
18#include "qgsprovidermetadata.h"
19#include "qgsproviderregistry.h"
20#include "qgsstaccatalog.h"
21#include "qgsstaccollection.h"
23#include "qgsstacconnection.h"
24#include "qgsstaccontroller.h"
25#include "qgsstacitem.h"
27
28#include <QString>
29
30#include "moc_qgsstacdataitems.cpp"
31
32using namespace Qt::StringLiterals;
33
34constexpr int MAX_DISPLAYED_ITEMS = 20;
35
37
38
39//
40// QgsStacAssetItem
41//
42
43QgsStacAssetItem::QgsStacAssetItem( QgsDataItem *parent, const QString &name, const QgsStacAsset *asset )
44 : QgsDataItem( Qgis::BrowserItemType::Custom, parent, name, QString( "%1/%2" ).arg( parent->path(), name ), u"special:Stac"_s )
45 , mStacAsset( asset )
46 , mName( name )
47{
48 if ( QgsProviderMetadata *metadata = QgsProviderRegistry::instance()->providerMetadata( asset->uri().providerKey ) )
49 {
50 mIcon = metadata->icon();
51 }
52 else
53 {
54 mIconName = u"downloading_svg.svg"_s;
55 }
56 updateToolTip();
58}
59
60QgsStacController *QgsStacAssetItem::stacController() const
61{
62 const QgsDataItem *item = this;
63 while ( item )
64 {
65 if ( const QgsStacConnectionItem *ci = qobject_cast<const QgsStacConnectionItem *>( item ) )
66 return ci->controller();
67 item = item->parent();
68 }
69 Q_ASSERT( false );
70 return nullptr;
71}
72
73bool QgsStacAssetItem::equal( const QgsDataItem * )
74{
75 return false;
76}
77
78void QgsStacAssetItem::updateToolTip()
79{
80 QString title = mStacAsset->title();
81 if ( title.isNull() || title.isEmpty() )
82 {
83 title = mName;
84 }
85 mToolTip = u"STAC Asset:\n%1\n%2"_s.arg( title, mStacAsset->href() );
86}
87
88
89//
90// QgsStacAssetLayerItem
91//
92
93QgsStacAssetLayerItem *QgsStacAssetLayerItem::createItemForAsset( QgsDataItem *parent, const QString &name, const QgsStacAsset *asset, const QString &authcfg )
94{
96 QUrl url( asset->href() );
97 if ( url.isLocalFile() )
98 {
99 uri.uri = asset->href();
100 }
101 else
102 {
103 uri = asset->uri( authcfg );
104 }
105
107 if ( uri.layerType == "vector"_L1 )
108 {
110 }
111 else if ( uri.layerType == "raster"_L1 )
112 {
114 }
115 else if ( uri.layerType == "pointcloud"_L1 )
116 {
118 }
119
120 return new QgsStacAssetLayerItem( parent, name, asset, uri, layerType, uri.providerKey );
121}
122
123QgsStacAssetLayerItem::QgsStacAssetLayerItem(
124 QgsDataItem *parent, const QString &name, const QgsStacAsset *asset, const QgsMimeDataUtils::Uri &uri, Qgis::BrowserLayerType layerType, const QString &providerKey
125)
126 : QgsLayerItem( parent, name, QString( "%1/%2" ).arg( parent->path(), name ), uri.uri, layerType, providerKey )
127 , mStacAsset( asset )
128 , mUri( uri )
129 , mName( name )
130{
131 updateToolTip();
133
134 mCapabilities.setFlag( Qgis::BrowserItemCapability::ReadOnly, true );
135}
136
137bool QgsStacAssetLayerItem::hasDragEnabled() const
138{
139 return true;
140}
141
142QgsStacController *QgsStacAssetLayerItem::stacController() const
143{
144 const QgsDataItem *item = this;
145 while ( item )
146 {
147 if ( const QgsStacConnectionItem *ci = qobject_cast<const QgsStacConnectionItem *>( item ) )
148 return ci->controller();
149 item = item->parent();
150 }
151 Q_ASSERT( false );
152 return nullptr;
153}
154
155QgsMimeDataUtils::UriList QgsStacAssetLayerItem::mimeUris() const
156{
157 return { mUri };
158}
159
160bool QgsStacAssetLayerItem::equal( const QgsDataItem * )
161{
162 return false;
163}
164
165void QgsStacAssetLayerItem::updateToolTip()
166{
167 QString title = mStacAsset->title();
168 if ( title.isNull() || title.isEmpty() )
169 {
170 title = mName;
171 }
172 mToolTip = u"STAC Asset:\n%1\n%2"_s.arg( title, mStacAsset->href() );
173}
174
175//
176// QgsStacFetchMoreItem
177//
178
179QgsStacFetchMoreItem::QgsStacFetchMoreItem( QgsDataItem *parent, const QString &name )
180 : QgsDataItem( Qgis::BrowserItemType::Custom, parent, name, QString() )
181{
183}
184
185bool QgsStacFetchMoreItem::handleDoubleClick()
186{
187 if ( QgsStacCatalogItem *catalog = qobject_cast<QgsStacCatalogItem *>( mParent ) )
188 {
189 catalog->fetchMoreChildren();
190 return true;
191 }
192 else
193 {
194 return false;
195 }
196}
197
198//
199// QgsStacItemItem
200//
201
202QgsStacItemItem::QgsStacItemItem( QgsDataItem *parent, const QString &name, const QString &path )
203 : QgsDataItem( Qgis::BrowserItemType::Custom, parent, name.isEmpty() ? path : name, path, u"special:Stac"_s )
204{
205 mIconName = u"mActionPropertiesWidget.svg"_s;
206 mCapabilities |= Qgis::BrowserItemCapability::Fast;
207 updateToolTip();
208}
209
210QVector<QgsDataItem *> QgsStacItemItem::createChildren()
211{
212 QgsStacController *controller = stacController();
213 const QString authcfg = controller->authCfg();
214 QString error;
215 setStacItem( controller->fetchStacObject<QgsStacItem>( mPath, &error ) );
216
217 if ( !mStacItem )
218 return { new QgsErrorItem( this, error, path() + u"/error"_s ) };
219
221 QVector<QgsDataItem *> contents;
222 contents.reserve( mStacItem->assets().size() );
223 const QMap<QString, QgsStacAsset> assets = mStacItem->assets();
224 for ( auto it = assets.constBegin(); it != assets.constEnd(); ++it )
225 {
226 if ( it.value().uri( authcfg ).isValid() && it.value().isCloudOptimized() )
227 {
228 // asset can be treated as a map layer
229 QgsStacAssetLayerItem *assetItem = QgsStacAssetLayerItem::createItemForAsset( this, it.key(), &it.value(), authcfg );
230 contents.append( assetItem );
231 }
232 else
233 {
234 QgsStacAssetItem *assetItem = new QgsStacAssetItem( this, it.key(), &it.value() );
235 contents.append( assetItem );
236 }
237 }
238 return contents;
239}
240
241bool QgsStacItemItem::hasDragEnabled() const
242{
243 if ( !mStacItem )
244 return false;
245
246 const QMap<QString, QgsStacAsset> assets = mStacItem->assets();
247 for ( auto it = assets.constBegin(); it != assets.constEnd(); ++it )
248 {
249 if ( it->isCloudOptimized() )
250 return true;
251 }
252 return false;
253}
254
255QgsMimeDataUtils::UriList QgsStacItemItem::mimeUris() const
256{
258
259 if ( !mStacItem )
260 return uris;
261
262 const QString authcfg = stacController()->authCfg();
263
264 const QMap<QString, QgsStacAsset> assets = mStacItem->assets();
265 for ( auto it = assets.constBegin(); it != assets.constEnd(); ++it )
266 {
267 QgsMimeDataUtils::Uri uri = it->uri( authcfg );
268 if ( uri.isValid() )
269 {
270 uris.append( uri );
271 }
272 }
273
274 return uris;
275}
276
277bool QgsStacItemItem::equal( const QgsDataItem * )
278{
279 return false;
280}
281
282void QgsStacItemItem::updateToolTip()
283{
284 QString name = mName;
285 if ( mStacItem )
286 {
287 name = mStacItem->properties().value( u"title"_s, mName ).toString();
288 }
289 mToolTip = u"STAC Item:\n%1\n%2"_s.arg( name, mPath );
290}
291
292QgsStacController *QgsStacItemItem::stacController() const
293{
294 const QgsDataItem *item = this;
295 while ( item )
296 {
297 if ( const QgsStacConnectionItem *ci = qobject_cast<const QgsStacConnectionItem *>( item ) )
298 return ci->controller();
299 item = item->parent();
300 }
301 Q_ASSERT( false );
302 return nullptr;
303}
304
305void QgsStacItemItem::setStacItem( std::unique_ptr<QgsStacItem> item )
306{
307 mStacItem = std::move( item );
308 updateToolTip();
309}
310
311QgsStacItem *QgsStacItemItem::stacItem() const
312{
313 return mStacItem.get();
314}
315
316void QgsStacItemItem::itemRequestFinished( int requestId, QString error )
317{
318 QgsStacController *controller = stacController();
319 std::unique_ptr< QgsStacItem > object = controller->takeStacObject< QgsStacItem >( requestId );
320 setStacItem( std::move( object ) );
321 if ( mStacItem )
322 {
323 mIconName = u"mActionPropertiesWidget.svg"_s;
324 QString name = mStacItem->properties().value( u"title"_s, QString() ).toString();
325 if ( name.isEmpty() )
326 name = mStacItem->id();
327 mName = name;
328 }
329 else
330 {
331 mIconName = u"/mIconDelete.svg"_s;
332 mName = error;
333 }
334}
335
336
337//
338// QgsStacCatalogItem
339//
340
341QgsStacCatalogItem::QgsStacCatalogItem( QgsDataItem *parent, const QString &name, const QString &path )
342 : QgsDataCollectionItem( parent, name, path, u"special:Stac"_s )
343{
344 mIconName = u"mIconFolder.svg"_s;
346
347 if ( name.isEmpty() )
348 {
349 mName = path.mid( path.lastIndexOf( '/' ) + 1 );
350 }
351
352 updateToolTip();
353}
354
355bool QgsStacCatalogItem::isCatalog() const
356{
357 return !mIsCollection;
358}
359
360bool QgsStacCatalogItem::isCollection() const
361{
362 return mIsCollection;
363}
364
365QgsStacController *QgsStacCatalogItem::stacController() const
366{
367 const QgsDataItem *item = this;
368 while ( item )
369 {
370 if ( const QgsStacConnectionItem *ci = qobject_cast< const QgsStacConnectionItem *>( item ) )
371 return ci->controller();
372 item = item->parent();
373 }
374 Q_ASSERT( false );
375 return nullptr;
376}
377
378QgsStacCatalog *QgsStacCatalogItem::rootCatalog() const
379{
380 const QgsDataItem *item = this;
381 while ( item )
382 {
383 if ( const QgsStacConnectionItem *ci = qobject_cast< const QgsStacConnectionItem *>( item ) )
384 return ci->mStacCatalog.get();
385 item = item->parent();
386 }
387 Q_ASSERT( false );
388 return nullptr;
389}
390
391QgsStacFetchMoreItem *QgsStacCatalogItem::fetchMoreItem() const
392{
393 for ( QgsDataItem *item : mChildren )
394 {
395 if ( QgsStacFetchMoreItem *moreItem = qobject_cast< QgsStacFetchMoreItem *>( item ) )
396 {
397 return moreItem;
398 }
399 }
400 return nullptr;
401}
402
403void QgsStacCatalogItem::childrenCreated()
404{
406
407 connect( stacController(), &QgsStacController::finishedStacObjectRequest, this, &QgsStacCatalogItem::onControllerFinished, Qt::UniqueConnection );
408
409 for ( QgsDataItem *child : std::as_const( mChildren ) )
410 {
411 if ( QgsStacItemItem *item = qobject_cast<QgsStacItemItem *>( child ) )
412 {
414 continue;
415
416 const int requestId = stacController()->fetchStacObjectAsync( item->path() );
417 item->setProperty( "requestId", requestId );
418 }
419 }
420}
421
422void QgsStacCatalogItem::onControllerFinished( int requestId, const QString &error )
423{
424 for ( QgsDataItem *child : std::as_const( mChildren ) )
425 {
426 if ( child->state() != Qgis::BrowserItemState::NotPopulated )
427 continue;
428
429 if ( QgsStacItemItem *item = qobject_cast<QgsStacItemItem *>( child ) )
430 {
431 if ( item->property( "requestId" ).toInt() == requestId )
432 {
433 item->itemRequestFinished( requestId, error );
434 }
435 }
436 }
437}
438
439QVector<QgsDataItem *> QgsStacCatalogItem::createChildren()
440{
441 QgsStacController *controller = stacController();
442 QString error;
443 setStacCatalog( controller->fetchStacObject< QgsStacCatalog >( mPath, &error ) );
444 const QString authcfg = controller->authCfg();
445
446 if ( !mStacCatalog )
447 return { new QgsErrorItem( this, error, path() + u"/error"_s ) };
448
449 QgsStacCatalog *root = rootCatalog();
450
451 const bool supportsCollections = root && root->conformsTo( u"https://api.stacspec.org/v1.0.0/collections"_s );
452 const bool supportsItems = root && root->conformsTo( u"https://api.stacspec.org/v1.0.0/ogcapi-features"_s );
453
454 int itemsCount = 0;
455 QVector<QgsDataItem *> contents;
456 const QVector< QgsStacLink > links = mStacCatalog->links();
457
458 // treat catalog/collection as static if it does not have a /items endpoint
459 bool useItemsEndpoint = false;
460 bool useCollectionsEndpoint = false;
461 if ( supportsCollections || supportsItems )
462 {
463 for ( const QgsStacLink &link : links )
464 {
465 if ( link.relation() == "items"_L1 )
466 {
467 useItemsEndpoint = true;
468 }
469 else if ( link.relation() == "data"_L1 && link.href().endsWith( "/collections"_L1 ) )
470 {
471 useCollectionsEndpoint = true;
472 }
473 // if we found what we need we can stop looking
474 if ( supportsItems == useItemsEndpoint && supportsCollections == useCollectionsEndpoint )
475 break;
476 }
477 }
478
479 for ( const QgsStacLink &link : links )
480 {
481 // skip hierarchical navigation links
482 if ( link.relation() == "self"_L1 || link.relation() == "root"_L1 || link.relation() == "parent"_L1 || link.relation() == "collection"_L1 )
483 continue;
484
485 if ( link.relation() == "child"_L1 && !useCollectionsEndpoint )
486 {
487 // may be either catalog or collection
488 QgsStacCatalogItem *c = new QgsStacCatalogItem( this, link.title(), link.href() );
489 contents.append( c );
490 }
491 else if ( link.relation() == "data"_L1 && link.href().endsWith( "/collections"_L1 ) )
492 {
493 // use /collections api
494 QString error;
495 std::unique_ptr< QgsStacCollectionList > cols( controller->fetchCollections( link.href(), &error ) );
496 if ( cols )
497 {
498 contents.append( createCollections( cols->takeCollections() ) );
499 itemsCount = cols->numberMatched();
500 }
501 else
502 {
503 // collection fetching failed
504 contents.append( new QgsErrorItem( this, error, path() + u"/error"_s ) );
505 }
506 }
507 else if ( link.relation() == "item"_L1 && !useItemsEndpoint )
508 {
509 itemsCount++;
510
511 if ( itemsCount > MAX_DISPLAYED_ITEMS )
512 continue;
513
514 QgsStacItemItem *i = new QgsStacItemItem( this, link.title(), link.href() );
515 contents.append( i );
516 }
517 else if ( link.relation() == "items"_L1 && useItemsEndpoint )
518 {
519 // stac api items (ogcapi features)
520 QString error;
521 std::unique_ptr< QgsStacItemCollection > ic( controller->fetchItemCollection( link.href(), &error ) );
522 if ( ic )
523 {
524 contents.append( createItems( ic->takeItems() ) );
525 mFetchMoreUrl = ic->nextUrl();
526 itemsCount = ic->numberMatched();
527 }
528 else
529 {
530 // item collection fetching failed
531 contents.append( new QgsErrorItem( this, error, path() + u"/error"_s ) );
532 }
533 }
534 else
535 {
536 // todo: should handle other links?
537 }
538 }
539
540 if ( QgsStacCollection *collection = dynamic_cast<QgsStacCollection *>( mStacCatalog.get() ) )
541 {
542 const QMap<QString, QgsStacAsset> assets = collection->assets();
543 for ( auto it = assets.constBegin(); it != assets.constEnd(); ++it )
544 {
545 if ( it.value().uri( authcfg ).isValid() && it.value().isCloudOptimized() )
546 {
547 // asset can be treated as a map layer
548 QgsStacAssetLayerItem *assetItem = QgsStacAssetLayerItem::createItemForAsset( this, it.key(), &it.value(), authcfg );
549 contents.append( assetItem );
550 }
551 else
552 {
553 QgsStacAssetItem *assetItem = new QgsStacAssetItem( this, it.key(), &it.value() );
554 contents.append( assetItem );
555 }
556 }
557 }
558
559 QgsStacFetchMoreItem *moreItem = nullptr;
560 if ( !mFetchMoreUrl.isEmpty() )
561 {
562 if ( itemsCount >= 0 )
563 moreItem = new QgsStacFetchMoreItem( this, tr( "Double-click to fetch more (%L1 total items)..." ).arg( itemsCount ) );
564 else
565 moreItem = new QgsStacFetchMoreItem( this, tr( "Double-click to fetch more items..." ) );
566 }
567 else if ( itemsCount > MAX_DISPLAYED_ITEMS )
568 {
569 moreItem = new QgsStacFetchMoreItem( this, tr( "%1 more items" ).arg( itemsCount - MAX_DISPLAYED_ITEMS ) );
570 }
571
572 if ( moreItem )
573 contents.append( moreItem );
574
575 return contents;
576}
577
578bool QgsStacCatalogItem::equal( const QgsDataItem *other )
579{
580 Q_UNUSED( other );
581 return false;
582}
583
584void QgsStacCatalogItem::updateToolTip()
585{
586 mToolTip = u"STAC Catalog:\n%1\n%2"_s.arg( mName, mPath );
587 if ( mIsCollection )
588 {
589 const int pos = mToolTip.indexOf( ':' );
590 mToolTip.replace( 0, pos, u"STAC Collection"_s );
591 }
592}
593
594void QgsStacCatalogItem::setStacCatalog( std::unique_ptr<QgsStacCatalog> catalog )
595{
596 mStacCatalog = std::move( catalog );
597 if ( mStacCatalog )
598 {
599 if ( mName.isEmpty() && !mStacCatalog->title().isEmpty() )
600 setName( mStacCatalog->title() );
601
602 if ( mStacCatalog->type() == Qgis::StacObjectType::Collection )
603 {
604 mIsCollection = true;
605 mIconName = u"mIconFolderOpen.svg"_s;
606 }
607 }
608 updateToolTip();
609}
610
611QgsStacCatalog *QgsStacCatalogItem::stacCatalog() const
612{
613 return mStacCatalog.get();
614}
615
616QVector< QgsDataItem * > QgsStacCatalogItem::createItems( const QVector<QgsStacItem *> items )
617{
618 QVector< QgsDataItem * > contents;
619 contents.reserve( items.size() );
620 for ( QgsStacItem *item : items )
621 {
622 if ( !item )
623 continue;
624
625 std::unique_ptr< QgsStacItem > object( item );
626
627 const QString name = item->properties().value( u"title"_s, item->id() ).toString();
628
629 QgsStacItemItem *i = new QgsStacItemItem( this, name, item->url() );
630 i->setStacItem( std::move( object ) );
632 contents.append( i );
633 }
634 return contents;
635}
636
637QVector<QgsDataItem *> QgsStacCatalogItem::createCollections( const QVector<QgsStacCollection *> collections )
638{
639 QVector< QgsDataItem * > contents;
640 contents.reserve( collections.size() );
641 for ( QgsStacCollection *col : collections )
642 {
643 if ( !col )
644 continue;
645
646 std::unique_ptr< QgsStacCollection > object( col );
647
648 const QString name = col->title().isEmpty() ? col->id() : col->title();
649
650 QgsStacCatalogItem *i = new QgsStacCatalogItem( this, name, col->url() );
651 i->setStacCatalog( std::move( object ) );
652 contents.append( i );
653 }
654 return contents;
655}
656
657void QgsStacCatalogItem::fetchMoreChildren()
658{
659 if ( mFetchMoreUrl.isEmpty() )
660 return;
661
662 QgsStacFetchMoreItem *moreItem = fetchMoreItem();
663
664 QgsStacController *c = stacController();
665 std::unique_ptr< QgsStacItemCollection > ic( c->fetchItemCollection( mFetchMoreUrl ) );
666 if ( ic )
667 {
668 populate( createItems( ic->takeItems() ) );
669
670 mFetchMoreUrl = ic->nextUrl();
671 if ( !ic->nextUrl().isEmpty() && moreItem )
672 {
673 const int numberMatched = ic->numberMatched();
674 if ( numberMatched > -1 )
675 {
676 moreItem->setName( tr( "Double-click to fetch more (%L1 total items)..." ).arg( numberMatched ) );
677 }
678 }
679 else
680 {
681 // delete fetch more item
682 removeChildItem( moreItem );
683 }
684 }
685}
686
687
688//
689// QgsStacConnectionItem
690//
691
692QgsStacConnectionItem::QgsStacConnectionItem( QgsDataItem *parent, const QString &connectionName )
693 : QgsStacCatalogItem( parent, connectionName, QString() )
694 , mConnName( connectionName )
695 , mController( new QgsStacController() )
696{
697 mIconName = u"mIconConnect.svg"_s;
699
700 const QgsStacConnection::Data data = QgsStacConnection::connection( connectionName );
701
702 mController->setAuthCfg( data.authCfg );
703
704 mPath = data.url;
705 mToolTip = u"Connection:\n%1\n%2"_s.arg( connectionName, mPath );
706}
707
708QgsStacController *QgsStacConnectionItem::controller() const
709{
710 return mController.get();
711}
712
713
714//
715// QgsStacRootItem
716//
717
718QgsStacRootItem::QgsStacRootItem( QgsDataItem *parent, const QString &name, const QString &path )
719 : QgsConnectionsRootItem( parent, name, path, u"special:Stac"_s )
720{
721 mCapabilities |= Qgis::BrowserItemCapability::Fast;
722 mIconName = u"mIconStac.svg"_s;
723 populate();
724}
725
726QVector<QgsDataItem *> QgsStacRootItem::createChildren()
727{
728 QVector<QgsDataItem *> connections;
729 const QStringList connectionList = QgsStacConnection::connectionList();
730 for ( const QString &connName : connectionList )
731 {
732 QgsDataItem *conn = new QgsStacConnectionItem( this, connName );
733 connections.append( conn );
734 }
735 return connections;
736}
737
738void QgsStacRootItem::onConnectionsChanged()
739{
740 refresh();
741}
742
743
744//
745// QgsStacDataItemProvider
746//
747
748QString QgsStacDataItemProvider::name()
749{
750 return u"STAC"_s;
751}
752
753QString QgsStacDataItemProvider::dataProviderKey() const
754{
755 return u"special:Stac"_s;
756}
757
758Qgis::DataItemProviderCapabilities QgsStacDataItemProvider::capabilities() const
759{
761}
762
763QgsDataItem *QgsStacDataItemProvider::createDataItem( const QString &path, QgsDataItem *parentItem )
764{
765 if ( path.isEmpty() )
766 return new QgsStacRootItem( parentItem, QObject::tr( "STAC" ), u"stac:"_s );
767 return nullptr;
768}
769
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:62
@ NetworkSources
Network/internet source.
Definition qgis.h:1062
@ NotPopulated
Children not yet created.
Definition qgis.h:1001
@ Populating
Creating children in separate thread (populating or refreshing).
Definition qgis.h:1002
@ Populated
Children created.
Definition qgis.h:1003
@ ReadOnly
Item is read only.
Definition qgis.h:1023
@ Collapse
The collapse/expand status for this items children should be ignored in order to avoid undesired netw...
Definition qgis.h:1018
@ Fast
CreateChildren() is fast enough to be run in main thread when refreshing items, most root items (wms,...
Definition qgis.h:1017
QFlags< DataItemProviderCapability > DataItemProviderCapabilities
Capabilities for data item providers.
Definition qgis.h:1073
@ Collection
STAC collection.
Definition qgis.h:6888
BrowserLayerType
Browser item layer types.
Definition qgis.h:1082
@ Vector
Generic vector layer.
Definition qgis.h:1084
@ Raster
Raster layer.
Definition qgis.h:1085
@ PointCloud
Point cloud layer.
Definition qgis.h:1095
A browser item that represents a root group of connections from a single data provider.
A browser item for collections of data.
Base class for all items in the model.
Definition qgsdataitem.h:50
Qgis::BrowserItemState state() const
virtual void childrenCreated()
QString path() const
QgsDataItem * parent() const
Gets item parent.
A browser item that can be used to report problems (e.g.
A browser item that represents a layer that can be opened with one of the providers.
QList< QgsMimeDataUtils::Uri > UriList
Holds data provider key, description, and associated shared library file or function pointer informat...
static QgsProviderRegistry * instance(const QString &pluginPath=QString())
Means of accessing canonical single instance.
Stores data associated with a STAC asset.
QString href() const
Returns the URI to the asset object.
QgsMimeDataUtils::Uri uri(const QString &authcfg=QString()) const
Returns a uri for the asset if it is a cloud optimized file like COG or COPC.
Stores data associated with a STAC Catalog.
bool conformsTo(const QString &conformanceClass) const
Checks if the catalog is a STAC API conforming to the specified conformanceClass.
Stores data associated with a STAC Collection.
static QStringList connectionList()
Returns list of existing connections, unless the hidden ones.
static Data connection(const QString &name)
Returns connection details.
Handles STAC requests.
std::unique_ptr< QgsStacItemCollection > fetchItemCollection(const QUrl &url, QString *error=nullptr)
Fetches a feature collection from url using a blocking network request.
QString authCfg() const
Returns the authentication config id which will be used during the request.
std::unique_ptr< T > fetchStacObject(const QUrl &url, QString *error=nullptr)
Fetches a STAC object from url using a blocking network request.
std::unique_ptr< T > takeStacObject(int requestId)
Returns the STAC object fetched with the specified requestId.
std::unique_ptr< QgsStacCollectionList > fetchCollections(const QUrl &url, QString *error=nullptr)
Fetches collections from url using a blocking network request.
void finishedStacObjectRequest(int id, QString errorMessage)
This signal is fired when an async request initiated with fetchStacObjectAsync is finished.
Stores data associated with a STAC Item.
Definition qgsstacitem.h:35
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
constexpr int MAX_DISPLAYED_ITEMS
QString uri
Identifier of the data source recognized by its providerKey.
QString providerKey
For "vector" / "raster" type: provider id.
QString layerType
Type of URI.
bool isValid() const
Returns whether the object contains valid data.
Represents decoded data of a connection.
QString authCfg
Authentication configuration id.
QString url
Catalog URL.