This repository has been archived by the owner on Sep 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvlayer_plugin.h
53 lines (42 loc) · 1.5 KB
/
vlayer_plugin.h
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
//
// This plugin is here to demonstrate the integration of virtual layers into the QGIS GUI
// It should be considered temporary. The idea is to include virtual layers into the core
#include <QAction>
#include <qgis.h>
#include <qgisinterface.h>
#include <qgisplugin.h>
class QgsLayerTreeViewMenuProvider;
class VLayerPlugin : public QObject, public QgisPlugin
{
Q_OBJECT
public:
VLayerPlugin( QgisInterface *iface );
void initGui();
void unload();
// type for parameter storage
typedef QList<QPair<QString, QString> > ParameterPairs;
public slots:
void onCreate();
private slots:
void addVectorLayer( const QString& source, const QString& name, const QString& provider );
void onContextMenu( const QPoint& );
void onLayerFilter();
void onLayerFilterFromMenu();
void onLayerFilterFromContextMenu();
void onLayerSettings();
void onAddLayer();
private:
// return the virtual layer parameters for a set of vector layers
ParameterPairs createVirtualLayer( const QList<QgsVectorLayer*>& layers );
// create a virtual layer out of the passed layer insert it in the legend
void duplicateLayerToVirtual( QgsVectorLayer* vl );
void creationDialog( const ParameterPairs&, bool replaceMode = false );
QgisInterface* iface_;
QAction* createAction_;
QAction* addAction_;
QAction* origFilterAction_;
QAction* origLayerMenuAction_;
QAction* settingsAction_;
QgsLayerTreeViewMenuProvider* origMenuProvider_;
bool mReplaceMode;
};