swift
navdatareference.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2015 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_SIMULATION_XPLANE_NAVDATAREFERENCE_H
7 #define SWIFT_MISC_SIMULATION_XPLANE_NAVDATAREFERENCE_H
8 
9 #include <array>
10 #include <tuple>
11 
12 #include <QMetaType>
13 #include <QString>
14 #include <QVector3D>
15 
16 #include "misc/collection.h"
18 #include "misc/geo/geoobjectlist.h"
19 #include "misc/geo/latitude.h"
20 #include "misc/geo/longitude.h"
21 #include "misc/metaclass.h"
22 #include "misc/pq/length.h"
23 #include "misc/propertyindexref.h"
24 #include "misc/sequence.h"
25 #include "misc/swiftmiscexport.h"
26 #include "misc/valueobject.h"
27 
28 SWIFT_DECLARE_VALUEOBJECT_MIXINS(swift::misc::simulation::XPlane, CNavDataReference)
29 SWIFT_DECLARE_SEQUENCE_MIXINS(swift::misc::simulation::XPlane, CNavDataReference, CNavDataReferenceList)
30 
31 namespace swift::misc::simulation::xplane
32 {
37  {
38  public:
41 
43  CNavDataReference(int id, const geo::CLatitude &latitude, const geo::CLongitude &longitude);
44 
46  CNavDataReference(int id, float latitudeDegrees, float longitudeDegrees);
47 
49  int id() const { return m_id; }
50 
51  virtual geo::CLatitude latitude() const override { return m_position.latitude(); }
52  virtual geo::CLongitude longitude() const override { return m_position.longitude(); }
53  virtual const aviation::CAltitude &geodeticHeight() const override { return m_position.geodeticHeight(); }
54  virtual QVector3D normalVector() const override { return m_position.normalVector(); }
55  virtual std::array<double, 3> normalVectorDouble() const override
56  {
57  return this->m_position.normalVectorDouble();
58  }
59 
61  QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const;
62 
64  void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant);
65 
67  QString convertToQString(bool i18n = false) const;
68 
69  private:
70  int m_id = 0;
71  geo::CCoordinateGeodetic m_position;
72 
75  SWIFT_METAMEMBER(id),
76  SWIFT_METAMEMBER(position));
77  };
78 
83  public CSequence<CNavDataReference>,
84  public geo::IGeoObjectList<CNavDataReference, CNavDataReferenceList>,
85  public mixin::MetaType<CNavDataReferenceList>
86  {
87  public:
90 
93 
96  };
97 } // namespace swift::misc::simulation::xplane
98 
102 
103 #endif // SWIFT_MISC_SIMULATION_XPLANE_NAVDATAREFERENCE_H
Generic ordered container with value semantics.
Definition: collection.h:107
Non-owning reference to a CPropertyIndex with a subset of its features.
Generic sequential container with value semantics.
Definition: sequence.h:86
CSequence()=default
Default constructor.
Mix of the most commonly used mixin classes.
Definition: valueobject.h:114
Altitude as used in aviation, can be AGL or MSL altitude.
Definition: altitude.h:52
Geodetic coordinate, a position in 3D space relative to the reference geoid.
List of objects with geo coordinates.
Definition: geoobjectlist.h:24
CRTP class template from which a derived class can inherit common methods dealing with the metatype o...
Definition: mixinmetatype.h:29
Reference to an entry in X-Plane's navigation data (airport, navaid, fix, etc.) with its position.
virtual std::array< double, 3 > normalVectorDouble() const
Normal vector with double precision.
int id() const
Return the navdata reference ID.
virtual geo::CLatitude latitude() const
Latitude.
virtual QVector3D normalVector() const
Normal vector.
virtual const aviation::CAltitude & geodeticHeight() const
Height, ellipsoidal or geodetic height (used in GPS)
virtual geo::CLongitude longitude() const
Longitude.
List of X-Plane navigation data entries (airports, navaids, fixes, etc) with their positions.
#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_DECLARE_USING_MIXIN_METATYPE(DERIVED)
When a derived class and a base class both inherit from mixin::MetaType, the derived class uses this ...
#define SWIFT_DECLARE_SEQUENCE_MIXINS(Namespace, T, List)
Explicit template declaration of mixins for a CSequence subclass to be placed near the top of the hea...
Definition: sequence.h:62
#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