| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
#pragma once |
| 9 |
|
| 10 |
#include <AIModel/AIManager.hxx> |
| 11 |
#include <AIModel/AISwiftAircraft.h> |
| 12 |
#include <Scenery/scenery.hxx> |
| 13 |
|
| 14 |
#include <unordered_map> |
| 15 |
#include <vector> |
| 16 |
|
| 17 |
namespace flightgear::swift { |
| 18 |
|
| 19 |
struct SwiftPlaneUpdate { |
| 20 |
std::string callsign; |
| 21 |
SGGeod position; |
| 22 |
SGVec3d orientation; |
| 23 |
double groundspeed; |
| 24 |
bool onGround; |
| 25 |
}; |
| 26 |
|
| 27 |
class FGSwiftAircraftManager |
| 28 |
{ |
| 29 |
using FGAISwiftAircraftPtr = SGSharedPtr<FGAISwiftAircraft>; |
| 30 |
|
| 31 |
public: |
| 32 |
FGSwiftAircraftManager(); |
| 33 |
~FGSwiftAircraftManager(); |
| 34 |
bool addPlane(const std::string& callsign, const std::string& modelString); |
| 35 |
void updatePlanes(const std::vector<SwiftPlaneUpdate>& updates); |
| 36 |
void getRemoteAircraftData(std::vector<std::string>& callsigns, std::vector<double>& latitudesDeg, std::vector<double>& longitudesDeg, |
| 37 |
std::vector<double>& elevationsM, std::vector<double>& verticalOffsets) const; |
| 38 |
void removePlane(const std::string& callsign); |
| 39 |
void removeAllPlanes(); |
| 40 |
void setPlanesTransponders(const std::vector<AircraftTransponder>& transponders); |
| 41 |
double getElevationAtPosition(const std::string& callsign, const SGGeod& pos) const; |
| 42 |
bool isInitialized() const; |
| 43 |
void setPlanesSurfaces(const std::vector<AircraftSurfaces>& surfaces); |
| 44 |
|
| 45 |
private: |
| 46 |
std::unordered_map<std::string, FGAISwiftAircraftPtr> aircraftByCallsign; |
| 47 |
bool m_initialized = false; |
| 48 |
}; |
| 49 |
|
| 50 |
} |