#include <qgsmaplayerregistry.h>
Collaboration diagram for QgsMapLayerRegistry:

Definition at line 35 of file qgsmaplayerregistry.h.
Signals | |
| void | layerWillBeRemoved (QString theLayerId) |
| emitted when a layer is removed from the registry connected to main map canvas and overview map canvas remove() | |
| void | layerWasAdded (QgsMapLayer *theMapLayer) |
| emitted when a layer is added to the registry connected to main map canvas and overview map canvas addLayer() | |
| void | removedAll () |
| emitted when ALL layers are removed at once This could have been implemented by iteratively signalling layerWillBeRemoved() for each layer as it is removed. | |
Public Member Functions | |
| int | count () |
| ~QgsMapLayerRegistry () | |
| QgsMapLayer * | mapLayer (QString theLayerId) |
| Retrieve a pointer to a loaded plugin by id. | |
| QMap< QString, QgsMapLayer * > & | mapLayers () |
| Retrieve the mapLayers collection (mainly intended for use by projectio). | |
| QgsMapLayer * | addMapLayer (QgsMapLayer *theMapLayer, bool theEmitSignal=TRUE) |
| Add a layer to the map of loaded layers. | |
| void | removeMapLayer (QString theLayerId, bool theEmitSignal=TRUE) |
| Remove a layer from qgis. | |
| void | removeAllMapLayers () |
| Remove all registered layers. | |
Static Public Member Functions | |
| static QgsMapLayerRegistry * | instance () |
| Returns the instance pointer, creating the object on the first call. | |
Protected Member Functions | |
| QgsMapLayerRegistry (QObject *parent=0) | |
| protected constructor | |
Private Member Functions | |
| void | connectNotify (const char *signal) |
| debugging member invoked when a connect() is made to this object | |
Private Attributes | |
| QMap< QString, QgsMapLayer * > | mMapLayers |
Static Private Attributes | |
| static QgsMapLayerRegistry * | mInstance |
| QgsMapLayerRegistry::~QgsMapLayerRegistry | ( | ) |
| QgsMapLayerRegistry::QgsMapLayerRegistry | ( | QObject * | parent = 0 |
) | [protected] |
protected constructor
Definition at line 43 of file qgsmaplayerregistry.cpp.
Referenced by instance().
| QgsMapLayerRegistry * QgsMapLayerRegistry::instance | ( | ) | [static] |
Returns the instance pointer, creating the object on the first call.
Definition at line 30 of file qgsmaplayerregistry.cpp.
References mInstance, and QgsMapLayerRegistry().
Referenced by _getMapLayers(), QgsComposerMap::connectUpdateSlot(), QgsComposerMap::containsWMSLayer(), QgsApplication::exitQgis(), QgsApplication::initQgis(), QgsMapCanvas::layer(), QgsComposerLegend::layerIdList(), QgsQuickPrint::printMap(), QgsLegendModel::QgsLegendModel(), QgsProject::read(), QgsRasterLayer::readFile(), QgsLegendModel::readXML(), QgsMapRenderer::render(), QgsQuickPrint::scalePointSymbols(), QgsQuickPrint::scaleTextLabels(), QgsLegendModel::setLayerSet(), QgsMapCanvasSnapper::snapToBackgroundLayers(), QgsMapRenderer::updateFullExtent(), QgsLegendModel::updateLayer(), QgsLegendModel::updateRasterClassificationItem(), QgsLegendModel::updateVectorClassificationItem(), and QgsProject::write().
| int QgsMapLayerRegistry::count | ( | ) |
Return the number of registered layers.
Definition at line 54 of file qgsmaplayerregistry.cpp.
References mMapLayers.
| QgsMapLayer * QgsMapLayerRegistry::mapLayer | ( | QString | theLayerId | ) |
Retrieve a pointer to a loaded plugin by id.
Definition at line 59 of file qgsmaplayerregistry.cpp.
References mMapLayers.
Referenced by QgsComposerMap::containsWMSLayer(), QgsMapCanvas::layer(), QgsQuickPrint::printMap(), QgsLegendModel::readXML(), QgsMapRenderer::render(), QgsQuickPrint::scalePointSymbols(), QgsQuickPrint::scaleTextLabels(), QgsLegendModel::setLayerSet(), QgsMapCanvasSnapper::snapToBackgroundLayers(), QgsMapRenderer::updateFullExtent(), QgsLegendModel::updateLayer(), QgsLegendModel::updateRasterClassificationItem(), and QgsLegendModel::updateVectorClassificationItem().
| QMap< QString, QgsMapLayer * > & QgsMapLayerRegistry::mapLayers | ( | ) |
Retrieve the mapLayers collection (mainly intended for use by projectio).
Definition at line 122 of file qgsmaplayerregistry.cpp.
References mMapLayers.
Referenced by QgsComposerLegend::layerIdList(), and QgsProject::write().
| QgsMapLayer * QgsMapLayerRegistry::addMapLayer | ( | QgsMapLayer * | theMapLayer, | |
| bool | theEmitSignal = TRUE | |||
| ) |
Add a layer to the map of loaded layers.
Emits signal that layer has been added only if theEmitSignal is true (by default). Not emitting signal is useful when you want to use registry also for layers which won't be used in main map canvas but will be used in a special one
Definition at line 67 of file qgsmaplayerregistry.cpp.
References QgsMapLayer::getLayerID(), QgsMapLayer::isValid(), layerWasAdded(), mMapLayers, and QgsDebugMsg.
Referenced by _getMapLayers(), and QgsProject::read().
| void QgsMapLayerRegistry::removeMapLayer | ( | QString | theLayerId, | |
| bool | theEmitSignal = TRUE | |||
| ) |
Remove a layer from qgis.
Definition at line 95 of file qgsmaplayerregistry.cpp.
References layerWillBeRemoved(), and mMapLayers.
| void QgsMapLayerRegistry::removeAllMapLayers | ( | ) |
Remove all registered layers.
The layers are deleted as the registry is cleared!
Definition at line 103 of file qgsmaplayerregistry.cpp.
References layerWillBeRemoved(), mMapLayers, and removedAll().
Referenced by ~QgsMapLayerRegistry().
| void QgsMapLayerRegistry::layerWillBeRemoved | ( | QString | theLayerId | ) | [signal] |
emitted when a layer is removed from the registry connected to main map canvas and overview map canvas remove()
Referenced by removeAllMapLayers(), and removeMapLayer().
| void QgsMapLayerRegistry::layerWasAdded | ( | QgsMapLayer * | theMapLayer | ) | [signal] |
emitted when a layer is added to the registry connected to main map canvas and overview map canvas addLayer()
Referenced by addMapLayer().
| void QgsMapLayerRegistry::removedAll | ( | ) | [signal] |
emitted when ALL layers are removed at once This could have been implemented by iteratively signalling layerWillBeRemoved() for each layer as it is removed.
However, this generally causes a cascade of effects that are unnecessary if we're ultimately removing all layers. E.g., removing the legend item corresponding to the layer. Why bother doing that when you're just going to clear everything anyway?
Referenced by removeAllMapLayers().
| void QgsMapLayerRegistry::connectNotify | ( | const char * | signal | ) | [private] |
debugging member invoked when a connect() is made to this object
Definition at line 129 of file qgsmaplayerregistry.cpp.
QgsMapLayerRegistry * QgsMapLayerRegistry::mInstance [static, private] |
QMap<QString, QgsMapLayer*> QgsMapLayerRegistry::mMapLayers [private] |
Definition at line 116 of file qgsmaplayerregistry.h.
Referenced by addMapLayer(), count(), mapLayer(), mapLayers(), removeAllMapLayers(), and removeMapLayer().
1.5.1