mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
Ref T180, added utility function getInterpolatorInfo() allowing to log some info about interpolator
This commit is contained in:
@@ -275,6 +275,19 @@ namespace BlackMisc
|
||||
m_aircraftParts.front().setTimeOffsetMs(offset);
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
QString CInterpolator<Derived>::getInterpolatorInfo() const
|
||||
{
|
||||
return QStringLiteral("Callsign: ") %
|
||||
m_callsign.asString() %
|
||||
QStringLiteral(" situations: ") %
|
||||
QString::number(m_aircraftSituations.size()) %
|
||||
QStringLiteral(" parts: ") %
|
||||
QString::number(m_aircraftParts.size()) %
|
||||
QStringLiteral(" 1st interpolation: ") %
|
||||
boolToYesNo(m_isFirstInterpolation);
|
||||
}
|
||||
|
||||
template <typename Derived>
|
||||
void CInterpolator<Derived>::setGroundElevationFromHint(const CInterpolationHints &hints, CAircraftSituation &situation, bool override)
|
||||
{
|
||||
|
||||
@@ -78,6 +78,9 @@ namespace BlackMisc
|
||||
//! \remark parts logging has a \c bool \c log flag
|
||||
void attachLogger(CInterpolationLogger *logger) { m_logger = logger; }
|
||||
|
||||
//! Get an interpolator info string (for debug info)
|
||||
QString getInterpolatorInfo() const;
|
||||
|
||||
protected:
|
||||
BlackMisc::Aviation::CAircraftSituationList m_aircraftSituations; //!< recent situations for one aircraft
|
||||
BlackMisc::Aviation::CAircraftPartsList m_aircraftParts; //!< recent parts for one aircraft
|
||||
|
||||
@@ -56,10 +56,13 @@ namespace BlackMisc
|
||||
//! \copydoc CInterpolator::hasAircraftParts
|
||||
bool hasAircraftParts() const { return false; }
|
||||
|
||||
//! \copydoc CInterpolator::getInterpolatorInfo
|
||||
QString getInterpolatorInfo() const { return this->objectName(); }
|
||||
|
||||
//! \copydoc CInterpolator::attachLogger
|
||||
void attachLogger(CInterpolationLogger *) {}
|
||||
};
|
||||
}
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif
|
||||
|
||||
@@ -120,6 +120,17 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
QString CInterpolatorMulti::getInterpolatorInfo() const
|
||||
{
|
||||
switch (m_mode)
|
||||
{
|
||||
case ModeSpline: return m_spline.getInterpolatorInfo();
|
||||
case ModeLinear: return m_linear.getInterpolatorInfo();
|
||||
default: break;
|
||||
}
|
||||
return ("Illegal mode");
|
||||
}
|
||||
|
||||
CInterpolatorMulti::Mode CInterpolatorMulti::modeFromString(const QString &mode)
|
||||
{
|
||||
if (mode.contains("spli"), Qt::CaseInsensitive) { return ModeSpline; }
|
||||
|
||||
@@ -77,6 +77,9 @@ namespace BlackMisc
|
||||
//! Toogle interpolator Mode
|
||||
void toggleMode();
|
||||
|
||||
//! Info string
|
||||
QString getInterpolatorInfo() const;
|
||||
|
||||
//! Mode from string
|
||||
static Mode modeFromString(const QString &mode);
|
||||
|
||||
@@ -96,6 +99,7 @@ namespace BlackMisc
|
||||
|
||||
/**
|
||||
* CInterpolatorMulti which can be used with QMap/QHash
|
||||
* \remark Use case is emulated driver
|
||||
*/
|
||||
class BLACKMISC_EXPORT CInterpolatorMultiWrapper
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user