QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgspluginlayerregistry.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgspluginlayerregistry.cpp - class for
3  registering plugin layer creators
4  -------------------
5  begin : Mon Nov 30 2009
6  copyright : (C) 2009 by Mathias Walker, Sourcepole
7  email : mwa at sourcepole.ch
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 #ifndef QGSPLUGINLAYERREGSITRY_H
20 #define QGSPLUGINLAYERREGSITRY_H
21 
22 #include <QMap>
23 #include <QDomNode>
24 
25 class QgsPluginLayer;
26 
32 class CORE_EXPORT QgsPluginLayerType
33 {
34  public:
35 
36  QgsPluginLayerType( QString name );
37  virtual ~QgsPluginLayerType();
38 
39  QString name();
40 
42  virtual QgsPluginLayer* createLayer();
43 
45  virtual bool showLayerProperties( QgsPluginLayer* layer );
46 
47  protected:
48  QString mName;
49 };
50 
51 //=============================================================================
52 
58 class CORE_EXPORT QgsPluginLayerRegistry
59 {
60  public:
61 
63  static QgsPluginLayerRegistry* instance();
64 
66 
69  QStringList pluginLayerTypes();
70 
72  bool addPluginLayerType( QgsPluginLayerType* pluginLayerType );
73 
75  bool removePluginLayerType( QString typeName );
76 
78  QgsPluginLayerType* pluginLayerType( QString typeName );
79 
81  QgsPluginLayer* createLayer( QString typeName );
82 
83  private:
84 
85  typedef QMap<QString, QgsPluginLayerType*> PluginLayerTypes;
86 
89 
91  static QgsPluginLayerRegistry* _instance;
92 
93  PluginLayerTypes mPluginLayerTypes;
94 };
95 
96 #endif // QGSPLUGINLAYERREGSITRY_H
a registry of plugin layers types
Definition: qgspluginlayerregistry.h:58
Base class for plugin layers.
Definition: qgspluginlayer.h:32
QString mName
Definition: qgspluginlayerregistry.h:48
class for creating plugin specific layers
Definition: qgspluginlayerregistry.h:32