QGIS API Documentation  2.6.0-Brighton
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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>

Public Slots

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

Signals

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

Public Member Functions

 QgsLayerTreeMapCanvasBridge (QgsLayerTreeGroup *root, QgsMapCanvas *canvas, QObject *parent=0)
 Constructor: does not take ownership of the layer tree nor canvas.
void clear ()
QgsLayerTreeGrouprootGroup () const
QgsMapCanvasmapCanvas () const
bool hasCustomLayerOrder () const
QStringList customLayerOrder () const
QStringList defaultLayerOrder () const
void setAutoSetupOnFirstLayer (bool enabled)
 if enabled, will automatically set full canvas extent and destination CRS + map units when first layer(s) are added
bool autoSetupOnFirstLayer () 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
bool autoEnableCrsTransform () const

Protected Slots

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

Protected Member Functions

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

Protected Attributes

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

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

Constructor & Destructor Documentation

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

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

Member Function Documentation

bool QgsLayerTreeMapCanvasBridge::autoEnableCrsTransform ( ) const
inline
bool QgsLayerTreeMapCanvasBridge::autoSetupOnFirstLayer ( ) const
inline
void QgsLayerTreeMapCanvasBridge::clear ( )
QStringList QgsLayerTreeMapCanvasBridge::customLayerOrder ( ) const
inline
void QgsLayerTreeMapCanvasBridge::customLayerOrderChanged ( const QStringList &  order)
signal
QStringList QgsLayerTreeMapCanvasBridge::defaultLayerOrder ( ) const
void QgsLayerTreeMapCanvasBridge::defaultLayerOrder ( QgsLayerTreeNode node,
QStringList &  order 
) const
protected
void QgsLayerTreeMapCanvasBridge::deferredSetCanvasLayers ( )
protected
bool QgsLayerTreeMapCanvasBridge::hasCustomLayerOrder ( ) const
inline
void QgsLayerTreeMapCanvasBridge::hasCustomLayerOrderChanged ( bool  )
signal
QgsMapCanvas* QgsLayerTreeMapCanvasBridge::mapCanvas ( ) const
inline
void QgsLayerTreeMapCanvasBridge::nodeAddedChildren ( QgsLayerTreeNode node,
int  indexFrom,
int  indexTo 
)
protectedslot
void QgsLayerTreeMapCanvasBridge::nodeCustomPropertyChanged ( QgsLayerTreeNode node,
QString  key 
)
protectedslot
void QgsLayerTreeMapCanvasBridge::nodeRemovedChildren ( )
protectedslot
void QgsLayerTreeMapCanvasBridge::nodeVisibilityChanged ( )
protectedslot
void QgsLayerTreeMapCanvasBridge::readProject ( const QDomDocument &  doc)
slot
QgsLayerTreeGroup* QgsLayerTreeMapCanvasBridge::rootGroup ( ) const
inline
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

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

void QgsLayerTreeMapCanvasBridge::setCanvasLayers ( )
slot

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

void QgsLayerTreeMapCanvasBridge::setCanvasLayers ( QgsLayerTreeNode node,
QList< QgsMapCanvasLayer > &  layers 
)
protected
void QgsLayerTreeMapCanvasBridge::setCustomLayerOrder ( const QStringList &  order)
slot
void QgsLayerTreeMapCanvasBridge::setHasCustomLayerOrder ( bool  override)
slot
void QgsLayerTreeMapCanvasBridge::writeProject ( QDomDocument &  doc)
slot

Member Data Documentation

bool QgsLayerTreeMapCanvasBridge::mAutoEnableCrsTransform
protected
bool QgsLayerTreeMapCanvasBridge::mAutoSetupOnFirstLayer
protected
QgsMapCanvas* QgsLayerTreeMapCanvasBridge::mCanvas
protected
QStringList QgsLayerTreeMapCanvasBridge::mCustomLayerOrder
protected
QgsCoordinateReferenceSystem QgsLayerTreeMapCanvasBridge::mFirstCRS
protected
bool QgsLayerTreeMapCanvasBridge::mHasCustomLayerOrder
protected
bool QgsLayerTreeMapCanvasBridge::mHasFirstLayer
protected
bool QgsLayerTreeMapCanvasBridge::mLastLayerCount
protected
bool QgsLayerTreeMapCanvasBridge::mPendingCanvasUpdate
protected
QgsLayerTreeGroup* QgsLayerTreeMapCanvasBridge::mRoot
protected

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