/usr/include/qgis/qgsmaplayerregistry.h is in libqgis-dev 1.7.4+1.7.5~20120320-1.1+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | /***************************************************************************
qgsmaplayerregistry.h
Singleton class for keeping track of loaded layers
-------------------
begin : Sun June 04 2004
copyright : (C) 2004 by Tim Sutton
email : tim@linfiniti.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/* $Id$ */
#ifndef QGSMAPLAYERREGISTRY_H
#define QGSMAPLAYERREGISTRY_H
#include <QMap>
#include <QObject>
class QString;
class QStringList;
class QgsMapLayer;
/** \ingroup core
* This class tracks map layers that are currently loaded and provides
* a means to fetch a pointer to a map layer and delete it.
*/
class CORE_EXPORT QgsMapLayerRegistry : public QObject
{
Q_OBJECT
public:
//! Returns the instance pointer, creating the object on the first call
static QgsMapLayerRegistry * instance();
/*! Return the number of registered layers.
*
* */
int count();
~QgsMapLayerRegistry();
//! Retrieve a pointer to a loaded plugin by id
QgsMapLayer * mapLayer( QString theLayerId );
//! Retrieve the mapLayers collection (mainly intended for use by projectio)
QMap<QString, QgsMapLayer*> & mapLayers();
/** Add a layer to the map of loaded layers
@returns NULL if unable to add layer, otherwise pointer to newly added layer
@note
As a side-effect QgsProject is made dirty.
Emits signal that layer has been added only if theEmitSignal is true (by default).
Not emitting signal is useful when you want to use registry also for layers
which won't be used in main map canvas but will be used in a special one
*/
QgsMapLayer *addMapLayer( QgsMapLayer * theMapLayer, bool theEmitSignal = true );
/** Remove a layer from qgis
@note
As a side-effect QgsProject is made dirty.
Any canvases using that layer will need to remove it
theEmitSignal - see addMapLayer()
The layer being removed is deleted as well as the registry
table entry.
*/
void removeMapLayer( QString theLayerId, bool theEmitSignal = true );
/** Remove all registered layers
@note raises removedAll()
As a side-effect QgsProject is made dirty.
@note The layers are deleted as the registry is cleared!
*/
void removeAllMapLayers();
/* Clears all layer caches, resetting them to zero and
* freeing up any memory they may have been using. Layer
* caches are used to speed up rendering in certain situations
* see ticket #1974 for more details.
* @note this method was added in QGIS 1.4
*/
void clearAllLayerCaches();
/**Reload all provider data caches (currently used for WFS and WMS providers)
@note: this method was added in QGIS 1.6*/
void reloadAllLayers();
signals:
/** emitted when a layer is removed from the registry
connected to main map canvas and overview map canvas remove()
*/
void layerWillBeRemoved( QString theLayerId );
/** emitted when a layer is added to the registry
connected to main map canvas and overview map canvas addLayer()
*/
void layerWasAdded( QgsMapLayer * theMapLayer );
/** emitted when ALL layers are removed at once
This could have been implemented by iteratively signalling
layerWillBeRemoved() for each layer as it is removed. However, this
generally causes a cascade of effects that are unnecessary if we're
ultimately removing all layers. E.g., removing the legend item
corresponding to the layer. Why bother doing that when you're just going
to clear everything anyway?
*/
void removedAll();
protected:
//! protected constructor
QgsMapLayerRegistry( QObject * parent = 0 );
private:
static QgsMapLayerRegistry* mInstance;
QMap<QString, QgsMapLayer*> mMapLayers;
/** debugging member
invoked when a connect() is made to this object
*/
void connectNotify( const char * signal );
}; // class QgsMapLayerRegistry
#endif //QgsMapLayerRegistry_H
|