Index: src/plugins/ogrsublayers/ogrsublayers.cpp =================================================================== --- src/plugins/ogrsublayers/ogrsublayers.cpp (révision 0) +++ src/plugins/ogrsublayers/ogrsublayers.cpp (révision 0) @@ -0,0 +1,236 @@ +/*************************************************************************** + ogrsublayers.cpp + This plugin allows the user to choose which layers to load from an OGR multilayer datasource. + ------------------- + begin : [PluginDate] + copyright : [(C) Your Name and Date] + email : [Your Email] + + *************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +/* $Id: plugin.cpp 9327 2008-09-14 11:18:44Z jef $ */ + +// +// QGIS Specific includes +// + + +#include +#include +#include +#include +#include +#include + +#include "ogrsublayers.h" +#include "ogrsublayersgui.h" +#include "../../providers/ogr/qgsogrprovider.h" + +// +// Qt4 Related Includes +// + +#include +#include +#include +#include +#include + +static const char * const sIdent = "$Id: plugin.cpp 9327 2008-09-14 11:18:44Z jef $"; +static const QString sName = QObject::tr( "OGR SubLayers" ); +static const QString sDescription = QObject::tr( "This plugin allows the user to choose which layers to load from an OGR multilayer datasource." ); +static const QString sPluginVersion = QObject::tr( "Version 0.1" ); +static const QgisPlugin::PLUGINTYPE sPluginType = QgisPlugin::UI; + +////////////////////////////////////////////////////////////////////// +// +// THE FOLLOWING METHODS ARE MANDATORY FOR ALL PLUGINS +// +////////////////////////////////////////////////////////////////////// + +/** + * Constructor for the plugin. The plugin is passed a pointer + * an interface object that provides access to exposed functions in QGIS. + * @param theQGisInterface - Pointer to the QGIS interface object + */ +OGRSubLayers::OGRSubLayers( QgisInterface * theQgisInterface ): + QgisPlugin( sName, sDescription, sPluginVersion, sPluginType ), + mQGisIface( theQgisInterface ) +{ +} + +OGRSubLayers::~OGRSubLayers() +{ +} + +/* + * Initialize the GUI interface for the plugin - this is only called once when the plugin is + * added to the plugin registry in the QGIS application. + */ +void OGRSubLayers::initGui() +{ + + // Create the action for tool + mQActionPointer = new QAction( QIcon( ":/ogrsublayers/ogrsublayers.png" ), tr( "OGR SubLayers" ), this ); + // Set the what's this text + mQActionPointer->setWhatsThis( tr( "Replace this with a short description of what the plugin does" ) ); + // Connect the action to the run + connect( mQActionPointer, SIGNAL( triggered() ), this, SLOT( run() ) ); + // Add the icon to the toolbar + mQGisIface->addToolBarIcon( mQActionPointer ); + mQGisIface->addPluginToMenu( tr( "&OGR SubLayers" ), mQActionPointer ); + + +} +//method defined in interface +void OGRSubLayers::help() +{ + //implement me! +} + +// Slot called when the menu item is triggered +// If you created more menu items / toolbar buttons in initiGui, you should +// create a separate handler for each action - this single run() method will +// not be enough +void OGRSubLayers::run() +{ + OGRSubLayersGui *myPluginGui; + if ( mQGisIface->activeLayer() ) + { + if ( mQGisIface->activeLayer()->type() == QgsMapLayer::VectorLayer ) + { + // This plugin is OGR specific until proved safe to use with other providers. + if (0 == (( QgsVectorLayer *)mQGisIface->activeLayer())->dataProvider()->name().compare("ogr")) + { + uri=mQGisIface->activeLayer()->source(); + // If there is no & in the uri, then the uri is just the filename. The loaded + // layer will be layer 0. + if ( uri.contains('&', Qt::CaseSensitive)) + { + // If we get here, there are some options added to the filename. We must parse + // the different parts separated by &, and among each option, the name and the + // value around the =. + // A valid uri is of the form: filename&option1=value1&option2=value2,... + QStringList theURIParts = uri.split("&"); + uri = theURIParts.at( 0 ); + } + QgsOgrProvider* theCurrentProvider = ( QgsOgrProvider * )((( QgsVectorLayer *)mQGisIface->activeLayer())->dataProvider()); + + // We get the subLayers of activeLayer.dataProvider and we show them in the dialogbox. + QStringList liste = theCurrentProvider->subLayers(); + if ( liste.count() < 2) + { + QMessageBox *myBox = new QMessageBox( QMessageBox::Information, "No sublayers!", "There are no sublayers in the active layer. Select another layer to activate the plugin.", QMessageBox::Ok, mQGisIface->mainWindow(),Qt::MSWindowsFixedSizeDialogHint); + myBox -> setModal(true); + myBox -> show(); + return; + }else + { + myPluginGui = new OGRSubLayersGui( mQGisIface->mainWindow(), QgisGui::ModalDialogFlags ); + myPluginGui->setAttribute( Qt::WA_DeleteOnClose ); + myPluginGui->show(); + connect( myPluginGui, SIGNAL( updated(QStringList * ) ), this, SLOT( load(QStringList * ) ) ); + myPluginGui->populateLayerTable( & liste ); + } + + // We want to select the already selected layers so the user can choose to add or remove + // others + QgsMapLayerRegistry * theLayerRegistry = QgsMapLayerRegistry::instance(); + QList theVectorLayersList = QList(); + QMapIterator iterator(theLayerRegistry -> mapLayers()); + while (iterator.hasNext()){ + iterator.next(); + if (iterator.value()->type() == QgsMapLayer::VectorLayer){ + theVectorLayersList.append ( (QgsVectorLayer*) (iterator.value()) ); + } + } + QgsLogger::critical("Nb of vector layers loaded: " + QString::number( theVectorLayersList.size())); + myPluginGui->updateSelection(); + } + }else // activeLayer -> type != VectorLayer + { + QMessageBox *myBox = new QMessageBox( QMessageBox::Information, "Not a vector layer", "This plugin is OGR specific! Select another layer to activate the plugin.", QMessageBox::Ok, mQGisIface->mainWindow(),Qt::MSWindowsFixedSizeDialogHint); + myBox -> setModal(true); + myBox -> show(); + return; + } + } +} + +void OGRSubLayers::load(QStringList * list) +{ + QString fileName = QFileInfo(uri).baseName(); + for (int i = 0; i < list->size(); i++) + { + QString composedURI=uri+"&layername="+list->at(i); + mQGisIface-> addVectorLayer(composedURI,fileName+":"+list->at(i),"ogr"); + } +} + +// Unload the plugin by cleaning up the GUI +void OGRSubLayers::unload() +{ + // remove the GUI + mQGisIface->removePluginMenu( "&OGR SubLayers", mQActionPointer ); + mQGisIface->removeToolBarIcon( mQActionPointer ); + delete mQActionPointer; +} + + +////////////////////////////////////////////////////////////////////////// +// +// +// THE FOLLOWING CODE IS AUTOGENERATED BY THE PLUGIN BUILDER SCRIPT +// YOU WOULD NORMALLY NOT NEED TO MODIFY THIS, AND YOUR PLUGIN +// MAY NOT WORK PROPERLY IF YOU MODIFY THIS INCORRECTLY +// +// +////////////////////////////////////////////////////////////////////////// + + +/** + * Required extern functions needed for every plugin + * These functions can be called prior to creating an instance + * of the plugin class + */ +// Class factory to return a new instance of the plugin class +QGISEXTERN QgisPlugin * classFactory( QgisInterface * theQgisInterfacePointer ) +{ + return new OGRSubLayers( theQgisInterfacePointer ); +} +// Return the name of the plugin - note that we do not user class members as +// the class may not yet be insantiated when this method is called. +QGISEXTERN QString name() +{ + return sName; +} + +// Return the description +QGISEXTERN QString description() +{ + return sDescription; +} + +// Return the type (either UI or MapLayer plugin) +QGISEXTERN int type() +{ + return sPluginType; +} + +// Return the version number for the plugin +QGISEXTERN QString version() +{ + return sPluginVersion; +} + +// Delete ourself +QGISEXTERN void unload( QgisPlugin * thePluginPointer ) +{ + delete thePluginPointer; +} Index: src/plugins/ogrsublayers/ogrsublayers.png =================================================================== Impossible d'afficher : fichier considéré comme binaire. svn:mime-type = application/octet-stream Modification de propriétés sur src/plugins/ogrsublayers/ogrsublayers.png ___________________________________________________________________ Nom : svn:mime-type + application/octet-stream Index: src/plugins/ogrsublayers/ogrsublayers.qrc =================================================================== --- src/plugins/ogrsublayers/ogrsublayers.qrc (révision 0) +++ src/plugins/ogrsublayers/ogrsublayers.qrc (révision 0) @@ -0,0 +1,5 @@ + + + ogrsublayers.png + + Index: src/plugins/ogrsublayers/ogrsublayersgui.cpp =================================================================== --- src/plugins/ogrsublayers/ogrsublayersgui.cpp (révision 0) +++ src/plugins/ogrsublayers/ogrsublayersgui.cpp (révision 0) @@ -0,0 +1,77 @@ +/*************************************************************************** + * Copyright (C) 2003 by Tim Sutton * + * tim@linfiniti.com * + * * + * This is a plugin generated from the QGIS plugin template * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ +#include "ogrsublayersgui.h" +#include "qgscontexthelp.h" + +//qt includes + +//standard includes + +OGRSubLayersGui::OGRSubLayersGui( QWidget* parent, Qt::WFlags fl ) + : QDialog( parent, fl ) +{ + setupUi( this ); + layersTable->setColumnCount(3); + QStringList labels; + labels << tr("Layer ID") << tr("Layer name") << tr("Nb of features"); + layersTable->setHorizontalHeaderLabels(labels); + layersTable->setColumnWidth(0,188); + layersTable->setColumnWidth(1,188); + layersTable->setColumnWidth(2,188); + layersTable->setShowGrid(false); +} + +OGRSubLayersGui::~OGRSubLayersGui() +{ +} + +void OGRSubLayersGui::on_buttonBox_accepted() +{ + //close the dialog + QStringList list=QStringList(); + for (int i = 0; i < layersTable-> selectedItems().size(); i++) + { + if (1 == layersTable-> selectedItems().at(i)->column()) + { + list.append(layersTable-> selectedItems().at(i)->text() ); + } + } + emit updated( &list ); + accept(); +} + +void OGRSubLayersGui::on_buttonBox_rejected() +{ + reject(); +} + +void OGRSubLayersGui::populateLayerTable (QStringList *theList) +{ + for (int i =0; i< theList->size(); i++){ + QString ligne = theList -> at(i); + QStringList elements = ligne.split(":"); + + QTableWidgetItem *layerIDItem = new QTableWidgetItem(elements.at(0)); + QTableWidgetItem *layerNameItem = new QTableWidgetItem(elements.at(1)); + QTableWidgetItem *featuresItem = new QTableWidgetItem(elements.at(2)); + + int row = layersTable->rowCount(); + layersTable->insertRow(row); + layersTable->setItem(row, 0, layerIDItem); + layersTable->setItem(row, 1, layerNameItem); + layersTable->setItem(row, 2, featuresItem); + } +} + +void OGRSubLayersGui::updateSelection() +{ +} Index: src/plugins/ogrsublayers/ogrsublayers.h =================================================================== --- src/plugins/ogrsublayers/ogrsublayers.h (révision 0) +++ src/plugins/ogrsublayers/ogrsublayers.h (révision 0) @@ -0,0 +1,109 @@ +/*************************************************************************** + ogrsublayers.h + ------------------- + begin : Jan 21, 2004 + copyright : (C) 2004 by Tim Sutton + email : tim@linfiniti.com + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +/* $Id: plugin.h 9138 2008-08-23 21:37:31Z jef $ */ +/*************************************************************************** + * QGIS Programming conventions: + * + * mVariableName - a class level member variable + * sVariableName - a static class level member variable + * variableName() - accessor for a class member (no 'get' in front of name) + * setVariableName() - mutator for a class member (prefix with 'set') + * + * Additional useful conventions: + * + * theVariableName - a method parameter (prefix with 'the') + * myVariableName - a locally declared variable within a method ('my' prefix) + * + * DO: Use mixed case variable names - myVariableName + * DON'T: separate variable names using underscores: my_variable_name (NO!) + * + * **************************************************************************/ +#ifndef OGRSubLayers_H +#define OGRSubLayers_H + +//QT4 includes +#include + +//QGIS includes +#include "../qgisplugin.h" + +//forward declarations +class QAction; +class QToolBar; + +class QgisInterface; + +/** +* \class Plugin +* \brief [name] plugin for QGIS +* [description] +*/ +class OGRSubLayers: public QObject, public QgisPlugin +{ + Q_OBJECT + public: + + ////////////////////////////////////////////////////////////////////// + // + // MANDATORY PLUGIN METHODS FOLLOW + // + ////////////////////////////////////////////////////////////////////// + + /** + * Constructor for a plugin. The QgisInterface pointer is passed by + * QGIS when it attempts to instantiate the plugin. + * @param theInterface Pointer to the QgisInterface object. + */ + OGRSubLayers( QgisInterface * theInterface ); + //! Destructor + virtual ~OGRSubLayers(); + + + public slots: + //! init the gui + virtual void initGui(); + //! Show the dialog box + void run(); + //! unload the plugin + void unload(); + //! show the help document + void help(); + void load( QStringList * list); + + + private: + QString uri; + //////////////////////////////////////////////////////////////////// + // + // MANDATORY PLUGIN PROPERTY DECLARATIONS ..... + // + //////////////////////////////////////////////////////////////////// + + int mPluginType; + //! Pointer to the QGIS interface object + QgisInterface *mQGisIface; + //!pointer to the qaction for this plugin + QAction * mQActionPointer; + //////////////////////////////////////////////////////////////////// + // + // ADD YOUR OWN PROPERTY DECLARATIONS AFTER THIS POINT..... + // + //////////////////////////////////////////////////////////////////// +}; + +#endif //OGRSubLayers_H Index: src/plugins/ogrsublayers/ogrsublayersgui.h =================================================================== --- src/plugins/ogrsublayers/ogrsublayersgui.h (révision 0) +++ src/plugins/ogrsublayers/ogrsublayersgui.h (révision 0) @@ -0,0 +1,46 @@ +/*************************************************************************** + * Copyright (C) 2003 by Tim Sutton * + * tim@linfiniti.com * + * * + * This is a plugin generated from the QGIS plugin template * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ +#ifndef OGRSubLayersGUI_H +#define OGRSubLayersGUI_H + +#include +#include +#include + +#include + +/** +@author Tim Sutton +*/ +class OGRSubLayersGui : public QDialog, private Ui::OGRSubLayersGuiBase +{ + Q_OBJECT + public: + OGRSubLayersGui( QWidget* parent = 0, Qt::WFlags fl = 0 ); + ~OGRSubLayersGui(); + void populateLayerTable (QStringList *theList); + QStringList * getSelection (); + void updateSelection(); + + private: + static const int context_id = 0; + + private slots: + void on_buttonBox_accepted(); + void on_buttonBox_rejected(); + + signals: + void updated(QStringList*list); + +}; + +#endif Index: src/plugins/ogrsublayers/ogrsublayersguibase.ui =================================================================== --- src/plugins/ogrsublayers/ogrsublayersguibase.ui (révision 0) +++ src/plugins/ogrsublayers/ogrsublayersguibase.ui (révision 0) @@ -0,0 +1,118 @@ + + OGRSubLayersGuiBase + + + + 0 + 0 + 584 + 535 + + + + Select OGR layers to load + + + + + + + 9 + + + 9 + + + 9 + + + 9 + + + 6 + + + 6 + + + + + + 0 + 0 + + + + + Sans Serif + 24 + 75 + false + true + false + false + + + + Sub layers list + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + + + + + + + + 564 + 274 + + + + + 564 + 274 + + + + QAbstractItemView::NoEditTriggers + + + QAbstractItemView::MultiSelection + + + QAbstractItemView::SelectRows + + + + + + + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This is the list of all layers available in the datasource of the active layer. You can select the layers to load. The layers will be loaded when you press "OK".</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The layer name is format dependant. Consult the OGR documentation or the documentation of your data format to determine the nature of the included information.</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Be advised: </span>selecting an already opened layer will not generate an error message and the layer will end up loaded twice!</p></body></html> + + + + + + + + + Index: src/plugins/ogrsublayers/README =================================================================== --- src/plugins/ogrsublayers/README (révision 0) +++ src/plugins/ogrsublayers/README (révision 0) @@ -0,0 +1,43 @@ +Welcome to the OGR multilayer plugin +------------------------------------------------------------- + +This plugin is designed to allow you to choose the layers you +want to load from an OGR multilayer datasource like KML or S57. + +------------------------------------------------------------- + +The plugin usage is very simple. + +Once the plugin has been loaded with the Plugins Manager, you +will find a new icon in the toolbar. + +To choose the layers to load: +First load you datasource as you always did until now. +("V" key, or add a new vector layer menu entry, then +select the datafile from which you wish to load the data). + +If everything goes well, you will see a new layer in the layer +lists on the left side of the screen (assuming you still have +the standard screen layout...). In fact, this layer is the +layer which has an ID of 0 in OGR. This is the default layer +loader by QGis normally. + +If you select this layer (which makes it the active layer) and +clic on the plugin icon, and if the datasource contains more +than just one layer, then you will be presented with the list +of all the layers that are available for you to load and display. + +Select the different layers you want to load into QGis. + +Be advised: nothing prevents you from loading a layer that you +have already loaded (for exemple, il you select the first line in +the list, you will load the first layer a second time) + +When you are done with the selection, you can clic OK and +the selected layers will hopefully be loaded into QGis. + +You can then manage the loaded layers as you are used to do with +usual data sources. There is absolutly no difference. + +Please feel free to report any bug, comment or question to +felahdab@gmail.com Index: src/providers/ogr/qgsogrprovider.h =================================================================== --- src/providers/ogr/qgsogrprovider.h (révision 10014) +++ src/providers/ogr/qgsogrprovider.h (copie de travail) @@ -47,6 +47,13 @@ virtual QgsCoordinateReferenceSystem crs(); + /** + * Sub-layers handled by this provider, in order from bottom to top + * + * Sub-layers are used when the provider's source can combine layers + * it knows about in some way before it hands them off to the provider. + */ + virtual QStringList subLayers(); /** * Returns the permanent storage type for this layer as a friendly name. @@ -181,14 +188,6 @@ * @param index the index of the attribute * @param values reference to the list of unique values */ virtual void uniqueValues( int index, QList &uniqueValues ); - - protected: - /** loads fields from input file to member attributeFields */ - void loadFields(); - - /**Get an attribute associated with a feature*/ - void getFeatureAttribute( OGRFeatureH ogrFet, QgsFeature & f, int attindex ); - /** return a provider name Essentially just returns the provider key. Should be used to build file @@ -219,7 +218,15 @@ */ QString description() const; + protected: + /** loads fields from input file to member attributeFields */ + void loadFields(); + /**Get an attribute associated with a feature*/ + void getFeatureAttribute( OGRFeatureH ogrFet, QgsFeature & f, int attindex ); + + + private: unsigned char *getGeometryPointer( OGRFeatureH fet ); @@ -247,7 +254,6 @@ //! Selection rectangle OGRGeometryH mSelectionRectangle; - /**Adds one feature*/ bool addFeature( QgsFeature& f ); /**Deletes one feature*/ Index: src/providers/ogr/qgsogrprovider.cpp =================================================================== --- src/providers/ogr/qgsogrprovider.cpp (révision 10014) +++ src/providers/ogr/qgsogrprovider.cpp (copie de travail) @@ -73,14 +73,61 @@ // try to open for update, but disable error messages to avoid a // message if the file is read only, because we cope with that // ourselves. + + // This part of the code parses the uri transmitted to the ogr provider to + // get the options the client wants us to apply + + QString mFilePath; + QString theLayerName; + int theLayerIndex=0; + + // If there is no & in the uri, then the uri is just the filename. The loaded + // layer will be layer 0. + if ( ! uri.contains('&', Qt::CaseSensitive)) + { + mFilePath = uri; + } + else + { + // If we get here, there are some options added to the filename. We must parse + // the different parts separated by &, and among each option, the name and the + // value around the =. + // A valid uri is of the form: filename&option1=value1&option2=value2,... + + QStringList theURIParts = uri.split("&"); + mFilePath = theURIParts.at( 0 ); + + for (int i = 1 ; i < theURIParts.size(); i++ ) + { + QStringList theInstruction = theURIParts.at( i ).split( "=" ); + if ( 0 == theInstruction.at( 0 ).compare( QString( "layerid" ))) + { + bool ok; + theLayerIndex = theInstruction.at( 1 ).toInt( &ok ); + if ( ! ok ) + { + theLayerIndex = 0; + } + } + if ( 0 == theInstruction.at( 0 ).compare( QString( "layername" ))) + { + theLayerName = theInstruction.at( 1 ); + } + } + } + + QgsLogger::debug("mFilePath: " + mFilePath); + QgsLogger::debug("theLayerIndex: "+theLayerIndex); + QgsLogger::debug("theLayerName: "+theLayerName); + CPLPushErrorHandler( CPLQuietErrorHandler ); - ogrDataSource = OGROpen( QFile::encodeName( uri ).constData(), TRUE, &ogrDriver ); + ogrDataSource = OGROpen( QFile::encodeName( mFilePath ).constData(), TRUE, &ogrDriver ); CPLPopErrorHandler(); if ( ogrDataSource == NULL ) { // try to open read-only - ogrDataSource = OGROpen( QFile::encodeName( uri ).constData(), FALSE, &ogrDriver ); + ogrDataSource = OGROpen( QFile::encodeName( mFilePath ).constData(), FALSE, &ogrDriver ); //TODO Need to set a flag or something to indicate that the layer //TODO is in read-only mode, otherwise edit ops will fail @@ -95,9 +142,17 @@ valid = true; ogrDriverName = OGR_Dr_GetName( ogrDriver ); + + // We get the layer which was requested by the uri. The layername + // has precedence over the layerid if both are given. + if ( NULL == theLayerName ) + { + ogrLayer = OGR_DS_GetLayer( ogrDataSource, theLayerIndex ); + }else + { + ogrLayer = OGR_DS_GetLayerByName( ogrDataSource, (char*)(theLayerName.toLocal8Bit().data()) ); + } - ogrLayer = OGR_DS_GetLayer( ogrDataSource, 0 ); - // get the extent_ (envelope) of the layer QgsDebugMsg( "Starting get extent" ); @@ -145,6 +200,23 @@ } } +QStringList QgsOgrProvider::subLayers() +{ + QStringList theList = QStringList(); + if (! valid ) + { + return theList; + } + for ( int i = 0; i < layerCount() ; i++ ) + { + QString theLayerName = QString(OGR_FD_GetName(OGR_L_GetLayerDefn(OGR_DS_GetLayer( ogrDataSource, i )))); + int theLayerFeatureCount=OGR_L_GetFeatureCount(OGR_DS_GetLayer( ogrDataSource, i ),1) ; + + theList.append(QString::number(i)+":"+ theLayerName+":"+QString::number(theLayerFeatureCount)); + } + return theList; +} + void QgsOgrProvider::setEncoding( const QString& e ) { QgsVectorDataProvider::setEncoding( e );