swift
Loading...
Searching...
No Matches
ongroundinfo.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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_ONGROUNDINFO_H
7#define SWIFT_MISC_AVIATION_ONGROUNDINFO_H
8
9#include "misc/pq/length.h"
11#include "misc/valueobject.h"
12
13SWIFT_DECLARE_VALUEOBJECT_MIXINS(swift::misc::Aviation, COnGroundInfo)
14
15namespace swift::misc::aviation
16{
18 class SWIFT_MISC_EXPORT COnGroundInfo : public CValueObject<COnGroundInfo>
19 {
20 public:
23 {
24 NotOnGround,
25 OnGround,
26 OnGroundSituationUnknown
27 };
28
31 {
33 // interpolated situation
35 OnGroundByElevationAndCG,
37 // received situation
40 // send information
42 };
43
46 {
47 IndexOnGroundFactor = CPropertyIndexRef::GlobalIndexCOnGroundInfo,
48 IndexOnGroundDetails,
49 };
50
51 COnGroundInfo() = default;
52
55 COnGroundInfo(IsOnGround onGround, OnGroundDetails details);
56
59
61 explicit COnGroundInfo(double interpolatedGndFactor);
62
66 double getGroundFactor() const { return m_onGroundFactor; }
67
70 {
71 // TODO Assert not by interpolation
72 m_onGroundDetails = static_cast<int>(details);
73 }
74
77 IsOnGround getOnGround() const;
78
81 OnGroundDetails getGroundDetails() const;
82
84 QString convertToQString(bool i18n = false) const;
85
87 QVariant propertyByIndex(CPropertyIndexRef index) const;
88
90 void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
91
93 static void registerMetadata();
94
96 static const QString &isOnGroundToString(IsOnGround onGround);
97
99 static const QString &onGroundDetailsToString(OnGroundDetails reliability);
100
102 static const physical_quantities::CLength &deltaNearGround();
103
104 private:
111 bool isOnGround() const;
112
113 int m_onGroundDetails = static_cast<int>(OnGroundDetails::NotSetGroundDetails);
114 double m_onGroundFactor = -1.0;
115
116 static constexpr double m_groundFactorThreshold =
117 0.95;
119
122 SWIFT_METAMEMBER(onGroundDetails),
123 SWIFT_METAMEMBER(onGroundFactor));
124 };
125
126} // namespace swift::misc::aviation
127
128Q_DECLARE_METATYPE(swift::misc::aviation::COnGroundInfo)
131
132#endif // SWIFT_MISC_AVIATION_ONGROUNDINFO_H
Non-owning reference to a CPropertyIndex with a subset of its features.
Information about the ground status.
OnGroundDetails
Reliability of on ground information.
@ InFromParts
set from aircraft parts
@ InFromNetwork
received from network
@ OutOnGroundOwnAircraft
sending on ground
@ OnGroundByInterpolation
strongest for remote aircraft
@ NotSetGroundDetails
not set or unknown if correct (e.g.
double getGroundFactor() const
Get the ground factor Use this for interpolation only!! For just checking if the info is OnGround or ...
void setOnGroundDetails(OnGroundDetails details)
When source of knowledge changes.
Physical unit length (length).
Definition length.h:18
#define SWIFT_METAMEMBER(MEMBER,...)
Macro to define an element within a metaclass.
Definition metaclass.h:72
#define SWIFT_METACLASS(CLASS,...)
Macro to define a nested metaclass that describes the attributes of its enclosing class.
Definition metaclass.h:52
#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