-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
qgsgrassplugin.h
179 lines (160 loc) · 5.19 KB
/
qgsgrassplugin.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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/***************************************************************************
qgsgrassplugin.h - GRASS menu
-------------------
begin : March, 2004
copyright : (C) 2004 by Radim Blazek
email : blazek@itc.it
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#ifndef QGSGRASSPLUGIN_H
#define QGSGRASSPLUGIN_H
#include "../qgisplugin.h"
#include "qgscoordinatereferencesystem.h"
#include "qgscoordinatetransform.h"
#include <QObject>
class QgsGrassTools;
class QgsGrassNewMapset;
class QgsGrassRegion;
class QgsMapCanvas;
class QgsMapLayer;
class QgsMapTool;
class QgsRubberBand;
class QgsVectorLayer;
class QAction;
class QIcon;
class QPainter;
class QToolBar;
/**
* \class QgsGrassPlugin
* \brief OpenModeller plugin for QGIS
*
*/
class QgsGrassPlugin : public QObject, public QgisPlugin
{
Q_OBJECT
public:
/**
* Constructor for a plugin. The QgisInterface pointer is passed by
* QGIS when it attempts to instantiate the plugin.
* @param qI Pointer to the QgisInterface object.
*/
QgsGrassPlugin( QgisInterface * qI );
/**
* Virtual function to return the name of the plugin. The name will be used when presenting a list
* of installable plugins to the user
*/
virtual QString name();
/**
* Virtual function to return the version of the plugin.
*/
virtual QString version();
/**
* Virtual function to return a description of the plugins functions
*/
virtual QString description();
/**
* Virtual function to return a category of the plugin
*/
virtual QString category();
/**
* Return the plugin type
*/
virtual int type();
//! Destructor
virtual ~QgsGrassPlugin();
//! Get an icon from the active theme if possible
static QIcon getThemeIcon( const QString &theName );
public slots:
//! init the gui
virtual void initGui() override;
//! unload the plugin
void unload() override;
//! show the help document
void help();
//! Gisbase changed by user
void onGisbaseChanged();
//! Display current region
void displayRegion();
//! Switch region on/off
void switchRegion( bool on );
//! Redraw region
void redrawRegion( void );
//! Post render
void postRender( QPainter * );
//! Open tools
void openTools( void );
//! Create new mapset
void newMapset();
//! Open existing mapset and save it to project
void openMapset();
//! Close mapset and save it to project
void closeMapset();
//! Current mapset changed (opened/closed)
void mapsetChanged();
//! Create new vector
void newVector();
//! Read project
void projectRead();
//! New project
void newProject();
//! update plugin icons when the app tells us its theme is changed
void setCurrentTheme( QString theThemeName );
void setTransform();
//! Called when a new layer was added to map registry
void onLayerWasAdded( QgsMapLayer* theMapLayer );
//! Called when editing of a layer started
void onEditingStarted();
void onEditingStopped();
void onCurrentLayerChanged( QgsMapLayer* layer );
// Start editing tools
void addFeature();
// Called when new layer was created in browser
void onNewLayer( QString uri, QString name );
private:
void resetEditActions();
//! Pointer to our toolbar
QToolBar *mToolBarPointer;
//! Pointer to the QGIS interface object
QgisInterface *qGisInterface;
//! Pointer to canvas
QgsMapCanvas *mCanvas;
//! Pointer to Display region acction
QAction *mRegionAction;
// Region rubber band
QgsRubberBand *mRegionBand;
//! GRASS tools
QgsGrassTools *mTools;
//! Pointer to QgsGrassNewMapset
QgsGrassNewMapset *mNewMapset;
QgsCoordinateReferenceSystem mCrs;
QgsCoordinateTransform mCoordinateTransform;
// Actions
QAction *mOpenMapsetAction;
QAction *mNewMapsetAction;
QAction *mCloseMapsetAction;
QAction *mOpenToolsAction;
QAction *mNewVectorAction;
QAction *mOptionsAction;
// Editing static bool mNonInitializable;
QAction *mAddFeatureAction;
QAction *mAddPointAction;
QAction *mAddLineAction;
QAction *mAddBoundaryAction;
QAction *mAddCentroidAction;
QAction *mAddAreaAction;
QgsMapTool *mAddPoint;
QgsMapTool *mAddLine;
QgsMapTool *mAddBoundary;
QgsMapTool *mAddCentroid;
QgsMapTool *mAddArea;
// Names of layer styles before editing started
QMap<QgsVectorLayer *, QString> mOldStyles;
};
#endif // QGSGRASSPLUGIN_H