Debian Codegraph @

src/AIModel/AISwiftAircraft.h

raw symbols SCIP
1 /*
2 * SPDX-FileName: AISwiftAircraft.h
3 * SPDX-FileComment: Derived AIBase class for swift aircraft
4 * SPDX-FileCopyrightText: Written by Lars Toenning <[email protected]> started on April 2020
5 * SPDX-FileContributor: Copyright (C) 2020 - swift Project Community / Contributors (http://swift-project.org/)
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9 #pragma once
10
11 #include <string>
12 #include <string_view>
13 #include <utility>
14
15 #include "AIBaseAircraft.hxx"
16
17
18 struct AircraftTransponder {
19 AircraftTransponder(std::string callsign, int code, bool modeC, bool ident)
20 : callsign(std::move(callsign)), code(code), modeC(modeC), ident(ident)
21 {
22 }
23
24 std::string callsign;
25 int code;
26 bool modeC;
27 bool ident;
28 };
29
30 struct AircraftSurfaces {
31 AircraftSurfaces(std::string callsign, double gear, double flaps, double spoilers, double speedBrake, double slats, double wingSweeps,
32 double thrust, double elevator, double rudder, double aileron, bool landingLight, bool taxiLight, bool beaconLight,
33 bool strobeLight, bool navLight, int lightPattern)
34 : callsign(std::move(callsign)), gear(gear), flaps(flaps), spoilers(spoilers), speedBrake(speedBrake), slats(slats), wingSweeps(wingSweeps),
35 thrust(thrust), elevator(elevator), rudder(rudder), aileron(aileron), landingLight(landingLight), taxiLight(taxiLight), beaconLight(beaconLight),
36 strobeLight(strobeLight), navLight(navLight), lightPattern(lightPattern) {}
37
38 std::string callsign;
39 double gear;
40 double flaps;
41 double spoilers;
42 double speedBrake;
43 double slats;
44 double wingSweeps;
45 double thrust;
46 double elevator;
47 double rudder;
48 double aileron;
49 bool landingLight;
50 bool taxiLight;
51 bool beaconLight;
52 bool strobeLight;
53 bool navLight;
54 int lightPattern;
55 };
56
57 class FGAISwiftAircraft : public FGAIBaseAircraft
58 {
59 public:
60 FGAISwiftAircraft(const std::string& callsign, const std::string& modelString);
61 virtual ~FGAISwiftAircraft() = default;
62
63 std::string_view getTypeString() const override { return "swift"; }
64 void update(double dt) override;
65
66 void updatePosition(const SGGeod& position, const SGVec3d& orientation, double groundspeed, bool initPos);
67 double getGroundElevation(const SGGeod& pos) const;
68 void initProps();
69 void setPlaneSurface(const AircraftSurfaces& surfaces);
70 void setPlaneTransponder(const AircraftTransponder& transponder);
71
72 private:
73 bool m_initPos = false;
74 // Property Nodes for transponder and parts
75 SGPropertyNode_ptr m_transponderCodeNode;
76 SGPropertyNode_ptr m_transponderCModeNode;
77 SGPropertyNode_ptr m_transponderIdentNode;
78 };