~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/plugins/north_arrow/plugin.h

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 *   (at your option) any later version.                                   *
17
17
 *                                                                         *
18
18
 ***************************************************************************/
19
 
 /*  $Id: plugin.h 5450 2006-05-14 04:54:03Z g_j_m $ */
 
19
/*  $Id$ */
20
20
#ifndef QGSNORTHARROWPLUGIN
21
21
#define QGSNORTHARROWPLUGIN
22
22
 
23
23
#include "../qgisplugin.h"
24
 
#include "qgisapp.h"
25
24
 
 
25
#include <QObject>
 
26
#include <QStringList>
 
27
class QgisInterface;
 
28
class QAction;
26
29
class QToolBar;
 
30
class QPainter;
27
31
/**
28
32
* \class Plugin
29
33
* \brief North Arrow plugin for QGIS
30
34
*
31
35
*/
32
 
class QgsNorthArrowPlugin:public QObject, public QgisPlugin
 
36
class QgsNorthArrowPlugin: public QObject, public QgisPlugin
33
37
{
34
38
  Q_OBJECT public:
35
 
      /**
36
 
       * Constructor for a plugin. The QgisApp and QgisIface pointers are passed by
37
 
       * QGIS when it attempts to instantiate the plugin.
38
 
       * @param qgis Pointer to the QgisApp object
39
 
       * @param qI Pointer to the QgisIface object.
40
 
       */
41
 
    QgsNorthArrowPlugin(QgisApp * , QgisIface * );
42
 
  //! Destructor
43
 
  virtual ~QgsNorthArrowPlugin();
 
39
    /**
 
40
     * Constructor for a plugin. The QgisInterface pointer is passed by
 
41
     * QGIS when it attempts to instantiate the plugin.
 
42
     * @param qI Pointer to the QgisInterface object.
 
43
     */
 
44
    QgsNorthArrowPlugin( QgisInterface * );
 
45
    //! Destructor
 
46
    virtual ~QgsNorthArrowPlugin();
44
47
  public slots:
45
 
  //! init the gui
46
 
  virtual void initGui();
47
 
  //!set values on the gui when a project is read or the gui first loaded
48
 
  void projectRead();
49
 
  //! Show the dialog box
50
 
  void run();
51
 
  // draw some arbitary text to the screen
52
 
  void renderNorthArrow(QPainter *);
53
 
  //! Run when the user has set a new rotation
54
 
  void rotationChanged(int);
55
 
  //! Refresh the map display using the mapcanvas exported via the plugin interface
56
 
  void refreshCanvas();
57
 
  //! unload the plugin
58
 
  void unload();
59
 
  //! show the help document
60
 
  void help();
61
 
  //! set north arrow placement
62
 
  void setPlacement(int);
63
 
  //! enable or disable north arrow
64
 
  void setEnabled(bool);
65
 
  //! enable or disable the automatic setting of the arrow direction
66
 
  void setAutomatic(bool);
67
 
  //! try to calculate the direction for the north arrow. Sets the
68
 
  // private class rotation variable. If unable to calculate the
69
 
  // direction, the function returns false and leaves the rotation
70
 
  // variable as is.
71
 
  bool calculateNorthDirection();
72
 
 
73
 
    private:
74
 
 
75
 
  static const double PI;
76
 
  //  static const double DEG2RAD;
77
 
  static const double TOL;
78
 
 
79
 
  // The amount of rotation for the north arrow
80
 
  int mRotationInt;
81
 
  int pluginType;
82
 
  // enable or disable north arrow
83
 
  bool mEnable;
84
 
  //! enable or disable the automatic setting of the arrow direction
85
 
  bool mAutomatic;
86
 
  // The placement index and translated text
87
 
  int mPlacementIndex;
88
 
  QStringList mPlacementLabels;
89
 
  //! Pointer to our toolbar
90
 
  QToolBar *toolBarPointer;
91
 
  //! Pionter to QGIS main application object
92
 
  QgisApp *qgisMainWindowPointer;
93
 
  //! Pointer to the QGIS interface object
94
 
  QgisIface *qGisInterface;
95
 
  //! Pointer to the QAction object used in the menu and toolbar
96
 
  QAction *myQActionPointer;
 
48
    //! init the gui
 
49
    virtual void initGui();
 
50
    //!set values on the gui when a project is read or the gui first loaded
 
51
    void projectRead();
 
52
    //! Show the dialog box
 
53
    void run();
 
54
    // draw some arbitary text to the screen
 
55
    void renderNorthArrow( QPainter * );
 
56
    //! Run when the user has set a new rotation
 
57
    void rotationChanged( int );
 
58
    //! Refresh the map display using the mapcanvas exported via the plugin interface
 
59
    void refreshCanvas();
 
60
    //! unload the plugin
 
61
    void unload();
 
62
    //! show the help document
 
63
    void help();
 
64
    //! set north arrow placement
 
65
    void setPlacement( int );
 
66
    //! enable or disable north arrow
 
67
    void setEnabled( bool );
 
68
    //! enable or disable the automatic setting of the arrow direction
 
69
    void setAutomatic( bool );
 
70
    //! try to calculate the direction for the north arrow. Sets the
 
71
    // private class rotation variable. If unable to calculate the
 
72
    // direction, the function returns false and leaves the rotation
 
73
    // variable as is.
 
74
    bool calculateNorthDirection();
 
75
    //! update the plugins theme when the app tells us its theme is changed
 
76
    void setCurrentTheme( QString theThemeName );
 
77
 
 
78
  private:
 
79
 
 
80
    static const double PI;
 
81
    //  static const double DEG2RAD;
 
82
    static const double TOL;
 
83
 
 
84
    // The amount of rotation for the north arrow
 
85
    int mRotationInt;
 
86
    int pluginType;
 
87
    // enable or disable north arrow
 
88
    bool mEnable;
 
89
    //! enable or disable the automatic setting of the arrow direction
 
90
    bool mAutomatic;
 
91
    // The placement index and translated text
 
92
    int mPlacementIndex;
 
93
    QStringList mPlacementLabels;
 
94
    //! Pointer to the QGIS interface object
 
95
    QgisInterface *qGisInterface;
 
96
    //! Pointer to the QAction object used in the menu and toolbar
 
97
    QAction *myQActionPointer;
97
98
};
98
99
 
99
100
#endif