16 #ifndef QGSMAPLAYERREF_H 17 #define QGSMAPLAYERREF_H 33 template<
typename TYPE>
80 return static_cast< bool >(
layer.
data() );
124 if ( layerProviderName( layer ) !=
provider )
177 if ( TYPE *tl = qobject_cast< TYPE *>( l ) )
197 switch ( layer->
type() )
220 #endif // QGSMAPLAYERREF_H Base class for all map layer types.
Internal structure to keep weak pointer to QgsMapLayer or layerId if the layer is not available yet...
_LayerRef< QgsMapLayer > QgsMapLayerRef
bool layerMatchesSource(QgsMapLayer *layer) const
Returns true if a layer matches the weak references to layer public source, layer name and data provi...
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
TYPE * operator->() const
Forwards the to map layer.
QgsMapLayer::LayerType type() const
Get the type of the layer.
virtual QString name() const =0
Return a provider name.
_LayerRef(TYPE *l=nullptr)
Constructor for a layer reference from an existing map layer.
QString provider
Weak reference to layer provider.
QString layerId
Original layer ID.
TYPE * resolveWeakly()
Resolves the map layer by attempting to find a matching layer in the map layer registry using a weak ...
QPointer< TYPE > layer
Weak pointer to map layer.
QString name
Weak reference to layer name.
QString publicSource() const
Gets a version of the internal layer definition that has sensitive bits removed (for example...
void setLayer(TYPE *l)
Sets the reference to point to a specified layer.
QString source
Weak reference to layer public source.
TYPE * resolve()
Resolves the map layer by attempting to find a layer with matching ID within the map layer registry...
_LayerRef(const QString &id, const QString &name=QString(), const QString &source=QString(), const QString &provider=QString())
Constructor for a weak layer reference, using a combination of layer ID, name, public source and prov...
static QgsMapLayerRegistry * instance()
Returns the instance pointer, creating the object on the first call.
QString name
Read property of QString layerName.
QgsRasterDataProvider * dataProvider()
Returns the data provider.
QgsVectorDataProvider * dataProvider()
Returns the data provider.
Represents a vector layer which manages a vector based data sets.