1
/***************************************************************************
3
Interface class for exposing functions in QgisApp for use by plugins
6
copyright : (C) 2004 by Gary E.Sherman
7
email : sherman at mrcc.com
8
***************************************************************************/
10
/***************************************************************************
12
* This program is free software; you can redistribute it and/or modify *
13
* it under the terms of the GNU General Public License as published by *
14
* the Free Software Foundation; either version 2 of the License, or *
15
* (at your option) any later version. *
17
***************************************************************************/
18
/* $Id: qgisiface.h,v 1.21 2005/04/27 05:21:34 g_j_m Exp $ */
21
#include "qgisinterface.h"
22
#include "qgsmapcanvas.h"
26
* \brief Interface class to provide access to private methods in QgisApp
29
* Only those functions "exposed" by QgisIface can be called from within a
32
class QgisIface : public QgisInterface{
36
* @param qgis Pointer to the QgisApp object
38
QgisIface(QgisApp *qgis=0, const char *name=0);
40
/* Exposed functions */
41
//! Zoom map to full extent
43
//! Zoom map to previous extent
45
//! Zoom to active layer
46
void zoomActiveLayer();
47
//! Add a vector layer
48
bool addVectorLayer(QString vectorLayerPath, QString baseName, QString providerKey);
49
//! Add a raster layer given its file name
50
bool addRasterLayer(QString rasterLayerPath);
51
//! Add a raster layer given a raster layer obj
52
bool addRasterLayer(QgsRasterLayer * theRasterLayer,bool theForceRenderFlag=false);
54
bool addProject(QString theProjectName);
55
//! Start a new blank project
56
void newProject(bool thePromptToSaveFlag=false);
57
//! Get pointer to the active layer (layer selected in the legend)
58
QgsMapLayer *activeLayer();
59
//! Get source of the active layer
60
QString activeLayerSource();
61
//! Add a menu to the main menu bar of the application, positioned to the left of Help
62
int addMenu(QString menuText, QPopupMenu *menu);
64
QPopupMenu* getPluginMenu(QString menuName);
66
void removePluginMenuItem(QString name, int menuId);
68
//! Add an icon to the plugins toolbar
69
int addToolBarIcon(QAction *qAction);
70
//! Remove an icon (action) from the plugin toolbar
71
void removeToolBarIcon(QAction *qAction);
72
/** Open a url in the users browser. By default the QGIS doc directory is used
73
* as the base for the URL. To open a URL that is not relative to the installed
74
* QGIS documentation, set useQgisDocDirectory to false.
75
* @param url URL to open
76
* @param useQgisDocDirectory If true, the URL will be formed by concatenating
77
* url to the QGIS documentation directory path (<prefix>/share/doc)
79
void openURL(QString url, bool useQgisDocDirectory=true);
82
* Get the menu info mapped by menu name (key is name, value is menu id)
84
std::map<QString,int> menuMapByName();
86
* Get the menu info mapped by menu id (key is menu id, value is name)
88
std::map<int,QString> menuMapById();
89
/** Return a pointer to the map canvas used by qgisapp */
90
QgsMapCanvas * getMapCanvas();
91
/** Return a pointer to the map layer registry */
92
QgsMapLayerRegistry * getLayerRegistry();
95
/** Gives access to main QgisApp object
97
Even though this class is supposed to act as a Facade for the
98
QgisApp, the plug-ins need direct access to the application object
99
for their connect() calls.
101
@todo XXX this may call into question the current need for this
102
interface? Maybe these connect() calls can be done in some other
110
/// QgisIface aren't copied
111
QgisIface( QgisIface const & );
113
/// QgisIface aren't copied
114
QgisIface & operator=( QgisIface const & );
116
//! Pointer to the QgisApp object
121
#endif //#define QGISIFACE_H