swift
pbhsform.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_GUI_EDITORS_PBHSFORM_H
7 #define SWIFT_GUI_EDITORS_PBHSFORM_H
8 
9 #include <QFrame>
10 #include <QScopedPointer>
11 
12 #include "gui/editors/form.h"
14 #include "misc/aviation/heading.h"
15 #include "misc/pq/angle.h"
16 #include "misc/pq/speed.h"
17 
18 namespace Ui
19 {
20  class CPbhsForm;
21 }
22 namespace swift::gui::editors
23 {
25  class CPbhsForm : public CForm
26  {
27  Q_OBJECT
28 
29  public:
31  explicit CPbhsForm(QWidget *parent = nullptr);
32 
34  virtual ~CPbhsForm() override;
35 
38 
41 
44 
47 
50 
53 
56 
59 
62 
65 
67  virtual void setReadOnly(bool readOnly) override;
68 
70  void showSetButton(bool visible);
71 
72  signals:
74  void changeValues();
75 
76  private:
77  static constexpr int RoundDigits = 6;
78 
80  double getBankAngleDegrees() const;
81 
83  double getPitchAngleDegrees() const;
84 
86  double getHeadingAngleDegrees() const;
87 
90  void bankSliderChanged(int value);
91  void pitchSliderChanged(int value);
92  void headingSliderChanged(int value);
93  void pressureSliderChanged(int value);
94  void bankEntered();
95  void resetBank();
96  void pitchEntered();
97  void resetPitch();
98  void headingEntered();
99  void resetHeading();
100  void presetOwnAircraftSituation();
102 
103  static int clampAngle(int in) { return qBound(-179, in, 180); }
104 
105  QScopedPointer<Ui::CPbhsForm> ui;
106  };
107 } // namespace swift::gui::editors
108 
109 #endif // SWIFT_GUI_EDITORS_PBHSFORM_H
Form base class.
Definition: form.h:27
Pitch, bank, heading and speed form.
Definition: pbhsform.h:26
virtual void setReadOnly(bool readOnly)
Set editable.
Definition: pbhsform.cpp:117
void setBankAngle(const swift::misc::physical_quantities::CAngle &angle)
Set bank angle.
Definition: pbhsform.cpp:42
swift::misc::physical_quantities::CSpeed getGroundSpeed() const
Get ground speed.
Definition: pbhsform.cpp:96
void setHeadingAngle(const swift::misc::physical_quantities::CAngle &angle)
Set heading angle.
Definition: pbhsform.cpp:80
swift::misc::physical_quantities::CAngle getBankAngle() const
Get bank angle.
Definition: pbhsform.cpp:40
void updateSituation(swift::misc::aviation::CAircraftSituation &situation)
Update PBHs in situation.
Definition: pbhsform.cpp:109
CPbhsForm(QWidget *parent=nullptr)
Ctor.
Definition: pbhsform.cpp:18
swift::misc::aviation::CHeading getHeading() const
Get heading.
Definition: pbhsform.cpp:78
swift::misc::physical_quantities::CAngle getHeadingAngle() const
Get heading angle.
Definition: pbhsform.cpp:76
void changeValues()
Changed values.
void setPitchAngle(const swift::misc::physical_quantities::CAngle &angle)
Set pitch angle.
Definition: pbhsform.cpp:60
swift::misc::physical_quantities::CAngle getPitchAngle() const
Get pitch angle.
Definition: pbhsform.cpp:58
void showSetButton(bool visible)
Show the "SET" button.
Definition: pbhsform.cpp:128
void setSituation(const swift::misc::aviation::CAircraftSituation &situation)
Set situation.
Definition: pbhsform.cpp:102
Value object encapsulating information of an aircraft's situation.
Heading as used in aviation, can be true or magnetic heading.
Definition: heading.h:41
Physical unit angle (radians, degrees)
Definition: angle.h:23