00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef QGSMAPLAYERREGISTRY_H
00021 #define QGSMAPLAYERREGISTRY_H
00022
00023 #include <QMap>
00024 #include <QObject>
00025
00026 class QString;
00027 class QStringList;
00028
00029 class QgsMapLayer;
00030
00035 class CORE_EXPORT QgsMapLayerRegistry : public QObject
00036 {
00037 Q_OBJECT
00038
00039 public:
00040
00042 static QgsMapLayerRegistry * instance();
00046 int count();
00047
00048 ~QgsMapLayerRegistry();
00049
00051 QgsMapLayer * mapLayer( QString theLayerId );
00052
00054 QMap<QString, QgsMapLayer*> & mapLayers();
00055
00066 QgsMapLayer *addMapLayer( QgsMapLayer * theMapLayer, bool theEmitSignal = true );
00067
00076 void removeMapLayer( QString theLayerId, bool theEmitSignal = true );
00077
00083 void removeAllMapLayers();
00084
00085
00086
00087
00088
00089
00090
00091 void clearAllLayerCaches();
00092
00095 void reloadAllLayers();
00096
00097 signals:
00098
00102 void layerWillBeRemoved( QString theLayerId );
00103
00107 void layerWasAdded( QgsMapLayer * theMapLayer );
00108
00117 void removedAll();
00118
00119 protected:
00120
00122 QgsMapLayerRegistry( QObject * parent = 0 );
00123
00124 private:
00125
00126 static QgsMapLayerRegistry* mInstance;
00127
00128 QMap<QString, QgsMapLayer*> mMapLayers;
00129
00133 void connectNotify( const char * signal );
00134
00135
00136 };
00137
00138 #endif //QgsMapLayerRegistry_H
00139