|
| 1 | +/************************************************************************ |
| 2 | + * This file has been generated automatically from * |
| 3 | + * * |
| 4 | + * src/core/qgsmaplayerstore.h * |
| 5 | + * * |
| 6 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 7 | + ************************************************************************/ |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +class QgsMapLayerStore : QObject |
| 15 | +{ |
| 16 | +%Docstring |
| 17 | + A storage object for map layers, in which the layers are owned by the |
| 18 | + store and have their lifetime bound to the store. |
| 19 | +.. versionadded:: 3.0 |
| 20 | +%End |
| 21 | + |
| 22 | +%TypeHeaderCode |
| 23 | +#include "qgsmaplayerstore.h" |
| 24 | +%End |
| 25 | + public: |
| 26 | + |
| 27 | + explicit QgsMapLayerStore( QObject *parent /TransferThis/ = 0 ); |
| 28 | +%Docstring |
| 29 | + Constructor for QgsMapLayerStore. |
| 30 | +%End |
| 31 | + |
| 32 | + ~QgsMapLayerStore(); |
| 33 | + |
| 34 | + int count() const; |
| 35 | +%Docstring |
| 36 | + Returns the number of layers contained in the store. |
| 37 | + :rtype: int |
| 38 | +%End |
| 39 | + |
| 40 | + |
| 41 | + int __len__() const; |
| 42 | +%Docstring |
| 43 | + Returns the number of layers contained in the store. |
| 44 | + :rtype: int |
| 45 | +%End |
| 46 | +%MethodCode |
| 47 | + sipRes = sipCpp->count(); |
| 48 | +%End |
| 49 | + |
| 50 | + QgsMapLayer *mapLayer( const QString &id ) const; |
| 51 | +%Docstring |
| 52 | + Retrieve a pointer to a layer by layer ``id``. |
| 53 | + \param id ID of layer to retrieve |
| 54 | + :return: matching layer, or None if no matching layer found |
| 55 | +.. seealso:: mapLayersByName() |
| 56 | +.. seealso:: mapLayers() |
| 57 | + :rtype: QgsMapLayer |
| 58 | +%End |
| 59 | + |
| 60 | + QList<QgsMapLayer *> mapLayersByName( const QString &name ) const; |
| 61 | +%Docstring |
| 62 | + Retrieve a list of matching layers by layer ``name``. |
| 63 | + \param name name of layers to match |
| 64 | + :return: list of matching layers |
| 65 | +.. seealso:: mapLayer() |
| 66 | +.. seealso:: mapLayers() |
| 67 | + :rtype: list of QgsMapLayer |
| 68 | +%End |
| 69 | + |
| 70 | + QMap<QString, QgsMapLayer *> mapLayers() const; |
| 71 | +%Docstring |
| 72 | + Returns a map of all layers by layer ID. |
| 73 | +.. seealso:: mapLayer() |
| 74 | +.. seealso:: mapLayersByName() |
| 75 | +.. seealso:: layers() |
| 76 | + :rtype: QMap<str, QgsMapLayer *> |
| 77 | +%End |
| 78 | + |
| 79 | + |
| 80 | + QList<QgsMapLayer *> addMapLayers( const QList<QgsMapLayer *> &layers /Transfer/); |
| 81 | + |
| 82 | +%Docstring |
| 83 | + \brief |
| 84 | + Add a list of ``layers`` to the store. Ownership of the layers is transferred |
| 85 | + to the store. |
| 86 | + |
| 87 | + The layersAdded() and layerWasAdded() signals will always be emitted. |
| 88 | + |
| 89 | + \param layers A list of layer which should be added to the store. |
| 90 | + \param takeOwnership Ownership will be transferred to the layer store. |
| 91 | + If you specify false here you have take care of deleting |
| 92 | + the layers yourself. Not available in Python. |
| 93 | + |
| 94 | + :return: a list of the map layers that were added |
| 95 | + successfully. If a layer is invalid, or already exists in the store, |
| 96 | + it will not be part of the returned list. |
| 97 | + |
| 98 | +.. seealso:: addMapLayer() |
| 99 | + :rtype: list of QgsMapLayer |
| 100 | +%End |
| 101 | + |
| 102 | + QgsMapLayer *addMapLayer( QgsMapLayer *layer /Transfer/); |
| 103 | + |
| 104 | +%Docstring |
| 105 | + \brief |
| 106 | + Add a ``layer`` to the store. Ownership of the layer is transferred to the |
| 107 | + store. |
| 108 | + |
| 109 | + The layersAdded() and layerWasAdded() signals will always be emitted. |
| 110 | + If you are adding multiple layers at once, you should use |
| 111 | + addMapLayers() instead. |
| 112 | + |
| 113 | + \param layer A layer to add to the store |
| 114 | + \param takeOwnership Ownership will be transferred to the layer store. |
| 115 | + If you specify false here you have take care of deleting |
| 116 | + the layers yourself. Not available in Python. |
| 117 | + |
| 118 | + :return: None if unable to add layer, otherwise pointer to newly added layer |
| 119 | + |
| 120 | +.. seealso:: addMapLayers |
| 121 | + |
| 122 | +.. note:: |
| 123 | + |
| 124 | + Use addMapLayers() if adding more than one layer at a time. |
| 125 | +.. seealso:: addMapLayers() |
| 126 | + :rtype: QgsMapLayer |
| 127 | +%End |
| 128 | + |
| 129 | + void removeMapLayers( const QStringList &layerIds ) /PyName=removeMapLayersById/; |
| 130 | +%Docstring |
| 131 | + \brief |
| 132 | + Remove a set of layers from the store by layer ID. |
| 133 | + |
| 134 | + The specified layers will be removed from the store. |
| 135 | + These layers will also be deleted. |
| 136 | + |
| 137 | + \param layerIds list of IDs of the layers to remove |
| 138 | + |
| 139 | +.. seealso:: takeMapLayer() |
| 140 | +.. seealso:: removeMapLayer() |
| 141 | +.. seealso:: removeAllMapLayers() |
| 142 | +.. note:: |
| 143 | + |
| 144 | + available in Python bindings as removeMapLayersById. |
| 145 | +%End |
| 146 | + |
| 147 | + void removeMapLayers( const QList<QgsMapLayer *> &layers ); |
| 148 | +%Docstring |
| 149 | + \brief |
| 150 | + Remove a set of ``layers`` from the store. |
| 151 | + |
| 152 | + The specified layers will be removed from the store. |
| 153 | + These layers will also be deleted. |
| 154 | + |
| 155 | + \param layers A list of layers to remove. Null pointers are ignored. |
| 156 | + |
| 157 | +.. seealso:: takeMapLayer() |
| 158 | +.. seealso:: removeMapLayer() |
| 159 | +.. seealso:: removeAllMapLayers() |
| 160 | +%End |
| 161 | + |
| 162 | + void removeMapLayer( const QString &id ); |
| 163 | +%Docstring |
| 164 | + \brief |
| 165 | + Remove a layer from the store by layer ``id``. |
| 166 | + |
| 167 | + The specified layer will be removed from the store. The layer will also be deleted. |
| 168 | + |
| 169 | + \param id ID of the layer to remove |
| 170 | + |
| 171 | +.. seealso:: takeMapLayer() |
| 172 | +.. seealso:: removeMapLayers() |
| 173 | +.. seealso:: removeAllMapLayers() |
| 174 | +%End |
| 175 | + |
| 176 | + void removeMapLayer( QgsMapLayer *layer ); |
| 177 | +%Docstring |
| 178 | + \brief |
| 179 | + Remove a ``layer`` from the store. |
| 180 | + |
| 181 | + The specified layer will be removed from the store. The layer will also be deleted. |
| 182 | + |
| 183 | + \param layer The layer to remove. Null pointers are ignored. |
| 184 | + |
| 185 | +.. seealso:: takeMapLayer() |
| 186 | +.. seealso:: removeMapLayers() |
| 187 | +.. seealso:: removeAllMapLayers() |
| 188 | +%End |
| 189 | + |
| 190 | + QgsMapLayer *takeMapLayer( QgsMapLayer *layer ) /TransferBack/; |
| 191 | +%Docstring |
| 192 | + Takes a ``layer`` from the store. If the layer was owned by the store, the |
| 193 | + layer will be returned without deleting it. The caller takes ownership of |
| 194 | + the layer and is responsible for deleting it. |
| 195 | +.. seealso:: removeMapLayer() |
| 196 | + :rtype: QgsMapLayer |
| 197 | +%End |
| 198 | + |
| 199 | + void removeAllMapLayers(); |
| 200 | +%Docstring |
| 201 | + Removes all registered layers. These layers will also be deleted. |
| 202 | + |
| 203 | +.. note:: |
| 204 | + |
| 205 | + Calling this method will cause the removeAll() signal to |
| 206 | + be emitted. |
| 207 | +.. seealso:: removeMapLayer() |
| 208 | +.. seealso:: removeMapLayers() |
| 209 | +%End |
| 210 | + |
| 211 | + signals: |
| 212 | + |
| 213 | + void layersWillBeRemoved( const QStringList &layerIds ); |
| 214 | +%Docstring |
| 215 | + Emitted when one or more layers are about to be removed from the store. |
| 216 | + |
| 217 | + \param layerIds A list of IDs for the layers which are to be removed. |
| 218 | +.. seealso:: layerWillBeRemoved() |
| 219 | +.. seealso:: layersRemoved() |
| 220 | +%End |
| 221 | + |
| 222 | + void layersWillBeRemoved( const QList<QgsMapLayer *> &layers ); |
| 223 | +%Docstring |
| 224 | + Emitted when one or more layers are about to be removed from the store. |
| 225 | + |
| 226 | + \param layers A list of layers which are to be removed. |
| 227 | +.. seealso:: layerWillBeRemoved() |
| 228 | +.. seealso:: layersRemoved() |
| 229 | +%End |
| 230 | + |
| 231 | + void layerWillBeRemoved( const QString &layerId ); |
| 232 | +%Docstring |
| 233 | + Emitted when a layer is about to be removed from the store. |
| 234 | + |
| 235 | + \param layerId The ID of the layer to be removed. |
| 236 | + |
| 237 | +.. note:: |
| 238 | + |
| 239 | + Consider using layersWillBeRemoved() instead. |
| 240 | +.. seealso:: layersWillBeRemoved() |
| 241 | +.. seealso:: layerRemoved() |
| 242 | +%End |
| 243 | + |
| 244 | + void layerWillBeRemoved( QgsMapLayer *layer ); |
| 245 | +%Docstring |
| 246 | + Emitted when a layer is about to be removed from the store. |
| 247 | + |
| 248 | + \param layer The layer to be removed. |
| 249 | + |
| 250 | +.. note:: |
| 251 | + |
| 252 | + Consider using layersWillBeRemoved() instead. |
| 253 | +.. seealso:: layersWillBeRemoved() |
| 254 | +.. seealso:: layerRemoved() |
| 255 | +%End |
| 256 | + |
| 257 | + void layersRemoved( const QStringList &layerIds ); |
| 258 | +%Docstring |
| 259 | + Emitted after one or more layers were removed from the store. |
| 260 | + |
| 261 | + \param layerIds A list of IDs of the layers which were removed. |
| 262 | +.. seealso:: layersWillBeRemoved() |
| 263 | +%End |
| 264 | + |
| 265 | + void layerRemoved( const QString &layerId ); |
| 266 | +%Docstring |
| 267 | + Emitted after a layer was removed from the store. |
| 268 | + |
| 269 | + \param layerId The ID of the layer removed. |
| 270 | + |
| 271 | +.. note:: |
| 272 | + |
| 273 | + Consider using layersRemoved() instead |
| 274 | +.. seealso:: layerWillBeRemoved() |
| 275 | +%End |
| 276 | + |
| 277 | + void allLayersRemoved(); |
| 278 | +%Docstring |
| 279 | + Emitted when all layers are removed, before layersWillBeRemoved() and |
| 280 | + layerWillBeRemoved() signals are emitted. The layersWillBeRemoved() and |
| 281 | + layerWillBeRemoved() signals will still be emitted following this signal. |
| 282 | + You can use this signal to do easy (and fast) cleanup. |
| 283 | +%End |
| 284 | + |
| 285 | + void layersAdded( const QList<QgsMapLayer *> &layers ); |
| 286 | +%Docstring |
| 287 | + Emitted when one or more layers were added to the store. |
| 288 | + |
| 289 | + \param layers List of layers which have been added. |
| 290 | + |
| 291 | +.. seealso:: legendLayersAdded() |
| 292 | +.. seealso:: layerWasAdded() |
| 293 | +%End |
| 294 | + |
| 295 | + void layerWasAdded( QgsMapLayer *layer ); |
| 296 | +%Docstring |
| 297 | + Emitted when a ``layer`` was added to the store. |
| 298 | + |
| 299 | +.. note:: |
| 300 | + |
| 301 | + Consider using layersAdded() instead |
| 302 | +.. seealso:: layersAdded() |
| 303 | +%End |
| 304 | + |
| 305 | +}; |
| 306 | + |
| 307 | +/************************************************************************ |
| 308 | + * This file has been generated automatically from * |
| 309 | + * * |
| 310 | + * src/core/qgsmaplayerstore.h * |
| 311 | + * * |
| 312 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 313 | + ************************************************************************/ |
0 commit comments