mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-05 01:35:45 +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/simulatedaircraft.h"
|
||||||
#include "blackmisc/simulation/simulatorplugininfo.h"
|
#include "blackmisc/simulation/simulatorplugininfo.h"
|
||||||
#include "blackmisc/simulation/interpolationrenderingsetup.h"
|
#include "blackmisc/simulation/interpolationrenderingsetup.h"
|
||||||
|
#include "blackmisc/simulation/interpolatormulti.h"
|
||||||
#include "blackmisc/pq/length.h"
|
#include "blackmisc/pq/length.h"
|
||||||
#include "blackmisc/pq/time.h"
|
#include "blackmisc/pq/time.h"
|
||||||
#include "blackmisc/statusmessage.h"
|
#include "blackmisc/statusmessage.h"
|
||||||
@@ -150,6 +151,9 @@ namespace BlackCore
|
|||||||
//! Driver will be unloaded
|
//! Driver will be unloaded
|
||||||
virtual void unload() = 0;
|
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
|
//! \addtogroup swiftdotcommands
|
||||||
//! @{
|
//! @{
|
||||||
//! <pre>
|
//! <pre>
|
||||||
|
|||||||
@@ -352,23 +352,24 @@ namespace BlackCore
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// .plugin loginterpolator etc.
|
// .plugin log interpolator
|
||||||
if (parser.part(1).startsWith("logint") && parser.hasPart(2))
|
const QString part1(parser.part(1).toLower().trimmed());
|
||||||
|
if (part1.startsWith("logint") && parser.hasPart(2))
|
||||||
{
|
{
|
||||||
const QString p = parser.part(2).toLower();
|
const QString part2 = parser.part(2).toLower();
|
||||||
if (p == "off" || p == "false")
|
if (part2 == "off" || part2 == "false")
|
||||||
{
|
{
|
||||||
this->m_interpolationRenderingSetup.clearInterpolatorLogCallsigns();
|
this->m_interpolationRenderingSetup.clearInterpolatorLogCallsigns();
|
||||||
CStatusMessage(this).info("Disabled interpolation logging");
|
CStatusMessage(this).info("Disabled interpolation logging");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (p == "clear" || p == "clr")
|
if (part2 == "clear" || part2 == "clr")
|
||||||
{
|
{
|
||||||
this->m_interpolationLogger.clearLog();
|
this->m_interpolationLogger.clearLog();
|
||||||
CStatusMessage(this).info("Cleared interpolation logging");
|
CStatusMessage(this).info("Cleared interpolation logging");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (p == "write" || p == "save")
|
if (part2 == "write" || part2 == "save")
|
||||||
{
|
{
|
||||||
// stop logging
|
// stop logging
|
||||||
this->m_interpolationRenderingSetup.clearInterpolatorLogCallsigns();
|
this->m_interpolationRenderingSetup.clearInterpolatorLogCallsigns();
|
||||||
@@ -379,7 +380,7 @@ namespace BlackCore
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString cs = p.toUpper();
|
const QString cs = part2.toUpper();
|
||||||
if (!CCallsign::isValidAircraftCallsign(cs)) { return false; }
|
if (!CCallsign::isValidAircraftCallsign(cs)) { return false; }
|
||||||
if (this->getAircraftInRangeCallsigns().contains(cs))
|
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
|
// driver specific cmd line arguments
|
||||||
return this->parseDetails(parser);
|
return this->parseDetails(parser);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ namespace BlackCore
|
|||||||
//! .drv logint off no log information for interpolator BlackCore::CSimulatorCommon
|
//! .drv logint off no log information for interpolator BlackCore::CSimulatorCommon
|
||||||
//! .drv logint write write interpolator log to file BlackCore::CSimulatorCommon
|
//! .drv logint write write interpolator log to file BlackCore::CSimulatorCommon
|
||||||
//! .drv logint clear clear current log BlackCore::CSimulatorCommon
|
//! .drv logint clear clear current log BlackCore::CSimulatorCommon
|
||||||
|
//! .drv spline|linear callsign interpolator spline BlackCore::CSimulatorCommon
|
||||||
//! </pre>
|
//! </pre>
|
||||||
//! @}
|
//! @}
|
||||||
//! \copydoc ISimulator::parseCommandLine
|
//! \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 off", "no log information for interpolator"});
|
||||||
BlackMisc::CSimpleCommandParser::registerCommand({".drv logint write", "write interpolator log to file"});
|
BlackMisc::CSimpleCommandParser::registerCommand({".drv logint write", "write interpolator log to file"});
|
||||||
BlackMisc::CSimpleCommandParser::registerCommand({".drv logint clear", "clear current log"});
|
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 ------------
|
// --------- ISimulator implementations ------------
|
||||||
|
|||||||
Reference in New Issue
Block a user