mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-08-10 03:16:09 +08:00
Add velocity extrapolator to GUI
This commit is contained in:
@@ -512,7 +512,7 @@ namespace BlackCore
|
||||
}
|
||||
} // logint
|
||||
|
||||
if (part1.startsWith("spline") || part1.startsWith("linear"))
|
||||
if (part1.startsWith("spline") || part1.startsWith("linear") || part1.startsWith("velocity"))
|
||||
{
|
||||
if (parser.hasPart(2))
|
||||
{
|
||||
|
||||
@@ -93,7 +93,8 @@ namespace BlackGui::Editors
|
||||
CInterpolationAndRenderingSetupBase::InterpolatorMode CInterpolationSetupForm::getInterpolatorMode() const
|
||||
{
|
||||
if (ui->rb_Linear->isChecked()) { return CInterpolationAndRenderingSetupBase::Linear; }
|
||||
return CInterpolationAndRenderingSetupBase::Spline;
|
||||
if (ui->rb_Spline->isChecked()) { return CInterpolationAndRenderingSetupBase::Spline; }
|
||||
return CInterpolationAndRenderingSetupBase::Velocity;
|
||||
}
|
||||
|
||||
void CInterpolationSetupForm::setInterpolatorMode(CInterpolationAndRenderingSetupBase::InterpolatorMode mode)
|
||||
@@ -101,9 +102,9 @@ namespace BlackGui::Editors
|
||||
switch (mode)
|
||||
{
|
||||
case CInterpolationAndRenderingSetupBase::Linear : ui->rb_Linear->setChecked(true); break;
|
||||
case CInterpolationAndRenderingSetupBase::Spline:
|
||||
case CInterpolationAndRenderingSetupBase::Spline: ui->rb_Spline->setChecked(true); break;
|
||||
default:
|
||||
ui->rb_Spline->setChecked(true);
|
||||
ui->rb_Velocity->setChecked(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,6 +150,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rb_Velocity">
|
||||
<property name="text">
|
||||
<string>velocity</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="hs_InterpolatorType">
|
||||
<property name="orientation">
|
||||
|
||||
@@ -578,9 +578,11 @@ namespace BlackMisc::Simulation
|
||||
{
|
||||
static const QString s("spline");
|
||||
static const QString l("linear");
|
||||
static const QString v("velocity");
|
||||
static const QString u("unknown");
|
||||
if (interpolator == 's') { return s; }
|
||||
if (interpolator == 'l') { return l; }
|
||||
if (interpolator == 'v') { return v; }
|
||||
return u;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ namespace BlackMisc::Simulation
|
||||
{
|
||||
if (mode.contains("spline", Qt::CaseInsensitive)) { return this->setInterpolatorMode(Spline); }
|
||||
if (mode.contains("linear", Qt::CaseInsensitive)) { return this->setInterpolatorMode(Linear); }
|
||||
if (mode.contains("velocity", Qt::CaseInsensitive)) { return this->setInterpolatorMode(Velocity); }
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -68,11 +69,13 @@ namespace BlackMisc::Simulation
|
||||
{
|
||||
static const QString l("linear");
|
||||
static const QString s("spline");
|
||||
static const QString v("velocity");
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case Linear: return l;
|
||||
case Spline: return s;
|
||||
case Velocity: return v;
|
||||
default: return s;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,8 @@ namespace BlackMisc
|
||||
enum InterpolatorMode
|
||||
{
|
||||
Spline,
|
||||
Linear
|
||||
Linear,
|
||||
Velocity
|
||||
};
|
||||
|
||||
//! Debugging messages for simulation
|
||||
|
||||
@@ -16,7 +16,8 @@ namespace BlackMisc::Simulation
|
||||
{
|
||||
CInterpolatorMulti::CInterpolatorMulti(const CCallsign &callsign, ISimulationEnvironmentProvider *p1, IInterpolationSetupProvider *p2, IRemoteAircraftProvider *p3, CInterpolationLogger *logger) :
|
||||
m_spline(callsign, p1, p2, p3, logger),
|
||||
m_linear(callsign, p1, p2, p3, logger)
|
||||
m_linear(callsign, p1, p2, p3, logger),
|
||||
m_velocity(callsign, p1, p2, p3, logger)
|
||||
{}
|
||||
|
||||
CInterpolationResult CInterpolatorMulti::getInterpolation(qint64 currentTimeSinceEpoc, const CInterpolationAndRenderingSetupPerCallsign &setup, int aircraftNumber)
|
||||
@@ -25,6 +26,7 @@ namespace BlackMisc::Simulation
|
||||
{
|
||||
case CInterpolationAndRenderingSetupBase::Linear: return m_linear.getInterpolation(currentTimeSinceEpoc, setup, aircraftNumber);
|
||||
case CInterpolationAndRenderingSetupBase::Spline: return m_spline.getInterpolation(currentTimeSinceEpoc, setup, aircraftNumber);
|
||||
case CInterpolationAndRenderingSetupBase::Velocity: return m_velocity.getInterpolation(currentTimeSinceEpoc, setup, aircraftNumber);
|
||||
default: break;
|
||||
}
|
||||
|
||||
@@ -37,6 +39,7 @@ namespace BlackMisc::Simulation
|
||||
{
|
||||
case CInterpolationAndRenderingSetupBase::Linear: return m_linear.getLastInterpolatedSituation();
|
||||
case CInterpolationAndRenderingSetupBase::Spline: return m_spline.getLastInterpolatedSituation();
|
||||
case CInterpolationAndRenderingSetupBase::Velocity: return m_velocity.getLastInterpolatedSituation();
|
||||
default: break;
|
||||
}
|
||||
return CAircraftSituation::null();
|
||||
@@ -46,12 +49,14 @@ namespace BlackMisc::Simulation
|
||||
{
|
||||
m_linear.attachLogger(logger);
|
||||
m_spline.attachLogger(logger);
|
||||
m_velocity.attachLogger(logger);
|
||||
}
|
||||
|
||||
void CInterpolatorMulti::initCorrespondingModel(const CAircraftModel &model)
|
||||
{
|
||||
m_linear.initCorrespondingModel(model);
|
||||
m_spline.initCorrespondingModel(model);
|
||||
m_velocity.initCorrespondingModel(model);
|
||||
}
|
||||
|
||||
const CStatusMessageList &CInterpolatorMulti::getInterpolationMessages(CInterpolationAndRenderingSetupBase::InterpolatorMode mode) const
|
||||
@@ -60,6 +65,7 @@ namespace BlackMisc::Simulation
|
||||
{
|
||||
case CInterpolationAndRenderingSetupBase::Spline: return m_spline.getInterpolationMessages();
|
||||
case CInterpolationAndRenderingSetupBase::Linear: return m_linear.getInterpolationMessages();
|
||||
case CInterpolationAndRenderingSetupBase::Velocity: return m_velocity.getInterpolationMessages();
|
||||
default: break;
|
||||
}
|
||||
static const CStatusMessageList empty;
|
||||
@@ -72,6 +78,7 @@ namespace BlackMisc::Simulation
|
||||
{
|
||||
case CInterpolationAndRenderingSetupBase::Spline: return m_spline.getInterpolatorInfo();
|
||||
case CInterpolationAndRenderingSetupBase::Linear: return m_linear.getInterpolatorInfo();
|
||||
case CInterpolationAndRenderingSetupBase::Velocity: return m_velocity.getInterpolatorInfo();
|
||||
default: break;
|
||||
}
|
||||
return ("Illegal mode");
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "blackmisc/simulation/interpolatorlinear.h"
|
||||
#include "blackmisc/simulation/interpolatorspline.h"
|
||||
#include "blackmisc/simulation/interpolatorvelocity.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
|
||||
namespace BlackMisc::Simulation
|
||||
@@ -47,6 +48,7 @@ namespace BlackMisc::Simulation
|
||||
private:
|
||||
CInterpolatorSpline m_spline;
|
||||
CInterpolatorLinear m_linear;
|
||||
CInterpolatorVelocity m_velocity;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user