-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathattitude_indicator.h
More file actions
52 lines (42 loc) · 1.49 KB
/
attitude_indicator.h
File metadata and controls
52 lines (42 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
* @file
* @brief Class Attitude_indicator. The widget to display attitude of UAV in real time.
*
*/
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
#include <QPainter>
#include <QLabel>
#include <QTimer>
class Attitude_Indicator : public QWidget
{
Q_OBJECT
public:
Attitude_Indicator(QWidget *parent = 0);
void paintEvent(QPaintEvent *event);
void paint();
void paintPitchLines(float pitch, QPainter* painter);
void paintPitchLinePos(const float widget, QString text, float refPosX, float refPosY, QPainter* painter);
void rotatePolygonClockWiseRad(QPolygonF& p, float angle, QPointF origin);
void paintText(QString text, QColor color, float fontSize, float refX, float refY, QPainter* painter);
void drawLine(float refX1, float refY1, float refX2, float refY2, float width, const QColor& color, QPainter* painter);
~Attitude_Indicator();
//degree
float rollLP;
float pitchLP;
float yaw;
float scalingFactor;
float pitchScaleFactor;
private:
static const int updateInterval = 100;
float vwidth; ///640
float vheight; ///480
float vPitchPerDeg; ///< Virtual pitch to mm conversion. Currently one degree is 3 mm up/down in the pitch markings
// HUD colors
QColor defaultColor; ///< Color for most HUD elements, e.g. pitch lines, center cross, change rate gauges
QColor skyColor;
QColor earthColor;
QTimer* refreshTimer; ///< The main timer, controls the update rate
}
#endif // WIDGET_H