Subgroup: Map
Class: QgsMapLayerStore¶
-
class
qgis.core.
QgsMapLayerStore
¶ Bases:
PyQt5.QtCore.QObject
A storage object for map layers, in which the layers are owned by the store and have their lifetime bound to the store.
New in version 3.0: Methods
addMapLayer
Add a layer
to the store.addMapLayers
Add a list of layers
to the store.blockSignals
childEvent
children
connectNotify
count
Returns the number of layers contained in the store. customEvent
deleteLater
disconnect
disconnectNotify
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
event
eventFilter
findChild
findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject findChildren
findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] inherits
installEventFilter
isSignalConnected
isWidgetType
isWindowType
killTimer
mapLayer
Retrieve a pointer to a layer by layer id
.mapLayers
Returns a map of all layers by layer ID. mapLayersByName
Retrieve a list of matching layers by layer name
.metaObject
moveToThread
objectName
parent
property
pyqtConfigure
Each keyword argument is either the name of a Qt property or a Qt signal. receivers
removeAllMapLayers
Removes all registered layers. removeEventFilter
removeMapLayer
Remove a layer from the store by layer id
.removeMapLayers
Remove a set of layers
from the store.removeMapLayersById
Remove a set of layers from the store by layer ID. sender
senderSignalIndex
setObjectName
setParent
setProperty
signalsBlocked
startTimer
takeMapLayer
Takes a layer
from the store.thread
timerEvent
tr
transferLayersFromStore
Transfers all the map layers contained within another map layer store and adds them to this store. Attributes
allLayersRemoved
Emitted when all layers are removed, before layersWillBeRemoved() and layerWillBeRemoved() signals are emitted. destroyed
destroyed(self, QObject = None) [signal] layerRemoved
Emitted after a layer was removed from the store. layerWasAdded
Emitted when a layer
was added to the store.layerWillBeRemoved
Emitted when a layer is about to be removed from the store. layersAdded
Emitted when one or more layers were added to the store. layersRemoved
Emitted after one or more layers were removed from the store. layersWillBeRemoved
Emitted when one or more layers are about to be removed from the store. objectNameChanged
objectNameChanged(self, str) [signal] staticMetaObject
-
addMapLayer
(self, layer: QgsMapLayer) → QgsMapLayer¶ Add a
layer
to the store. Ownership of the layer is transferred to the store.The layersAdded() and layerWasAdded() signals will always be emitted. If you are adding multiple layers at once, you should use addMapLayers() instead.
Parameters: - layer – A layer to add to the store
- takeOwnership – Ownership will be transferred to the layer store.
If you specify false here you have take care of deleting the layers yourself. Not available in Python.
Returns: None if unable to add layer, otherwise pointer to newly added layer See also
Note
Use addMapLayers() if adding more than one layer at a time.
See also
-
addMapLayers
(self, layers: Iterable[QgsMapLayer]) → List[QgsMapLayer]¶ Add a list of
layers
to the store. Ownership of the layers is transferred to the store.The layersAdded() and layerWasAdded() signals will always be emitted.
Parameters: - layers – A list of layer which should be added to the store.
- takeOwnership – Ownership will be transferred to the layer store.
If you specify false here you have take care of deleting the layers yourself. Not available in Python.
Returns: a list of the map layers that were added successfully. If a layer is invalid, or already exists in the store, it will not be part of the returned list.
See also
-
allLayersRemoved
¶ Emitted when all layers are removed, before layersWillBeRemoved() and layerWillBeRemoved() signals are emitted. The layersWillBeRemoved() and layerWillBeRemoved() signals will still be emitted following this signal. You can use this signal to do easy (and fast) cleanup. [signal]
-
childEvent
()¶
-
connectNotify
()¶
-
count
(self) → int¶ Returns the number of layers contained in the store.
-
customEvent
()¶
-
disconnectNotify
()¶
-
isSignalConnected
()¶
-
layerRemoved
¶ Emitted after a layer was removed from the store.
Parameters: layerId – The ID of the layer removed. Note
Consider using layersRemoved() instead
See also
layerWillBeRemoved()
[signal]
-
layerWasAdded
¶ Emitted when a
layer
was added to the store.Note
Consider using layersAdded() instead
See also
layersAdded()
[signal]
-
layerWillBeRemoved
¶ Emitted when a layer is about to be removed from the store.
Parameters: layerId – The ID of the layer to be removed. Note
Consider using layersWillBeRemoved() instead.
See also
See also
layerRemoved()
[signal]Emitted when a layer is about to be removed from the store.
Parameters: layer – The layer to be removed. Note
Consider using layersWillBeRemoved() instead.
See also
See also
layerRemoved()
[signal]
-
layersAdded
¶ Emitted when one or more layers were added to the store.
Parameters: layers – List of layers which have been added. See also
legendLayersAdded()
See also
layerWasAdded()
[signal]
-
layersRemoved
¶ Emitted after one or more layers were removed from the store.
Parameters: layerIds – A list of IDs of the layers which were removed. See also
layersWillBeRemoved()
[signal]
-
layersWillBeRemoved
¶ Emitted when one or more layers are about to be removed from the store.
Parameters: layerIds – A list of IDs for the layers which are to be removed. See also
See also
layersRemoved()
[signal]Emitted when one or more layers are about to be removed from the store.
Parameters: layers – A list of layers which are to be removed. See also
See also
layersRemoved()
[signal]
-
mapLayer
(self, id: str) → QgsMapLayer¶ Retrieve a pointer to a layer by layer
id
.Parameters: id – ID of layer to retrieve Returns: matching layer, or None if no matching layer found See also
See also
-
mapLayers
(self) → object¶ Returns a map of all layers by layer ID.
See also
See also
See also
layers()
-
mapLayersByName
(self, name: str) → List[QgsMapLayer]¶ Retrieve a list of matching layers by layer
name
.Parameters: name – name of layers to match Returns: list of matching layers See also
See also
-
receivers
()¶
-
removeAllMapLayers
(self)¶ Removes all registered layers. These layers will also be deleted.
Note
Calling this method will cause the removeAll() signal to be emitted.
See also
See also
-
removeMapLayer
(self, id: str)¶ Remove a layer from the store by layer
id
.The specified layer will be removed from the store. The layer will also be deleted.
Parameters: id – ID of the layer to remove See also
See also
See also
removeMapLayer(self, layer: QgsMapLayer) Remove a
layer
from the store.The specified layer will be removed from the store. The layer will also be deleted.
Parameters: layer – The layer to remove. Null pointers are ignored. See also
See also
See also
-
removeMapLayers
(self, layers: Iterable[QgsMapLayer])¶ Remove a set of
layers
from the store.The specified layers will be removed from the store. These layers will also be deleted.
Parameters: layers – A list of layers to remove. Null pointers are ignored. See also
See also
See also
-
removeMapLayersById
(self, layerIds: Iterable[str])¶ 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.
Parameters: layerIds – list of IDs of the layers to remove See also
See also
See also
Note
available in Python bindings as removeMapLayersById.
-
sender
()¶
-
senderSignalIndex
()¶
-
takeMapLayer
(self, layer: QgsMapLayer) → QgsMapLayer¶ 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.See also
-
timerEvent
()¶
-
transferLayersFromStore
(self, other: QgsMapLayerStore)¶ 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.
-