00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef QGSMAPLAYERREGISTRY_H
00020 #define QGSMAPLAYERREGISTRY_H
00021
00022 #include <QMap>
00023 #include <QObject>
00024 #include <QStringList>
00025 class QString;
00026 class QgsMapLayer;
00027
00032 class CORE_EXPORT QgsMapLayerRegistry : public QObject
00033 {
00034 Q_OBJECT
00035
00036 public:
00037
00039 static QgsMapLayerRegistry * instance();
00043 int count();
00044
00045 ~QgsMapLayerRegistry();
00046
00048 QgsMapLayer * mapLayer( QString theLayerId );
00049
00051 QMap<QString, QgsMapLayer*> & mapLayers();
00052
00066 Q_DECL_DEPRECATED QgsMapLayer *addMapLayer( QgsMapLayer * theMapLayer, bool theEmitSignal = true );
00067
00081 QList<QgsMapLayer *> addMapLayers( QList<QgsMapLayer *> theMapLayers,
00082 bool theEmitSignal = true );
00083
00084
00095 Q_DECL_DEPRECATED void removeMapLayer( QString theLayerId, bool theEmitSignal = true );
00096
00107 void removeMapLayers( QStringList theLayerIds, bool theEmitSignal = true );
00108
00109
00115 void removeAllMapLayers();
00116
00117
00118
00119
00120
00121
00122
00123 void clearAllLayerCaches();
00124
00127 void reloadAllLayers();
00128
00129 signals:
00130
00134 void layersWillBeRemoved( QStringList theLayerIds );
00135
00140 void layerWillBeRemoved( QString theLayerId );
00141
00145 void layersAdded( QList<QgsMapLayer *> theMapLayers );
00150 void layerWasAdded( QgsMapLayer * theMapLayer );
00151
00160 void removedAll();
00161
00162 protected:
00163
00165 QgsMapLayerRegistry( QObject * parent = 0 );
00166
00167 private:
00168
00169 static QgsMapLayerRegistry* mInstance;
00170
00171 QMap<QString, QgsMapLayer*> mMapLayers;
00172
00176 void connectNotify( const char * signal );
00177
00178
00179 };
00180
00181 #endif //QgsMapLayerRegistry_H
00182