~ubuntu-branches/ubuntu/saucy/qgis/saucy

« back to all changes in this revision

Viewing changes to python/core/qgsmaplayerregistry.sip

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/**
 
3
* \class QgsMapLayerRegistry
 
4
* \brief This class tracks map layers that are currently loaded an provides
 
5
* a means to fetch a pointer to a map layer and delete it
 
6
*/
 
7
class QgsMapLayerRegistry : QObject
 
8
{
 
9
%TypeHeaderCode
 
10
#include <qgsmaplayerregistry.h>
 
11
%End
 
12
  
 
13
public:
 
14
 
 
15
 //! Returns the instance pointer, creating the object on the first call
 
16
 static QgsMapLayerRegistry * instance();
 
17
 
 
18
 //! Return the number of registered layers.
 
19
 int count();
 
20
 
 
21
 ~QgsMapLayerRegistry();
 
22
 
 
23
 //! Retrieve a pointer to a loaded plugin by id
 
24
 QgsMapLayer * mapLayer(QString theLayerId);
 
25
 
 
26
 //! Retrieve the mapLayers collection (mainly intended for use by projection)
 
27
 QMap<QString,QgsMapLayer*> & mapLayers();
 
28
 
 
29
 /** Add a layer to the map of loaded layers 
 
30
    @returns NULL if unable to add layer, otherwise pointer to newly added layer
 
31
    @note
 
32
 
 
33
    As a side-effect QgsProject is made dirty.
 
34
 
 
35
    Emits signal that layer has been added only if theEmitSignal is true (by default).
 
36
    Not emitting signal is useful when you want to use registry also for layers
 
37
    which won't be used in main map canvas but will be used in a special one
 
38
 */
 
39
 QgsMapLayer *  addMapLayer(QgsMapLayer * theMapLayer /Transfer/, bool theEmitSignal = TRUE);
 
40
 
 
41
 /** Remove a layer from qgis
 
42
 
 
43
    @note
 
44
 
 
45
    As a side-effect QgsProject is made dirty.
 
46
 
 
47
    Any canvases using that layer will need to remove it
 
48
 
 
49
    theEmitSignal - see addMapLayer()
 
50
 */
 
51
 void removeMapLayer(QString theLayerId, bool theEmitSignal = TRUE);
 
52
 
 
53
 /** Remove all registered layers 
 
54
 
 
55
    @note raises removedAll()
 
56
 
 
57
    As a side-effect QgsProject is made dirty.
 
58
 
 
59
 */
 
60
 void removeAllMapLayers();
 
61
 
 
62
 /* Clears all layer caches, resetting them to zero and 
 
63
 * freeing up any memory they may have been using. Layer
 
64
 * caches are used to speed up rendering in certain situations
 
65
 * see ticket #1974 for more details.
 
66
 * @note this method was added in QGIS 1.4
 
67
 */
 
68
 void clearAllLayerCaches();
 
69
 
 
70
signals:
 
71
 
 
72
    /** emitted when a layer is removed from the registry
 
73
 
 
74
       connected to main map canvas and overview map canvas remove()
 
75
    */
 
76
 void layerWillBeRemoved(QString theLayerId);
 
77
 
 
78
    /** emitted when a layer is added to the registry
 
79
 
 
80
       connected to main map canvas and overview map canvas addLayer()
 
81
    */
 
82
 void layerWasAdded(QgsMapLayer * theMapLayer);
 
83
 
 
84
 /** emitted when ALL layers are removed at once
 
85
 
 
86
    This could have been implemented by iteratively signalling
 
87
    layerWillBeRemoved() for each layer as it is removed.  However, this
 
88
    generally causes a cascade of effects that are unnecessary if we're
 
89
    ultimately removing all layers.  E.g., removing the legend item
 
90
    corresponding to the layer.  Why bother doing that when you're just going
 
91
    to clear everything anyway?
 
92
 
 
93
  */
 
94
 void removedAll();
 
95
 
 
96
protected:
 
97
 
 
98
 //! protected constructor
 
99
 QgsMapLayerRegistry( QObject * parent = 0 );
 
100
 
 
101
 
 
102
}; // class QgsMapLayerRegistry
 
103