Initial support for extension-based scan on multiple layers

This commit is contained in:
Alessandro Pasotti 2017-08-07 18:01:00 +02:00
parent e19c60beae
commit 030b234c1b

View File

@ -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;
}