mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-25 10:15:43 +08:00
refs #896 Enable toggle of interpolator mode in X-Plane.
This commit is contained in:
@@ -223,6 +223,7 @@ namespace XBus
|
||||
if (id)
|
||||
{
|
||||
auto plane = new Plane(id, callsign, aircraftIcao, airlineIcao, livery);
|
||||
plane->interpolator.setMode(m_interpolatorMode);
|
||||
m_planesByCallsign[callsign] = plane;
|
||||
m_planesById[id] = plane;
|
||||
}
|
||||
@@ -390,6 +391,19 @@ namespace XBus
|
||||
}
|
||||
}
|
||||
|
||||
void CTraffic::toggleInterpolatorMode()
|
||||
{
|
||||
switch (m_interpolatorMode)
|
||||
{
|
||||
case BlackMisc::Simulation::CInterpolatorMulti::ModeLinear: m_interpolatorMode = BlackMisc::Simulation::CInterpolatorMulti::ModeSpline; break;
|
||||
case BlackMisc::Simulation::CInterpolatorMulti::ModeSpline: m_interpolatorMode = BlackMisc::Simulation::CInterpolatorMulti::ModeLinear; break;
|
||||
}
|
||||
for (auto plane : m_planesByCallsign)
|
||||
{
|
||||
plane->interpolator.setMode(m_interpolatorMode);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//! \endcond
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "datarefs.h"
|
||||
#include "terrainprobe.h"
|
||||
#include "command.h"
|
||||
#include "blackmisc/aviation/aircraftsituationlist.h"
|
||||
#include "blackmisc/aviation/aircraftpartslist.h"
|
||||
#include "blackmisc/simulation/interpolatormulti.h"
|
||||
@@ -140,6 +141,9 @@ namespace XBus
|
||||
};
|
||||
QHash<QString, Plane *> m_planesByCallsign;
|
||||
QHash<void *, Plane *> m_planesById;
|
||||
BlackMisc::Simulation::CInterpolatorMulti::Mode m_interpolatorMode = BlackMisc::Simulation::CInterpolatorMulti::ModeSpline;
|
||||
CCommand m_interpolatorModeCommand { "org/swift-project/xbus/toggle_lerp_mode", "Toggle interpolation mode", [this] { toggleInterpolatorMode(); } };
|
||||
void toggleInterpolatorMode();
|
||||
|
||||
int getPlaneData(void *id, int dataType, void *io_data);
|
||||
static int getPlaneData(void *id, int dataType, void *io_data, void *self)
|
||||
|
||||
Reference in New Issue
Block a user