Quantum GIS API Documentation
1.8
|
00001 /*************************************************************************** 00002 qgspluginlayerregistry.cpp - class for 00003 registering plugin layer creators 00004 ------------------- 00005 begin : Mon Nov 30 2009 00006 copyright : (C) 2009 by Mathias Walker, Sourcepole 00007 email : mwa at sourcepole.ch 00008 ***************************************************************************/ 00009 00010 /*************************************************************************** 00011 * * 00012 * This program is free software; you can redistribute it and/or modify * 00013 * it under the terms of the GNU General Public License as published by * 00014 * the Free Software Foundation; either version 2 of the License, or * 00015 * (at your option) any later version. * 00016 * * 00017 ***************************************************************************/ 00018 00019 #ifndef QGSPLUGINLAYERREGSITRY_H 00020 #define QGSPLUGINLAYERREGSITRY_H 00021 00022 #include <QMap> 00023 #include <QDomNode> 00024 00025 class QgsPluginLayer; 00026 00032 class CORE_EXPORT QgsPluginLayerType 00033 { 00034 public: 00035 00036 QgsPluginLayerType( QString name ); 00037 virtual ~QgsPluginLayerType(); 00038 00039 QString name(); 00040 00042 virtual QgsPluginLayer* createLayer(); 00043 00045 virtual bool showLayerProperties( QgsPluginLayer* layer ); 00046 00047 protected: 00048 QString mName; 00049 }; 00050 00051 //============================================================================= 00052 00058 class CORE_EXPORT QgsPluginLayerRegistry 00059 { 00060 public: 00061 00063 static QgsPluginLayerRegistry* instance(); 00064 00065 ~QgsPluginLayerRegistry(); 00066 00068 bool addPluginLayerType( QgsPluginLayerType* pluginLayerType ); 00069 00071 bool removePluginLayerType( QString typeName ); 00072 00074 QgsPluginLayerType* pluginLayerType( QString typeName ); 00075 00077 QgsPluginLayer* createLayer( QString typeName ); 00078 00079 private: 00080 00081 typedef QMap<QString, QgsPluginLayerType*> PluginLayerTypes; 00082 00084 QgsPluginLayerRegistry(); 00085 00087 static QgsPluginLayerRegistry* _instance; 00088 00089 PluginLayerTypes mPluginLayerTypes; 00090 }; 00091 00092 #endif // QGSPLUGINLAYERREGSITRY_H