Stellarium 0.12.3
AngleMeasure.hpp
1 /*
2  * Copyright (C) 2009 Matthew Gates
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
17  */
18 
19 #ifndef ANGLEMEASURE_HPP_
20 #define ANGLEMEASURE_HPP_
21 
22 #include <QFont>
23 #include "VecMath.hpp"
24 #include "StelModule.hpp"
25 #include "StelFader.hpp"
26 
27 class QTimer;
28 class QPixmap;
29 class StelButton;
30 
32 class AngleMeasure : public StelModule
33 {
34  Q_OBJECT
35 public:
36  AngleMeasure();
37  virtual ~AngleMeasure();
38 
40  // Methods defined in the StelModule class
41  virtual void init();
42  virtual void update(double deltaTime);
43  virtual void draw(StelCore* core, class StelRenderer* renderer);
44  virtual double getCallOrder(StelModuleActionName actionName) const;
45  virtual void handleKeys(class QKeyEvent* event);
46  virtual void handleMouseClicks(class QMouseEvent* event);
47  virtual bool handleMouseMoves(int x, int y, Qt::MouseButtons b);
48 
49 public slots:
50  void enableAngleMeasure(bool b);
51 
52 private slots:
53  void updateMessageText();
54  void clearMessage();
55 
56 private:
57  QFont font;
58  bool flagShowAngleMeasure;
59  LinearFader lineVisible;
60  LinearFader messageFader;
61  QTimer* messageTimer;
62  QString messageEnabled;
63  QString messageLeftButton;
64  QString messageRightButton;
65  bool dragging;
66  Vec3d startPoint;
67  Vec3d endPoint;
68  Vec3d perp1StartPoint;
69  Vec3d perp1EndPoint;
70  Vec3d perp2StartPoint;
71  Vec3d perp2EndPoint;
72  Vec3f textColor;
73  Vec3f lineColor;
74  QString angleText;
75  bool flagUseDmsFormat;
76  StelButton* toolbarButton;
77 
78  void calculateEnds();
79 };
80 
81 
82 #include "fixx11h.h"
83 #include <QObject>
84 #include "StelPluginInterface.hpp"
85 
88 {
89  Q_OBJECT
90  Q_INTERFACES(StelPluginInterface)
91 public:
92  virtual StelModule* getStelModule() const;
93  virtual StelPluginInfo getPluginInfo() const;
94 };
95 
96 #endif /*ANGLEMEASURE_HPP_*/
97