QGIS API Documentation  3.4.15-Madeira (e83d02e274)
Signals | Public Member Functions | List of all members
QgsLayerTreeMapCanvasBridge Class Reference

The QgsLayerTreeMapCanvasBridge class takes care of updates of layer set for QgsMapCanvas from a layer tree. More...

#include <qgslayertreemapcanvasbridge.h>

Inheritance diagram for QgsLayerTreeMapCanvasBridge:
Inheritance graph
[legend]

Signals

void canvasLayersChanged (const QList< QgsMapLayer * > &layers)
 Emitted when the set of layers (or order of layers) visible in the canvas changes. More...
 

Public Member Functions

 QgsLayerTreeMapCanvasBridge (QgsLayerTree *root, QgsMapCanvas *canvas, QObject *parent=nullptr)
 Constructor: does not take ownership of the layer tree nor canvas. More...
 
bool autoSetupOnFirstLayer () const
 
QgsMapCanvasmapCanvas () const
 
QgsMapOverviewCanvasoverviewCanvas () const
 Returns associated overview canvas (may be null) More...
 
QgsLayerTreerootGroup () const
 
void setAutoSetupOnFirstLayer (bool enabled)
 if enabled, will automatically set full canvas extent and destination CRS + map units when first layer(s) are added More...
 
Q_INVOKABLE void setCanvasLayers ()
 force update of canvas layers from the layer tree. Normally this should not be needed to be called. More...
 
void setOvervewCanvas (QgsMapOverviewCanvas *overviewCanvas)
 Associates overview canvas with the bridge, so the overview will be updated whenever main canvas is updated. More...
 

Detailed Description

The QgsLayerTreeMapCanvasBridge class takes care of updates of layer set for QgsMapCanvas from a layer tree.

The class listens to the updates in the layer tree and updates the list of layers for rendering whenever some layers are added, removed, or their visibility changes.

The update of layers is not done immediately - it is postponed, so a series of updates to the layer tree will trigger just one update of canvas layers.

Also allows the client to override the default order of layers. This is useful in advanced cases where the grouping in layer tree should be independent from the actual order in the canvas.

Since
QGIS 2.4

Definition at line 49 of file qgslayertreemapcanvasbridge.h.

Constructor & Destructor Documentation

QgsLayerTreeMapCanvasBridge::QgsLayerTreeMapCanvasBridge ( QgsLayerTree root,
QgsMapCanvas canvas,
QObject *  parent = nullptr 
)

Constructor: does not take ownership of the layer tree nor canvas.

Definition at line 28 of file qgslayertreemapcanvasbridge.cpp.

Member Function Documentation

bool QgsLayerTreeMapCanvasBridge::autoSetupOnFirstLayer ( ) const
inline

Definition at line 76 of file qgslayertreemapcanvasbridge.h.

void QgsLayerTreeMapCanvasBridge::canvasLayersChanged ( const QList< QgsMapLayer * > &  layers)
signal

Emitted when the set of layers (or order of layers) visible in the canvas changes.

Since
QGIS 3.0
QgsMapCanvas* QgsLayerTreeMapCanvasBridge::mapCanvas ( ) const
inline

Definition at line 57 of file qgslayertreemapcanvasbridge.h.

QgsMapOverviewCanvas* QgsLayerTreeMapCanvasBridge::overviewCanvas ( ) const
inline

Returns associated overview canvas (may be null)

Since
QGIS 3.0

Definition at line 69 of file qgslayertreemapcanvasbridge.h.

QgsLayerTree* QgsLayerTreeMapCanvasBridge::rootGroup ( ) const
inline

Definition at line 56 of file qgslayertreemapcanvasbridge.h.

void QgsLayerTreeMapCanvasBridge::setAutoSetupOnFirstLayer ( bool  enabled)
inline

if enabled, will automatically set full canvas extent and destination CRS + map units when first layer(s) are added

Definition at line 75 of file qgslayertreemapcanvasbridge.h.

void QgsLayerTreeMapCanvasBridge::setCanvasLayers ( )

force update of canvas layers from the layer tree. Normally this should not be needed to be called.

Definition at line 43 of file qgslayertreemapcanvasbridge.cpp.

void QgsLayerTreeMapCanvasBridge::setOvervewCanvas ( QgsMapOverviewCanvas overviewCanvas)
inline

Associates overview canvas with the bridge, so the overview will be updated whenever main canvas is updated.

Since
QGIS 3.0

Definition at line 63 of file qgslayertreemapcanvasbridge.h.


The documentation for this class was generated from the following files: