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