21
21
22
22
#include < QMap>
23
23
#include < QObject>
24
-
24
+ # include < QStringList >
25
25
class QString ;
26
- class QStringList ;
27
-
28
26
class QgsMapLayer ;
29
27
30
28
/* * \ingroup core
@@ -59,20 +57,56 @@ class CORE_EXPORT QgsMapLayerRegistry : public QObject
59
57
As a side-effect QgsProject is made dirty.
60
58
61
59
Emits signal that layer has been added only if theEmitSignal is true (by default).
62
- Not emitting signal is useful when you want to use registry also for layers
63
- which won't be used in main map canvas but will be used in a special one
60
+
61
+ Not emitting signal is useful when you want to use registry for layers
62
+ on a different canvas and don't want them added to the main canvas automatically.
63
+
64
+ @note This method is deprecated since QGIS 1.8, you should use addMapLayers rather.
64
65
*/
65
66
QgsMapLayer *addMapLayer ( QgsMapLayer * theMapLayer, bool theEmitSignal = true );
66
67
68
+ /* * Add a layer to the map of loaded layers
69
+ @returns QList<QgsMapLayer *> - a list of the map layers that were added
70
+ successfully. If a layer is invalid, or already exists in the registry,
71
+ it will not be part of the returned QList.
72
+ @note added in QGIS 1.8
73
+
74
+ As a side-effect QgsProject is made dirty.
75
+
76
+ If theEmitSignal is true (by default), a layersAdded( QList<QgsMapLayer *>)
77
+ signal will be emitted indicating that a batch of layers were added.
78
+ Not emitting signal is useful when you want to use registry for layers
79
+ on a different canvas and don't want them added to the main canvas automatically.
80
+ */
81
+ QList<QgsMapLayer *> addMapLayers ( QList<QgsMapLayer *> theMapLayers,
82
+ bool theEmitSignal = true );
83
+
84
+
67
85
/* * Remove a layer from qgis
86
+ @note As a side-effect QgsProject is made dirty. Any canvases using that layer will need to remove it
87
+
88
+ If theEmitSignal is true (by default), a layerWillBeRemoved( QString theId )
89
+ signal will be emitted indicating to any listeners that the layer is being removed.
90
+
91
+ The layer being removed is deleted as well as the registry
92
+ table entry.
93
+ @note This method is deprecated since QGIS 1.8, you should use removeMapLayers rather.
94
+ */
95
+ void removeMapLayer ( QString theLayerId, bool theEmitSignal = true );
96
+
97
+ /* * Remove a set of layers from qgis
68
98
@note
69
99
As a side-effect QgsProject is made dirty.
70
- Any canvases using that layer will need to remove it
71
- theEmitSignal - see addMapLayer()
100
+ Any canvases using the affected layers will need to remove them
101
+
102
+ If theEmitSignal is true (by default), a layersRemoved( QStringList theLayerIds )
103
+ signal will be emitted indicating to any listeners that the layers are being removed.
104
+
72
105
The layer being removed is deleted as well as the registry
73
106
table entry.
74
107
*/
75
- void removeMapLayer ( QString theLayerId, bool theEmitSignal = true );
108
+ void removeMapLayers ( QStringList theLayerIds, bool theEmitSignal = true );
109
+
76
110
77
111
/* * Remove all registered layers
78
112
@note raises removedAll()
@@ -95,13 +129,24 @@ class CORE_EXPORT QgsMapLayerRegistry : public QObject
95
129
96
130
signals:
97
131
132
+ /* * Emitted when one or more layers are removed from the registry
133
+ @note intended to replace layerWillBeRemoved in QGIS 1.8
134
+ */
135
+ void layersWillBeRemoved ( QStringList theLayerIds );
136
+
98
137
/* * emitted when a layer is removed from the registry
99
138
connected to main map canvas and overview map canvas remove()
139
+ @note Deprecated in 1.8 - see layersWillBeRemoved
100
140
*/
101
141
void layerWillBeRemoved ( QString theLayerId );
102
142
143
+ /* * Emitted when one or more layers are added to the registry
144
+ @note intended to replace layerWasAdded in QGIS 1.8
145
+ */
146
+ void layersAdded ( QList<QgsMapLayer *> theMapLayers );
103
147
/* * emitted when a layer is added to the registry
104
148
connected to main map canvas and overview map canvas addLayer()
149
+ @note Deprecated in 1.8 - see layersAdded
105
150
*/
106
151
void layerWasAdded ( QgsMapLayer * theMapLayer );
107
152
0 commit comments