48 return mMapLayers.
size();
53 return mMapLayers.
value( theLayerId );
61 if ( layer->
name() == layerName )
63 myResultList << layer;
76 for (
int i = 0; i < theMapLayers.
size(); ++i )
79 if ( !myLayer || !myLayer->
isValid() )
87 mMapLayers[myLayer->
id()] = myLayer;
88 myResultList << mMapLayers[myLayer->
id()];
90 mOwnedLayers << myLayer;
112 return addedLayers.
isEmpty() ?
nullptr : addedLayers[0];
120 Q_FOREACH (
const QString &myId, theLayerIds )
122 layers << mMapLayers.
value( myId );
135 layerIds << layer->
id();
152 mOwnedLayers.
remove( lyr );
154 mMapLayers.
remove( myId );
184 for ( it = mMapLayers.
begin(); it != mMapLayers.
end() ; ++it )
Base class for all map layer types.
void layerWillBeRemoved(const QString &theLayerId)
Emitted when an owned layer is removed from the registry.
void removeMapLayer(const QString &theLayerId)
Remove a layer from qgis.
void layersRemoved(const QStringList &theLayerIds)
Emitted after one or more layers were removed from the registry.
bool contains(const Key &key) const
QString name() const
Get the display name of the layer.
QList< QgsMapLayer * > addMapLayers(const QList< QgsMapLayer * > &theMapLayers, bool addToLegend=true, bool takeOwnership=true)
Add a list of layers to the map of loaded layers.
const T & at(int i) const
virtual void reload()
Synchronises with changes in the datasource.
void removeMapLayers(const QStringList &theLayerIds)
Remove a set of layers from the registry.
void removeAllMapLayers()
Remove all registered layers.
QgsMapLayer * mapLayer(const QString &theLayerId)
Retrieve a pointer to a loaded layer by id.
QList< Key > keys() const
void layerWasAdded(QgsMapLayer *theMapLayer)
Emitted when a layer is added to the registry.
void layersAdded(const QList< QgsMapLayer * > &theMapLayers)
Emitted when one or more layers are added to the registry.
QString id() const
Get this layer's unique ID, this ID is used to access this layer from map layer registry.
void layerRemoved(const QString &theLayerId)
Emitted after a layer was removed from the registry.
bool isValid()
Return the status of the layer.
This class tracks map layers that are currently loaded and provides a means to fetch a pointer to a m...
QList< QgsMapLayer * > mapLayersByName(const QString &layerName)
Retrieve a pointer to a loaded layer by name.
virtual void connectNotify(const char *signal)
void removeAll()
Emitted, when all layers are removed, before layersWillBeRemoved() and layerWillBeRemoved() signals a...
void layersWillBeRemoved(const QStringList &theLayerIds)
Emitted when one or more layers are removed from the registry.
bool contains(const T &value) const
void legendLayersAdded(const QList< QgsMapLayer * > &theMapLayers)
Emitted, when a layer is added to the registry and the legend.
int count()
Return the number of registered layers.
static QgsMapLayerRegistry * instance()
Returns the instance pointer, creating the object on the first call.
bool remove(const T &value)
const QMap< QString, QgsMapLayer * > & mapLayers()
Retrieve the mapLayers collection (mainly intended for use by projection)
QgsMapLayer * addMapLayer(QgsMapLayer *theMapLayer, bool addToLegend=true, bool takeOwnership=true)
Add a layer to the map of loaded layers.
void reloadAllLayers()
Reload all provider data caches (currently used for WFS and WMS providers)
const T value(const Key &key) const
int remove(const Key &key)