QGIS API Documentation
2.4.0-Chugiak
|
A registry / canonical manager of data providers. More...
#include <qgsproviderregistry.h>
Public Types | |
typedef std::map< QString, QgsProviderMetadata * > | Providers |
open the given vector data source More... | |
Public Member Functions | |
virtual | ~QgsProviderRegistry () |
Virtual dectructor. More... | |
QString | library (const QString &providerKey) const |
Return path for the library of the provider. More... | |
QString | pluginList (bool asHtml=false) const |
Return list of provider plugins found. More... | |
const QDir & | libraryDirectory () const |
return library directory where plugins are found More... | |
void | setLibraryDirectory (const QDir &path) |
Set library directory where to search for plugins. More... | |
QgsDataProvider * | provider (const QString &providerKey, const QString &dataSource) |
Create an instance of the provider. More... | |
QWidget * | selectWidget (const QString &providerKey, QWidget *parent=0, Qt::WindowFlags fl=0) |
void * | function (const QString &providerKey, const QString &functionName) |
Get pointer to provider function. More... | |
QLibrary * | providerLibrary (const QString &providerKey) const |
QStringList | providerList () const |
Return list of available providers by their keys. More... | |
const QgsProviderMetadata * | providerMetadata (const QString &providerKey) const |
Return metadata of the provider or NULL if not found. More... | |
virtual QString | fileVectorFilters () const |
return vector file filter string More... | |
virtual QString | fileRasterFilters () const |
return raster file filter string More... | |
virtual QString | databaseDrivers () const |
return a string containing the available database drivers More... | |
virtual QString | directoryDrivers () const |
return a string containing the available directory drivers More... | |
virtual QString | protocolDrivers () const |
return a string containing the available protocol drivers More... | |
void | registerGuis (QWidget *widget) |
Static Public Member Functions | |
static QgsProviderRegistry * | instance (QString pluginPath=QString::null) |
means of accessing canonical single instance More... | |
Private Member Functions | |
QgsProviderRegistry (QString pluginPath) | |
ctor private since instance() creates it More... | |
Private Attributes | |
Providers | mProviders |
associative container of provider metadata handles More... | |
QDir | mLibraryDirectory |
directory in which provider plugins are installed More... | |
QString | mVectorFileFilters |
file filter string for vector files More... | |
QString | mRasterFileFilters |
file filter string for raster files More... | |
QString | mDatabaseDrivers |
Available database drivers string for vector databases. More... | |
QString | mDirectoryDrivers |
Available directory drivers string for vector databases. More... | |
QString | mProtocolDrivers |
Available protocol drivers string for vector databases. More... | |
A registry / canonical manager of data providers.
This is a Singleton class that manages data provider access.
Definition at line 40 of file qgsproviderregistry.h.
typedef std::map<QString, QgsProviderMetadata*> QgsProviderRegistry::Providers |
open the given vector data source
Similar to open(QString const &), except that the user specifies a data provider with which to open the data source instead of using the default data provider that QgsDataManager would figure out to use. This should be useful when (and if) there will exist more than one data provider that can handle a given data source. (E.g., use GDAL to open an SDTS file, or a different data provider that uses sdts++.)
Called by QgsDataManager::open().
name | could be a file, URI |
provider | is the key for the dataprovider used to open name |
Temporarily always returns false until finished implementing.
Eventually would be nice if could make QgsDataManager smart enough to figure out whether the given name mapped to a vector, raster, or database source.type for data provider metadata associative container
Definition at line 155 of file qgsproviderregistry.h.
|
virtual |
Virtual dectructor.
Definition at line 205 of file qgsproviderregistry.cpp.
References cast_to_fptr, mProviders, and QgsDebugMsg.
|
private |
ctor private since instance() creates it
Definition at line 56 of file qgsproviderregistry.cpp.
References cast_to_fptr, QgsMessageOutput::createMessageOutput(), fileRasterFilters(), fileVectorFilters(), mDatabaseDrivers, mDirectoryDrivers, QgsMessageOutput::MessageText, mLibraryDirectory, mProtocolDrivers, mProviders, mRasterFileFilters, mVectorFileFilters, QgsDebugMsg, QgsMessageOutput::setMessage(), QgsMessageOutput::setTitle(), QgsMessageOutput::showMessage(), and tr.
Referenced by instance().
|
virtual |
return a string containing the available database drivers
Definition at line 448 of file qgsproviderregistry.cpp.
References mDatabaseDrivers.
|
virtual |
return a string containing the available directory drivers
Definition at line 453 of file qgsproviderregistry.cpp.
References mDirectoryDrivers.
|
virtual |
return raster file filter string
Returns a string suitable for a QFileDialog of raster file formats supported by all data providers.
This walks through all data providers appending calls to their buildSupportedRasterFileFilter to a string, which is then returned.
Definition at line 443 of file qgsproviderregistry.cpp.
References mRasterFileFilters.
Referenced by QgsProviderRegistry().
|
virtual |
return vector file filter string
Returns a string suitable for a QFileDialog of vector file formats supported by all data providers.
This walks through all data providers appending calls to their fileVectorFilters to a string, which is then returned.
It'd be nice to eventually be raster/vector neutral.
Definition at line 438 of file qgsproviderregistry.cpp.
References mVectorFileFilters.
Referenced by QgsProjectBadLayerGuiHandler::handleBadLayers(), and QgsProviderRegistry().
void * QgsProviderRegistry::function | ( | const QString & | providerKey, |
const QString & | functionName | ||
) |
Get pointer to provider function.
providerKey | identificator of the provider |
functionName | name of function |
Definition at line 389 of file qgsproviderregistry.cpp.
References library(), and QgsDebugMsg.
Referenced by QgsRasterDataProvider::create(), QgsRasterLayer::isValidRasterFileName(), and QgsRasterDataProvider::pyramidResamplingMethods().
|
static |
means of accessing canonical single instance
Definition at line 48 of file qgsproviderregistry.cpp.
References QgsProviderRegistry().
Referenced by QgsBrowserModel::addRootItems(), QgsRasterFileWriter::buildPyramids(), QgsRasterDataProvider::create(), QgsApplication::exitQgis(), QgsVectorLayer::getStyleFromDatabase(), QgsProjectBadLayerGuiHandler::handleBadLayers(), QgsRasterFormatSaveOptionsWidget::helpOptions(), QgsApplication::initQgis(), QgsRasterLayer::isValidRasterFileName(), QgsVectorLayer::listStylesInDatabase(), QgsVectorLayer::loadNamedStyle(), QgsRasterDataProvider::pyramidResamplingMethods(), QgsDirectoryItem::QgsDirectoryItem(), QgsVectorLayerImport::QgsVectorLayerImport(), QgsZipItem::QgsZipItem(), QgsNewVectorLayerDialog::runAndCreateLayer(), QgsRasterChecker::runTest(), QgsVectorLayer::saveStyleToDatabase(), QgsRasterLayer::setDataProvider(), QgsVectorLayer::setDataProvider(), and QgsRasterFormatSaveOptionsWidget::validateOptions().
QString QgsProviderRegistry::library | ( | const QString & | providerKey | ) | const |
Return path for the library of the provider.
Definition at line 249 of file qgsproviderregistry.cpp.
References findMetadata_(), QgsProviderMetadata::library(), and mProviders.
Referenced by function(), provider(), providerLibrary(), and QgsNewVectorLayerDialog::runAndCreateLayer().
QDir const & QgsProviderRegistry::libraryDirectory | ( | ) | const |
return library directory where plugins are found
Definition at line 302 of file qgsproviderregistry.cpp.
References mLibraryDirectory.
QString QgsProviderRegistry::pluginList | ( | bool | asHtml = false | ) | const |
Return list of provider plugins found.
Definition at line 262 of file qgsproviderregistry.cpp.
References mProviders, and tr.
|
virtual |
return a string containing the available protocol drivers
Definition at line 458 of file qgsproviderregistry.cpp.
References mProtocolDrivers.
QgsDataProvider * QgsProviderRegistry::provider | ( | const QString & | providerKey, |
const QString & | dataSource | ||
) |
Create an instance of the provider.
Copied from QgsVectorLayer::setDataProvider TODO: Make it work in the generic environment.
providerKey | identificator of the provider |
dataSource | string containing data source for the provider |
TODO: Is this class really the best place to put a data provider loader? It seems more sensible to provide the code in one place rather than in qgsrasterlayer, qgsvectorlayer, serversourceselect, etc.
Definition at line 320 of file qgsproviderregistry.cpp.
References cast_to_fptr, library(), QgsMessageLog::logMessage(), QgsDataProvider::name(), QgsDebugMsg, tr, and QgsLogger::warning().
Referenced by QgsRasterFileWriter::buildPyramids(), QgsVectorLayerImport::QgsVectorLayerImport(), registerGuis(), QgsRasterChecker::runTest(), QgsRasterLayer::setDataProvider(), and QgsVectorLayer::setDataProvider().
QLibrary * QgsProviderRegistry::providerLibrary | ( | const QString & | providerKey | ) | const |
Definition at line 407 of file qgsproviderregistry.cpp.
References library(), and QgsDebugMsg.
Referenced by QgsBrowserModel::addRootItems(), QgsVectorLayer::getStyleFromDatabase(), QgsRasterFormatSaveOptionsWidget::helpOptions(), QgsVectorLayer::listStylesInDatabase(), QgsVectorLayer::loadNamedStyle(), QgsDirectoryItem::QgsDirectoryItem(), QgsVectorLayerImport::QgsVectorLayerImport(), QgsZipItem::QgsZipItem(), QgsVectorLayer::saveStyleToDatabase(), and QgsRasterFormatSaveOptionsWidget::validateOptions().
QStringList QgsProviderRegistry::providerList | ( | ) | const |
Return list of available providers by their keys.
Definition at line 463 of file qgsproviderregistry.cpp.
References mProviders.
Referenced by QgsBrowserModel::addRootItems(), QgsDirectoryItem::QgsDirectoryItem(), and registerGuis().
const QgsProviderMetadata * QgsProviderRegistry::providerMetadata | ( | const QString & | providerKey | ) | const |
Return metadata of the provider or NULL if not found.
Definition at line 473 of file qgsproviderregistry.cpp.
References findMetadata_(), and mProviders.
void QgsProviderRegistry::registerGuis | ( | QWidget * | widget | ) |
Definition at line 423 of file qgsproviderregistry.cpp.
References cast_to_fptr, provider(), and providerList().
QWidget * QgsProviderRegistry::selectWidget | ( | const QString & | providerKey, |
QWidget * | parent = 0 , |
||
Qt::WindowFlags | fl = 0 |
||
) |
Definition at line 377 of file qgsproviderregistry.cpp.
References cast_to_fptr.
void QgsProviderRegistry::setLibraryDirectory | ( | const QDir & | path | ) |
Set library directory where to search for plugins.
Definition at line 296 of file qgsproviderregistry.cpp.
References mLibraryDirectory.
|
private |
Available database drivers string for vector databases.
This is a string of form: DriverNameToShow,DriverName;DriverNameToShow,DriverName;...
Definition at line 184 of file qgsproviderregistry.h.
Referenced by databaseDrivers(), and QgsProviderRegistry().
|
private |
Available directory drivers string for vector databases.
This is a string of form: DriverNameToShow,DriverName;DriverNameToShow,DriverName;...
Definition at line 190 of file qgsproviderregistry.h.
Referenced by directoryDrivers(), and QgsProviderRegistry().
|
private |
directory in which provider plugins are installed
Definition at line 165 of file qgsproviderregistry.h.
Referenced by libraryDirectory(), QgsProviderRegistry(), and setLibraryDirectory().
|
private |
Available protocol drivers string for vector databases.
This is a string of form: DriverNameToShow,DriverName;DriverNameToShow,DriverName;...
Definition at line 196 of file qgsproviderregistry.h.
Referenced by protocolDrivers(), and QgsProviderRegistry().
|
private |
associative container of provider metadata handles
Definition at line 162 of file qgsproviderregistry.h.
Referenced by library(), pluginList(), providerList(), providerMetadata(), QgsProviderRegistry(), and ~QgsProviderRegistry().
|
private |
file filter string for raster files
Definition at line 178 of file qgsproviderregistry.h.
Referenced by fileRasterFilters(), and QgsProviderRegistry().
|
private |
file filter string for vector files
Built once when registry is constructed by appending strings returned from iteratively calling vectorFileFilter() for each visited data provider. The alternative would have been to do this each time fileVectorFilters was invoked; instead we only have to build it the one time.
Definition at line 175 of file qgsproviderregistry.h.
Referenced by fileVectorFilters(), and QgsProviderRegistry().