~ubuntu-branches/ubuntu/hardy/qgis/hardy

« back to all changes in this revision

Viewing changes to src/qgisiface.h

  • Committer: Bazaar Package Importer
  • Author(s): William Grant
  • Date: 2007-05-06 13:42:32 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070506134232-pyli6t388w5asd8x
Tags: 0.8.0-3ubuntu1
* Merge from Debian unstable. Remaining Ubuntu changes:
  - debian/rules, debian/qgis.install, debian/qgis.dirs debian/qgis.desktop:
    Add and install .desktop.
* debian/qgis.desktop: Remove Applications category; it's not real.
* Modify Maintainer value to match Debian-Maintainer-Field Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
                          qgisiface.h 
3
 
 Interface class for exposing functions in QgisApp for use by plugins
4
 
                             -------------------
5
 
  begin                : 2004-02-11
6
 
  copyright            : (C) 2004 by Gary E.Sherman
7
 
  email                : sherman at mrcc.com
8
 
 ***************************************************************************/
9
 
 
10
 
/***************************************************************************
11
 
 *                                                                         *
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.                                   *
16
 
 *                                                                         *
17
 
 ***************************************************************************/
18
 
/* $Id: qgisiface.h,v 1.21 2005/04/27 05:21:34 g_j_m Exp $ */
19
 
#ifndef QGISIFACE_H
20
 
#define QGISIFACE_H
21
 
#include "qgisinterface.h"
22
 
#include "qgsmapcanvas.h"
23
 
 
24
 
class QgsMapLayer;
25
 
/** \class QgisIface
26
 
 * \brief Interface class to provide access to private methods in QgisApp
27
 
 * for use by plugins.
28
 
 * 
29
 
 * Only those functions "exposed" by QgisIface can be called from within a
30
 
 * plugin.
31
 
 */
32
 
class QgisIface : public QgisInterface{
33
 
    public:
34
 
        /**
35
 
         * Constructor.
36
 
         * @param qgis Pointer to the QgisApp object
37
 
         */
38
 
        QgisIface(QgisApp *qgis=0, const char *name=0);
39
 
        ~QgisIface();
40
 
        /* Exposed functions */
41
 
        //! Zoom map to full extent
42
 
        void zoomFull();
43
 
        //! Zoom map to previous extent
44
 
        void zoomPrevious();
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);
53
 
        //! Add a project
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);
63
 
 
64
 
        QPopupMenu* getPluginMenu(QString menuName);
65
 
 
66
 
        void removePluginMenuItem(QString name, int menuId);
67
 
 
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)
78
 
         */
79
 
        void openURL(QString url, bool useQgisDocDirectory=true);
80
 
 
81
 
        /** 
82
 
         * Get the menu info mapped by menu name (key is name, value is menu id)
83
 
         */
84
 
        std::map<QString,int> menuMapByName();
85
 
        /** 
86
 
         * Get the menu info mapped by menu id (key is menu id, value is name)
87
 
         */
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();       
93
 
 
94
 
 
95
 
        /** Gives access to main QgisApp object
96
 
 
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.
100
 
 
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
103
 
          less intrusive way?
104
 
 
105
 
        */
106
 
        QgisApp * app();
107
 
 
108
 
    private:
109
 
 
110
 
        /// QgisIface aren't copied
111
 
        QgisIface( QgisIface const & );
112
 
        
113
 
        /// QgisIface aren't copied
114
 
        QgisIface & operator=( QgisIface const & );
115
 
 
116
 
        //! Pointer to the QgisApp object
117
 
        QgisApp *qgis;
118
 
};
119
 
 
120
 
 
121
 
#endif //#define QGISIFACE_H