mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
refs #916, dot command for interpolator mode
This commit is contained in:
committed by
Mathew Sutcliffe
parent
3a6df31c99
commit
277837bb30
@@ -19,6 +19,7 @@
|
||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||
#include "blackmisc/simulation/simulatorplugininfo.h"
|
||||
#include "blackmisc/simulation/interpolationrenderingsetup.h"
|
||||
#include "blackmisc/simulation/interpolatormulti.h"
|
||||
#include "blackmisc/pq/length.h"
|
||||
#include "blackmisc/pq/time.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
@@ -150,6 +151,9 @@ namespace BlackCore
|
||||
//! Driver will be unloaded
|
||||
virtual void unload() = 0;
|
||||
|
||||
//! Set interpolation mode, empty callsign applies to all know callsigns
|
||||
virtual bool setInterpolatorMode(BlackMisc::Simulation::CInterpolatorMulti::Mode mode, const BlackMisc::Aviation::CCallsign &callsign) = 0;
|
||||
|
||||
//! \addtogroup swiftdotcommands
|
||||
//! @{
|
||||
//! <pre>
|
||||
|
||||
@@ -352,23 +352,24 @@ namespace BlackCore
|
||||
return true;
|
||||
}
|
||||
|
||||
// .plugin loginterpolator etc.
|
||||
if (parser.part(1).startsWith("logint") && parser.hasPart(2))
|
||||
// .plugin log interpolator
|
||||
const QString part1(parser.part(1).toLower().trimmed());
|
||||
if (part1.startsWith("logint") && parser.hasPart(2))
|
||||
{
|
||||
const QString p = parser.part(2).toLower();
|
||||
if (p == "off" || p == "false")
|
||||
const QString part2 = parser.part(2).toLower();
|
||||
if (part2 == "off" || part2 == "false")
|
||||
{
|
||||
this->m_interpolationRenderingSetup.clearInterpolatorLogCallsigns();
|
||||
CStatusMessage(this).info("Disabled interpolation logging");
|
||||
return true;
|
||||
}
|
||||
if (p == "clear" || p == "clr")
|
||||
if (part2 == "clear" || part2 == "clr")
|
||||
{
|
||||
this->m_interpolationLogger.clearLog();
|
||||
CStatusMessage(this).info("Cleared interpolation logging");
|
||||
return true;
|
||||
}
|
||||
if (p == "write" || p == "save")
|
||||
if (part2 == "write" || part2 == "save")
|
||||
{
|
||||
// stop logging
|
||||
this->m_interpolationRenderingSetup.clearInterpolatorLogCallsigns();
|
||||
@@ -379,7 +380,7 @@ namespace BlackCore
|
||||
return true;
|
||||
}
|
||||
|
||||
const QString cs = p.toUpper();
|
||||
const QString cs = part2.toUpper();
|
||||
if (!CCallsign::isValidAircraftCallsign(cs)) { return false; }
|
||||
if (this->getAircraftInRangeCallsigns().contains(cs))
|
||||
{
|
||||
@@ -394,6 +395,21 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
if (part1.startsWith("spline") || part1.startsWith("linear"))
|
||||
{
|
||||
CCallsign cs(parser.hasPart(2) ? parser.part(2) : "");
|
||||
const bool changed = this->setInterpolatorMode(CInterpolatorMulti::modeFromString(part1), cs);
|
||||
if (changed)
|
||||
{
|
||||
CLogMessage(this).info("Changed interpolation mode");
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(this).info("Unchanged interpolation mode");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// driver specific cmd line arguments
|
||||
return this->parseDetails(parser);
|
||||
}
|
||||
|
||||
@@ -88,11 +88,12 @@ namespace BlackCore
|
||||
//! \addtogroup swiftdotcommands
|
||||
//! @{
|
||||
//! <pre>
|
||||
//! .drv unload unload plugin BlackCore::CSimulatorCommon
|
||||
//! .drv logint callsign log interpolator for callsign BlackCore::CSimulatorCommon
|
||||
//! .drv logint off no log information for interpolator BlackCore::CSimulatorCommon
|
||||
//! .drv logint write write interpolator log to file BlackCore::CSimulatorCommon
|
||||
//! .drv logint clear clear current log BlackCore::CSimulatorCommon
|
||||
//! .drv unload unload plugin BlackCore::CSimulatorCommon
|
||||
//! .drv logint callsign log interpolator for callsign BlackCore::CSimulatorCommon
|
||||
//! .drv logint off no log information for interpolator BlackCore::CSimulatorCommon
|
||||
//! .drv logint write write interpolator log to file BlackCore::CSimulatorCommon
|
||||
//! .drv logint clear clear current log BlackCore::CSimulatorCommon
|
||||
//! .drv spline|linear callsign interpolator spline BlackCore::CSimulatorCommon
|
||||
//! </pre>
|
||||
//! @}
|
||||
//! \copydoc ISimulator::parseCommandLine
|
||||
@@ -107,6 +108,7 @@ namespace BlackCore
|
||||
BlackMisc::CSimpleCommandParser::registerCommand({".drv logint off", "no log information for interpolator"});
|
||||
BlackMisc::CSimpleCommandParser::registerCommand({".drv logint write", "write interpolator log to file"});
|
||||
BlackMisc::CSimpleCommandParser::registerCommand({".drv logint clear", "clear current log"});
|
||||
BlackMisc::CSimpleCommandParser::registerCommand({".drv spline|linear <callsign>", "set spline/linear interpolator for one/all callsign(s)"});
|
||||
}
|
||||
|
||||
// --------- ISimulator implementations ------------
|
||||
|
||||
Reference in New Issue
Block a user