QGIS API Documentation  2.7.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | 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]

Public Slots

void readProject (const QDomDocument &doc)
 
void setCanvasLayers ()
 force update of canvas layers from the layer tree. Normally this should not be needed to be called. More...
 
void setCustomLayerOrder (const QStringList &order)
 
void setHasCustomLayerOrder (bool override)
 
void writeProject (QDomDocument &doc)
 

Signals

void customLayerOrderChanged (const QStringList &order)
 
void hasCustomLayerOrderChanged (bool)
 

Public Member Functions

 QgsLayerTreeMapCanvasBridge (QgsLayerTreeGroup *root, QgsMapCanvas *canvas, QObject *parent=0)
 Constructor: does not take ownership of the layer tree nor canvas. More...
 
bool autoEnableCrsTransform () const
 
bool autoSetupOnFirstLayer () const
 
void clear ()
 
QStringList customLayerOrder () const
 
QStringList defaultLayerOrder () const
 
bool hasCustomLayerOrder () const
 
QgsMapCanvasmapCanvas () const
 
QgsLayerTreeGrouprootGroup () const
 
void setAutoEnableCrsTransform (bool enabled)
 if enabled, will automatically turn on on-the-fly reprojection of layers if a layer with different source CRS is added More...
 
void setAutoSetupOnFirstLayer (bool enabled)
 if enabled, will automatically set full canvas extent and destination CRS + map units when first layer(s) are added More...
 

Protected Slots

void nodeAddedChildren (QgsLayerTreeNode *node, int indexFrom, int indexTo)
 
void nodeCustomPropertyChanged (QgsLayerTreeNode *node, QString key)
 
void nodeRemovedChildren ()
 
void nodeVisibilityChanged ()
 

Protected Member Functions

void defaultLayerOrder (QgsLayerTreeNode *node, QStringList &order) const
 
void deferredSetCanvasLayers ()
 
void setCanvasLayers (QgsLayerTreeNode *node, QList< QgsMapCanvasLayer > &layers)
 

Protected Attributes

bool mAutoEnableCrsTransform
 
bool mAutoSetupOnFirstLayer
 
QgsMapCanvasmCanvas
 
QStringList mCustomLayerOrder
 
QgsCoordinateReferenceSystem mFirstCRS
 
bool mHasCustomLayerOrder
 
bool mHasFirstLayer
 
bool mLastLayerCount
 
bool mPendingCanvasUpdate
 
QgsLayerTreeGroupmRoot
 

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.

Note
added in 2.4

Definition at line 44 of file qgslayertreemapcanvasbridge.h.

Constructor & Destructor Documentation

QgsLayerTreeMapCanvasBridge::QgsLayerTreeMapCanvasBridge ( QgsLayerTreeGroup root,
QgsMapCanvas canvas,
QObject *  parent = 0 
)

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

Definition at line 24 of file qgslayertreemapcanvasbridge.cpp.

Member Function Documentation

bool QgsLayerTreeMapCanvasBridge::autoEnableCrsTransform ( ) const
inline

Definition at line 69 of file qgslayertreemapcanvasbridge.h.

bool QgsLayerTreeMapCanvasBridge::autoSetupOnFirstLayer ( ) const
inline

Definition at line 64 of file qgslayertreemapcanvasbridge.h.

void QgsLayerTreeMapCanvasBridge::clear ( )

Definition at line 42 of file qgslayertreemapcanvasbridge.cpp.

QStringList QgsLayerTreeMapCanvasBridge::customLayerOrder ( ) const
inline

Definition at line 57 of file qgslayertreemapcanvasbridge.h.

void QgsLayerTreeMapCanvasBridge::customLayerOrderChanged ( const QStringList &  order)
signal
QStringList QgsLayerTreeMapCanvasBridge::defaultLayerOrder ( ) const

Definition at line 48 of file qgslayertreemapcanvasbridge.cpp.

void QgsLayerTreeMapCanvasBridge::defaultLayerOrder ( QgsLayerTreeNode node,
QStringList &  order 
) const
protected

Definition at line 55 of file qgslayertreemapcanvasbridge.cpp.

void QgsLayerTreeMapCanvasBridge::deferredSetCanvasLayers ( )
protected

Definition at line 243 of file qgslayertreemapcanvasbridge.cpp.

bool QgsLayerTreeMapCanvasBridge::hasCustomLayerOrder ( ) const
inline

Definition at line 56 of file qgslayertreemapcanvasbridge.h.

