4
* \brief Abstract base class defining interfaces exposed by QgisApp and
5
* made available to plugins.
7
* Only functionality exposed by QgisInterface can be used in plugins.
8
* This interface has to be implemented with application specific details.
10
* QGIS implements it in QgisAppInterface class, 3rd party applications
11
* could provide their own implementation to be able to use plugins.
14
class QgisInterface : QObject
17
#include <qgisinterface.h>
25
/** Virtual destructor */
26
virtual ~QgisInterface();
28
/** Get pointer to legend interface
31
virtual QgsLegendInterface* legendInterface()=0;
33
public slots: // TODO: do these functions really need to be slots?
35
//! Zoom to full extent of map layers
36
virtual void zoomFull()=0;
37
//! Zoom to previous view extent
38
virtual void zoomToPrevious()=0;
39
//! Zoom to next view extent
40
virtual void zoomToNext()=0;
41
//! Zoome to extent of the active layer
42
virtual void zoomToActiveLayer()=0;
44
//! Add a vector layer
45
virtual QgsVectorLayer* addVectorLayer(QString vectorLayerPath, QString baseName, QString providerKey)=0;
46
//! Add a raster layer given a raster layer file name
47
virtual QgsRasterLayer* addRasterLayer(QString rasterLayerPath, QString baseName = QString())=0;
49
virtual QgsRasterLayer* addRasterLayer(const QString& url, const QString& layerName, const QString& providerKey, const QStringList& layers, const QStringList& styles, const QString& format, const QString& crs) = 0;
52
virtual bool addProject(QString theProject)=0;
53
//! Start a blank project
54
virtual void newProject(bool thePromptToSaveFlag=false)=0;
56
//! Get pointer to the active layer (layer selected in the legend)
57
virtual QgsMapLayer *activeLayer()=0;
59
//! Get pointer to the active layer (layer selected in the legend)
61
virtual bool setActiveLayer( QgsMapLayer * )=0;
63
//! Add an icon to the plugins toolbar
64
virtual int addToolBarIcon(QAction *qAction) =0;
65
//! Remove an action (icon) from the plugin toolbar
66
virtual void removeToolBarIcon(QAction *qAction) = 0;
67
//! Add toolbar with specified name
68
virtual QToolBar* addToolBar(QString name)=0 /Factory/;
70
// TODO: is this deprecated in favour of QgsContextHelp?
71
/** Open a url in the users browser. By default the QGIS doc directory is used
72
* as the base for the URL. To open a URL that is not relative to the installed
73
* QGIS documentation, set useQgisDocDirectory to false.
74
* @param url URL to open
75
* @param useQgisDocDirectory If true, the URL will be formed by concatenating
76
* url to the QGIS documentation directory path (<prefix>/share/doc)
78
virtual void openURL(QString url, bool useQgisDocDirectory=true)=0;
80
/** Return a pointer to the map canvas */
81
virtual QgsMapCanvas * mapCanvas()=0;
83
/** Return a pointer to the main window (instance of QgisApp in case of QGIS) */
84
virtual QWidget * mainWindow()=0;
86
/** Return pointers to the composer views of the running instance (currently only one)*/
87
//virtual QList<QgsComposerView*> composerViews()=0;
89
/**Return mainwindows / composer views of running composer instances (currently only one)*/
90
virtual QList<QgsComposerView*> activeComposers() = 0;
92
/** Add action to the plugins menu */
93
virtual void addPluginToMenu(QString name, QAction* action)=0;
94
/** Remove action from the plugins menu */
95
virtual void removePluginMenu(QString name, QAction* action)=0;
97
/** Add a dock widget to the main window */
98
virtual void addDockWidget ( Qt::DockWidgetArea area, QDockWidget * dockwidget )=0;
100
/** Remove specified dock widget from main window (doesn't delete it). Added in QGIS 1.1. */
101
virtual void removeDockWidget ( QDockWidget * dockwidget )=0;
103
/** refresh legend of a layer */
104
virtual void refreshLegend( QgsMapLayer * layer )=0;
106
/** Add window to Window menu. The action title is the window title
107
* and the action should raise, unminimize and activate the window. */
108
virtual void addWindow( QAction *action ) = 0;
109
/** Remove window from Window menu. Calling this is necessary only for
110
* windows which are hidden rather than deleted when closed. */
111
virtual void removeWindow( QAction *action ) = 0;
113
/** Register action to the shortcuts manager so its shortcut can be changed in GUI
116
virtual bool registerMainWindowAction( QAction* action, QString defaultShortcut ) = 0;
118
/** Unregister a previously registered action. (e.g. when plugin is going to be unloaded)
121
virtual bool unregisterMainWindowAction( QAction* action ) = 0;
123
/** Accessors for inserting items into menus and toolbars.
124
* An item can be inserted before any existing action.
128
virtual QMenu *fileMenu() = 0;
129
virtual QMenu *editMenu() = 0;
130
virtual QMenu *viewMenu() = 0;
131
virtual QMenu *layerMenu() = 0;
132
virtual QMenu *settingsMenu() = 0;
133
virtual QMenu *pluginMenu() = 0;
134
virtual QMenu *firstRightStandardMenu() = 0;
135
virtual QMenu *windowMenu() = 0;
136
virtual QMenu *helpMenu() = 0;
139
virtual QToolBar *fileToolBar() = 0;
140
virtual QToolBar *layerToolBar() = 0;
141
virtual QToolBar *mapNavToolToolBar() = 0;
142
virtual QToolBar *digitizeToolBar() = 0;
143
virtual QToolBar *attributesToolBar() = 0;
144
virtual QToolBar *pluginToolBar() = 0;
145
virtual QToolBar *helpToolBar() = 0;
147
//! File menu actions
148
virtual QAction *actionNewProject() = 0;
149
virtual QAction *actionOpenProject() = 0;
150
virtual QAction *actionFileSeparator1() = 0;
151
virtual QAction *actionSaveProject() = 0;
152
virtual QAction *actionSaveProjectAs() = 0;
153
virtual QAction *actionSaveMapAsImage() = 0;
154
virtual QAction *actionFileSeparator2() = 0;
155
virtual QAction *actionProjectProperties() = 0;
156
virtual QAction *actionFileSeparator3() = 0;
157
virtual QAction *actionPrintComposer() = 0;
158
virtual QAction *actionFileSeparator4() = 0;
159
virtual QAction *actionExit() = 0;
161
//! Edit menu actions
162
virtual QAction *actionCutFeatures() = 0;
163
virtual QAction *actionCopyFeatures() = 0;
164
virtual QAction *actionPasteFeatures() = 0;
165
virtual QAction *actionEditSeparator1() = 0;
166
virtual QAction *actionCapturePoint() = 0;
167
virtual QAction *actionCaptureLine() = 0;
168
virtual QAction *actionCapturePolygon() = 0;
169
virtual QAction *actionDeleteSelected() = 0;
170
virtual QAction *actionMoveFeature() = 0;
171
virtual QAction *actionSplitFeatures() = 0;
172
virtual QAction *actionAddVertex() = 0;
173
virtual QAction *actionDeleteVertex() = 0;
174
virtual QAction *actionMoveVertex() = 0;
175
virtual QAction *actionAddRing() = 0;
176
virtual QAction *actionAddIsland() = 0;
177
virtual QAction *actionEditSeparator2() = 0;
179
//! View menu actions
180
virtual QAction *actionPan() = 0;
181
virtual QAction *actionZoomIn() = 0;
182
virtual QAction *actionZoomOut() = 0;
183
virtual QAction *actionSelect() = 0;
184
virtual QAction *actionIdentify() = 0;
185
virtual QAction *actionMeasure() = 0;
186
virtual QAction *actionMeasureArea() = 0;
187
virtual QAction *actionViewSeparator1() = 0;
188
virtual QAction *actionZoomFullExtent() = 0;
189
virtual QAction *actionZoomToLayer() = 0;
190
virtual QAction *actionZoomToSelected() = 0;
191
virtual QAction *actionZoomLast() = 0;
192
virtual QAction *actionZoomActualSize() = 0;
193
virtual QAction *actionViewSeparator2() = 0;
194
virtual QAction *actionMapTips() = 0;
195
virtual QAction *actionNewBookmark() = 0;
196
virtual QAction *actionShowBookmarks() = 0;
197
virtual QAction *actionDraw() = 0;
198
virtual QAction *actionViewSeparator3() = 0;
200
//! Layer menu actions
201
virtual QAction *actionNewVectorLayer() = 0;
202
virtual QAction *actionAddOgrLayer() = 0;
203
virtual QAction *actionAddRasterLayer() = 0;
204
virtual QAction *actionAddPgLayer() = 0;
205
virtual QAction *actionAddWmsLayer() = 0;
206
virtual QAction *actionLayerSeparator1() = 0;
207
virtual QAction *actionOpenTable() = 0;
208
virtual QAction *actionToggleEditing() = 0;
209
virtual QAction *actionLayerSaveAs() = 0;
210
virtual QAction *actionLayerSelectionSaveAs() = 0;
211
virtual QAction *actionRemoveLayer() = 0;
212
virtual QAction *actionLayerProperties() = 0;
213
virtual QAction *actionLayerSeparator2() = 0;
214
virtual QAction *actionAddToOverview() = 0;
215
virtual QAction *actionAddAllToOverview() = 0;
216
virtual QAction *actionRemoveAllFromOverview() = 0;
217
virtual QAction *actionLayerSeparator3() = 0;
218
virtual QAction *actionHideAllLayers() = 0;
219
virtual QAction *actionShowAllLayers() = 0;
221
//! Plugin menu actions
222
virtual QAction *actionManagePlugins() = 0;
223
virtual QAction *actionPluginSeparator1() = 0;
224
virtual QAction *actionPluginListSeparator() = 0;
225
virtual QAction *actionPluginSeparator2() = 0;
226
virtual QAction *actionPluginPythonSeparator() = 0;
227
virtual QAction *actionShowPythonDialog() = 0;
229
//! Settings menu actions
230
virtual QAction *actionToggleFullScreen() = 0;
231
virtual QAction *actionSettingsSeparator1() = 0;
232
virtual QAction *actionOptions() = 0;
233
virtual QAction *actionCustomProjection() = 0;
235
//! Help menu actions
236
virtual QAction *actionHelpContents() = 0;
237
virtual QAction *actionHelpSeparator1() = 0;
238
virtual QAction *actionQgisHomePage() = 0;
239
virtual QAction *actionCheckQgisVersion() = 0;
240
virtual QAction *actionHelpSeparator2() = 0;
241
virtual QAction *actionAbout() = 0;
244
/** Emited whenever current (selected) layer changes.
245
* The pointer to layer can be null if no layer is selected
247
void currentLayerChanged ( QgsMapLayer * layer );
249
/**This signal is emitted when a new composer instance has been created
250
@note added in version 1.4*/
251
void composerAdded( QgsComposerView* v );
253
/**This signal is emitted before a new composer instance is going to be removed
254
@note added in version 1.4*/
255
void composerWillBeRemoved( QgsComposerView* v );