mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Added QgsMapCanvas::layers() method
git-svn-id: http://svn.osgeo.org/qgis/trunk@12935 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
a14ed90360
commit
63d0a6520d
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user