void QgsLayerTreeMapCanvasBridge::hasCustomLayerOrderChanged ( bool  )
signal
QgsMapCanvas* QgsLayerTreeMapCanvasBridge::mapCanvas ( ) const
inline

Definition at line 54 of file qgslayertreemapcanvasbridge.h.

void QgsLayerTreeMapCanvasBridge::nodeAddedChildren ( QgsLayerTreeNode node,
int  indexFrom,
int  indexTo 
)
protectedslot

Definition at line 252 of file qgslayertreemapcanvasbridge.cpp.

void QgsLayerTreeMapCanvasBridge::nodeCustomPropertyChanged ( QgsLayerTreeNode node,
QString  key 
)
protectedslot

Definition at line 308 of file qgslayertreemapcanvasbridge.cpp.

void QgsLayerTreeMapCanvasBridge::nodeRemovedChildren ( )
protectedslot

Definition at line 284 of file qgslayertreemapcanvasbridge.cpp.

void QgsLayerTreeMapCanvasBridge::nodeVisibilityChanged ( )
protectedslot

Definition at line 303 of file qgslayertreemapcanvasbridge.cpp.

void QgsLayerTreeMapCanvasBridge::readProject ( const QDomDocument &  doc)
slot

Definition at line 183 of file qgslayertreemapcanvasbridge.cpp.

QgsLayerTreeGroup* QgsLayerTreeMapCanvasBridge::rootGroup ( ) const
inline

Definition at line 53 of file qgslayertreemapcanvasbridge.h.

void QgsLayerTreeMapCanvasBridge::setAutoEnableCrsTransform ( bool  enabled)
inline

if enabled, will automatically turn on on-the-fly reprojection of layers if a layer with different source CRS is added

Definition at line 68 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 63 of file qgslayertreemapcanvasbridge.h.

void QgsLayerTreeMapCanvasBridge::setCanvasLayers ( )
slot

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

Definition at line 99 of file qgslayertreemapcanvasbridge.cpp.

void QgsLayerTreeMapCanvasBridge::setCanvasLayers ( QgsLayerTreeNode node,
QList< QgsMapCanvasLayer > &  layers 
)
protected

Definition at line 231 of file qgslayertreemapcanvasbridge.cpp.

void QgsLayerTreeMapCanvasBridge::setCustomLayerOrder ( const QStringList &  order)
slot

Definition at line 79 of file qgslayertreemapcanvasbridge.cpp.

void QgsLayerTreeMapCanvasBridge::setHasCustomLayerOrder ( bool  override)
slot

Definition at line 68 of file qgslayertreemapcanvasbridge.cpp.

void QgsLayerTreeMapCanvasBridge::writeProject ( QDomDocument &  doc)
slot

Definition at line 214 of file qgslayertreemapcanvasbridge.cpp.

Member Data Documentation

bool QgsLayerTreeMapCanvasBridge::mAutoEnableCrsTransform
protected

Definition at line 109 of file qgslayertreemapcanvasbridge.h.

bool QgsLayerTreeMapCanvasBridge::mAutoSetupOnFirstLayer
protected

Definition at line 108 of file qgslayertreemapcanvasbridge.h.

QgsMapCanvas* QgsLayerTreeMapCanvasBridge::mCanvas
protected

Definition at line 101 of file qgslayertreemapcanvasbridge.h.

QStringList QgsLayerTreeMapCanvasBridge::mCustomLayerOrder
protected

Definition at line 106 of file qgslayertreemapcanvasbridge.h.

QgsCoordinateReferenceSystem QgsLayerTreeMapCanvasBridge::mFirstCRS
protected

Definition at line 113 of file qgslayertreemapcanvasbridge.h.

bool QgsLayerTreeMapCanvasBridge::mHasCustomLayerOrder
protected

Definition at line 105 of file qgslayertreemapcanvasbridge.h.

bool QgsLayerTreeMapCanvasBridge::mHasFirstLayer
protected

Definition at line 111 of file qgslayertreemapcanvasbridge.h.

bool QgsLayerTreeMapCanvasBridge::mLastLayerCount
protected

Definition at line 112 of file qgslayertreemapcanvasbridge.h.

bool QgsLayerTreeMapCanvasBridge::mPendingCanvasUpdate
protected

Definition at line 103 of file qgslayertreemapcanvasbridge.h.

QgsLayerTreeGroup* QgsLayerTreeMapCanvasBridge::mRoot
protected

Definition at line 100 of file qgslayertreemapcanvasbridge.h.


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