48 return mMapLayers.
size();
53 return mMapLayers.
value( theLayerId );
61 if ( layer->
name() == layerName )
63 myResultList << layer;
78 if ( !myLayer || !myLayer->
isValid() )
86 mMapLayers[myLayer->
id()] = myLayer;
87 myResultList << mMapLayers[myLayer->
id()];
114 return addedLayers.
isEmpty() ? nullptr : addedLayers[0];
122 Q_FOREACH (
const QString &myId, theLayerIds )
124 layers << mMapLayers.
value( myId );
141 if ( layer && mMapLayers.
contains( layer->
id() ) )
143 layerIds << layer->
id();
156 mMapLayers.
remove( myId );
157 if ( lyr->
parent() == this )
195 void QgsMapLayerRegistry::onMapLayerDeleted(
QObject* obj )
197 QString id = mMapLayers.
key( static_cast<QgsMapLayer*>( obj ) );
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
void legendLayersAdded(const QList< QgsMapLayer *> &theMapLayers)
Emitted, when a layer is added to the registry and the legend.
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.
QString id() const
Get this layer's unique ID, this ID is used to access this layer from map layer registry.
QList< QgsMapLayer * > addMapLayers(const QList< QgsMapLayer *> &theMapLayers, bool addToLegend=true, bool takeOwnership=true)
Add a list of layers to the map of loaded layers.
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.
void setParent(QObject *parent)
const Key key(const T &value) const
QString name() const
Get the display name of the layer.
int count()
Return the number of registered layers.
static QgsMapLayerRegistry * instance()
Returns the instance pointer, creating the object on the first call.
const QMap< QString, QgsMapLayer * > & mapLayers()
Retrieve the mapLayers collection (mainly intended for use by projection)
void layersAdded(const QList< QgsMapLayer *> &theMapLayers)
Emitted when one or more layers are added to the registry.
QgsMapLayer * addMapLayer(QgsMapLayer *theMapLayer, bool addToLegend=true, bool takeOwnership=true)
Add a layer to the map of loaded layers.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void reloadAllLayers()
Reload all provider data caches (currently used for WFS and WMS providers)
bool isNull(const QVariant &v)
void destroyed(QObject *obj)
const T value(const Key &key) const
int remove(const Key &key)