swift
aircraftvelocity.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2021 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_MISC_AVIATION_AIRCRAFTVELOCITY_H
7 #define SWIFT_MISC_AVIATION_AIRCRAFTVELOCITY_H
8 
9 #include "misc/metaclass.h"
10 #include "misc/pq/angle.h"
11 #include "misc/pq/speed.h"
12 #include "misc/pq/time.h"
13 #include "misc/propertyindexref.h"
14 #include "misc/swiftmiscexport.h"
15 #include "misc/valueobject.h"
16 
17 SWIFT_DECLARE_VALUEOBJECT_MIXINS(swift::misc::aviation, CAircraftVelocity)
18 
19 namespace swift::misc::aviation
20 {
22  class SWIFT_MISC_EXPORT CAircraftVelocity : public CValueObject<CAircraftVelocity>
23  {
24  public:
27  {
28  IndexVelocityX = CPropertyIndexRef::GlobalIndexCAircraftVelocity,
29  IndexVelocityY,
30  IndexVelocityZ,
31  IndexPitchVelocity,
32  IndexRollVelocity,
33  IndexHeadingVelocity
34  };
35 
38 
40  CAircraftVelocity(double x, double y, double z, physical_quantities::CSpeedUnit xyzUnit, double pitch,
41  double roll, double heading, physical_quantities::CAngleUnit pbhAngleUnit,
42  physical_quantities::CTimeUnit pbhTimeUnit);
43 
46  void setLinearVelocity(double x, double y, double z, physical_quantities::CSpeedUnit xyzUnit);
47  void setAngularVelocity(double pitch, double roll, double heading, physical_quantities::CAngleUnit pbhAngleUnit,
48  physical_quantities::CTimeUnit pbhTimeUnit);
50 
53  double getVelocityX(physical_quantities::CSpeedUnit unit) const;
54  double getVelocityY(physical_quantities::CSpeedUnit unit) const;
55  double getVelocityZ(physical_quantities::CSpeedUnit unit) const;
56  double getPitchVelocity(physical_quantities::CAngleUnit angleUnit,
57  physical_quantities::CTimeUnit timeUnit) const;
58  double getRollVelocity(physical_quantities::CAngleUnit angleUnit,
59  physical_quantities::CTimeUnit timeUnit) const;
60  double getHeadingVelocity(physical_quantities::CAngleUnit angleUnit,
61  physical_quantities::CTimeUnit timeUnit) const;
63 
65  QString convertToQString(bool i18n = false) const;
66 
68  QVariant propertyByIndex(CPropertyIndexRef index) const;
69 
71  void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
72 
74  int comparePropertyByIndex(CPropertyIndexRef index, const CAircraftVelocity &compareValue) const;
75 
81  c_pbhAngleUnit; // TODO Create a dedicated PQ class for angular velocity
84 
85  private:
86  double m_x = 0;
87  double m_y = 0;
88  double m_z = 0;
89  double m_pitch = 0;
90  double m_roll = 0;
91  double m_heading = 0;
92 
98  SWIFT_METAMEMBER(pitch),
99  SWIFT_METAMEMBER(roll),
100  SWIFT_METAMEMBER(heading));
101  };
102 } // namespace swift::misc::aviation
103 
105 
106 #endif // SWIFT_MISC_AVIATION_AIRCRAFTVELOCITY_H
Non-owning reference to a CPropertyIndex with a subset of its features.
Mix of the most commonly used mixin classes.
Definition: valueobject.h:114
Velocity and angular velocity for 6DOF bodies.
static const physical_quantities::CLengthUnit c_xyzLengthUnit
Unit constants.
static const physical_quantities::CSpeedUnit c_xyzSpeedUnit
Unit constants.
static const physical_quantities::CAngleUnit c_pbhAngleUnit
Unit constants.
static const physical_quantities::CTimeUnit c_timeUnit
Unit constants.
Specialized class for angles (degrees, radian).
Definition: units.h:233
Specialized class for distance units (meter, foot, nautical miles).
Definition: units.h:95
Specialized class for speed units (m/s, ft/s, NM/h).
Definition: units.h:778
Specialized class for time units (ms, hour, min).
Definition: units.h:909
#define SWIFT_METAMEMBER(MEMBER,...)
Macro to define an element within a metaclass.
Definition: metaclass.h:73
#define SWIFT_METACLASS(CLASS,...)
Macro to define a nested metaclass that describes the attributes of its enclosing class.
Definition: metaclass.h:53
#define SWIFT_MISC_EXPORT
Export a class or function from the library.
#define SWIFT_DECLARE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template declaration of mixins for a CValueObject subclass to be placed near the top of the ...
Definition: valueobject.h:65