QFlightInstruments
QFlightInstruments is a Qt library containing flight instruments widgets.
qfi_AI.h
1 /****************************************************************************//*
2  * Copyright (C) 2021 Marek M. Cel
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining
5  * a copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom
9  * the Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20  * IN THE SOFTWARE.
21  ******************************************************************************/
22 #ifndef QFI_AI_H
23 #define QFI_AI_H
24 
26 
27 #include <QGraphicsView>
28 #include <QGraphicsSvgItem>
29 
31 
35 class qfi_AI : public QGraphicsView
36 {
37  Q_OBJECT
38 
39 public:
40 
42  qfi_AI( QWidget *parent = Q_NULLPTR );
43 
45  virtual ~qfi_AI();
46 
48  void reinit();
49 
51  void redraw();
52 
54  void setRoll( double roll );
55 
57  void setPitch( double pitch );
58 
59 protected:
60 
62  void resizeEvent( QResizeEvent *event );
63 
64 private:
65 
66  QGraphicsScene *_scene;
67 
68  QGraphicsSvgItem *_itemBack;
69  QGraphicsSvgItem *_itemFace;
70  QGraphicsSvgItem *_itemRing;
71  QGraphicsSvgItem *_itemCase;
72 
73  double _roll;
74  double _pitch;
75 
76  double _faceDeltaX_new;
77  double _faceDeltaX_old;
78  double _faceDeltaY_new;
79  double _faceDeltaY_old;
80 
81  double _scaleX;
82  double _scaleY;
83 
84  const int _originalHeight;
85  const int _originalWidth;
86 
87  const double _originalPixPerDeg;
88 
89  QPointF _originalAdiCtr;
90 
91  const int _backZ;
92  const int _faceZ;
93  const int _ringZ;
94  const int _caseZ;
95 
96  void init();
97 
98  void reset();
99 
100  void updateView();
101 };
102 
104 
105 #endif // QFI_AI_H
qfi_AI
Attitude Indicator widget class.
Definition: qfi_AI.h:35
qfi_AI::setPitch
void setPitch(double pitch)
Definition: qfi_AI.cpp:127
qfi_AI::redraw
void redraw()
Definition: qfi_AI.cpp:104
qfi_AI::reinit
void reinit()
Definition: qfi_AI.cpp:92
qfi_AI::~qfi_AI
virtual ~qfi_AI()
Definition: qfi_AI.cpp:78
qfi_AI::setRoll
void setRoll(double roll)
Definition: qfi_AI.cpp:117
qfi_AI::qfi_AI
qfi_AI(QWidget *parent=Q_NULLPTR)
Definition: qfi_AI.cpp:33