Skip to content

Commit

Permalink
Initial support for extension-based scan on multiple layers
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Aug 9, 2017
1 parent e19c60b commit 030b234
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/providers/ogr/qgsogrdataitems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,17 @@ QGISEXTERN QgsDataItem *dataItem( QString path, QgsDataItem *parentItem )
OGR_DS_Destroy( hDataSource );
}
}
// add the item
// TODO: how to handle collections?
QgsLayerItem *item = new QgsOgrLayerItem( parentItem, name, path, path, QgsLayerItem::Vector );
// Handle collections
// Check if the layer has sublayers by comparing the extension
QgsDataItem *item;
QStringList multipleLayersExtensions;
// TODO: add more formats here!
multipleLayersExtensions << QLatin1String( "gpkg" ) << QLatin1String( "sqlite" );
if ( ! multipleLayersExtensions.contains( suffix ) )
item = new QgsOgrLayerItem( parentItem, name, path, path, QgsLayerItem::Vector );
else
item = new QgsOgrDataCollectionItem( parentItem, name, path );

if ( item )
return item;
}
Expand Down

0 comments on commit 030b234

Please sign in to comment.