swift
flightgearmpaircraft.cpp
1 // SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
4 #include "flightgearmpaircraft.h"
5 
6 #include "core/simulator.h"
8 
9 using namespace swift::core;
10 using namespace swift::misc;
11 using namespace swift::misc::aviation;
12 using namespace swift::misc::simulation;
13 
14 namespace swift::simplugin::flightgear
15 {
16  CFlightgearMPAircraft::CFlightgearMPAircraft() {}
17 
18  CFlightgearMPAircraft::CFlightgearMPAircraft(const CSimulatedAircraft &aircraft, ISimulator *simulator,
19  CInterpolationLogger *logger)
20  : m_aircraft(aircraft),
21  m_interpolator(QSharedPointer<CInterpolatorMulti>::create(aircraft.getCallsign(), simulator, simulator,
22  simulator->getRemoteAircraftProvider(), logger))
23  {
24  m_interpolator->attachLogger(logger);
25  m_interpolator->initCorrespondingModel(aircraft.getModel());
26  }
27 
29  {
30  m_aircraft = simulatedAircraft;
31  }
32 
34  {
35  Q_ASSERT(m_interpolator);
36  return m_interpolator->getInterpolatorInfo(mode);
37  }
38 
40  {
41  Q_ASSERT(m_interpolator);
42  m_interpolator->attachLogger(logger);
43  }
44 
46  CFlightgearMPAircraft::getInterpolation(qint64 currentTimeSinceEpoch,
48  uint32_t aircraftNumber) const
49  {
50  Q_ASSERT(m_interpolator);
51  return m_interpolator->getInterpolation(currentTimeSinceEpoch, setup, aircraftNumber);
52  }
53 
56  {
58  }
59 
61 
63  {
64  return this->getAllCallsigns().getCallsignStrings(sorted);
65  }
66 } // namespace swift::simplugin::flightgear
Interface to a simulator.
Definition: simulator.h:59
Status messages, e.g. from Core -> GUI.
Value object for a set of callsigns.
Definition: callsignset.h:26
QStringList getCallsignStrings(bool sorted=false) const
The callsign strings.
Definition: callsignset.cpp:37
Value object for interpolator and rendering per callsign.
Record internal state of interpolator for debugging.
Multiplexed interpolator which allows switching between modes at runtime.
const CStatusMessageList & getInterpolationMessages(CInterpolationAndRenderingSetupBase::InterpolatorMode mode) const
Interpolation messages.
Comprehensive information of an aircraft.
const simulation::CAircraftModel & getModel() const
Get model (model used for mapping)
swift::misc::simulation::CInterpolationResult getInterpolation(qint64 currentTimeSinceEpoch, const swift::misc::simulation::CInterpolationAndRenderingSetupPerCallsign &setup, uint32_t aircraftNumber) const
Get interpolated situation.
swift::misc::simulation::CInterpolatorMulti * getInterpolator() const
Interpolator.
swift::misc::CStatusMessageList getInterpolationMessages(swift::misc::simulation::CInterpolationAndRenderingSetupBase::InterpolatorMode mode) const
Interpolation messages.
void attachInterpolatorLogger(swift::misc::simulation::CInterpolationLogger *logger) const
Attach an observer to read the interpolator's state for debugging.
QString getInterpolatorInfo(swift::misc::simulation::CInterpolationAndRenderingSetupBase::InterpolatorMode mode) const
Get an interpolator info string (for debug info)
void setSimulatedAircraft(const swift::misc::simulation::CSimulatedAircraft &simulatedAircraft)
Set simulated aircraft.
QStringList getAllCallsignStrings(bool sorted=false) const
Get all callsign strings.
swift::misc::aviation::CCallsignSet getAllCallsigns() const
Get all callsigns.
Backend services of the swift project, like dealing with the network or the simulators.
Definition: actionbind.cpp:7
Free functions in swift::misc.