Skip to content
Permalink
Browse files

Added QgsMapCanvas::layers() method

git-svn-id: http://svn.osgeo.org/qgis/trunk@12935 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Feb 12, 2010
1 parent a14ed90 commit 63d0a6520d098403d655655605c6c9213a956b64
Showing with 18 additions and 0 deletions.
  1. +3 −0 python/gui/qgsmapcanvas.sip
  2. +12 −0 src/gui/qgsmapcanvas.cpp
  3. +3 −0 src/gui/qgsmapcanvas.h
@@ -128,6 +128,9 @@ class QgsMapCanvas : QGraphicsView
//! return number of layers on the map
int layerCount() const;

//! return list of layers within map canvas. Added in v1.5
QList<QgsMapLayer*> layers() const;

/*! Freeze/thaw the map canvas. This is used to prevent the canvas from
* responding to events while layers are being added/removed etc.
* @param frz Boolean specifying if the canvas should be frozen (true) or
@@ -1164,6 +1164,18 @@ int QgsMapCanvas::layerCount() const
} // layerCount


QList<QgsMapLayer*> QgsMapCanvas::layers() const
{
QList<QgsMapLayer*> lst;
foreach ( QString layerID, mMapRenderer->layerSet() )
{
QgsMapLayer* layer = QgsMapLayerRegistry::instance()->mapLayer( layerID );
if ( layer )
lst.append(layer);
}
return lst;
}


void QgsMapCanvas::layerStateChange()
{
@@ -185,6 +185,9 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
//! return number of layers on the map
int layerCount() const;

//! return list of layers within map canvas. Added in v1.5
QList<QgsMapLayer*> layers() const;

/*! Freeze/thaw the map canvas. This is used to prevent the canvas from
* responding to events while layers are being added/removed etc.
* @param frz Boolean specifying if the canvas should be frozen (true) or

0 comments on commit 63d0a65

Please sign in to comment.
You can’t perform that action at this time.