mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
Ref T275, unified elevation missed info -> getElevationsFoundMissedInfo()
This commit is contained in:
@@ -415,7 +415,7 @@ namespace BlackMisc
|
||||
) %
|
||||
(
|
||||
withElevation ?
|
||||
QStringLiteral("Elev info.: ") % elevationInfo %
|
||||
QStringLiteral("Elev.info: ") % elevationInfo %
|
||||
QStringLiteral(" scenery os: ") % sceneryOffset.valueRoundedWithUnit(1) % separator :
|
||||
QStringLiteral("")
|
||||
) %
|
||||
|
||||
@@ -224,8 +224,6 @@ namespace BlackMisc
|
||||
// logging
|
||||
if (this->doLogging())
|
||||
{
|
||||
static const QString elv("found %1 missed %2");
|
||||
const QPair<int, int> elvStats = this->getElevationsFoundMissed();
|
||||
log.tsCurrent = m_currentTimeMsSinceEpoch;
|
||||
log.callsign = m_callsign;
|
||||
log.groundFactor = currentSituation.getOnGroundFactor();
|
||||
@@ -233,7 +231,7 @@ namespace BlackMisc
|
||||
log.situationCurrent = currentSituation;
|
||||
log.change = m_pastSituationsChange;
|
||||
log.usedSetup = m_currentSetup;
|
||||
log.elevationInfo = elv.arg(elvStats.first).arg(elvStats.second);
|
||||
log.elevationInfo = this->getElevationsFoundMissedInfo();
|
||||
log.cgAboveGround = currentSituation.getCG();
|
||||
log.sceneryOffset = m_currentSceneryOffset;
|
||||
m_logger->logInterpolation(log);
|
||||
|
||||
@@ -141,6 +141,16 @@ namespace BlackMisc
|
||||
return QPair<int, int>(m_elvFound, m_elvMissed);
|
||||
}
|
||||
|
||||
QString ISimulationEnvironmentProvider::getElevationsFoundMissedInfo() const
|
||||
{
|
||||
static const QString info("%1/%2 %3");
|
||||
const QPair<int, int> foundMissed = this->getElevationsFoundMissed();
|
||||
const int f = foundMissed.first;
|
||||
const int m = foundMissed.second;
|
||||
const double hitRatioPercent = 100.0 * static_cast<double>(f) / static_cast<double>(f + m);
|
||||
return info.arg(f).arg(m).arg(QString::number(hitRatioPercent, 'f', 1));
|
||||
}
|
||||
|
||||
CSimulatorPluginInfo ISimulationEnvironmentProvider::getSimulatorPluginInfo() const
|
||||
{
|
||||
QReadLocker l(&m_lockModel);
|
||||
@@ -258,6 +268,12 @@ namespace BlackMisc
|
||||
return this->provider()->getElevationsFoundMissed();
|
||||
}
|
||||
|
||||
QString CSimulationEnvironmentAware::getElevationsFoundMissedInfo() const
|
||||
{
|
||||
if (!this->hasProvider()) { return QString(); }
|
||||
return this->provider()->getElevationsFoundMissedInfo();
|
||||
}
|
||||
|
||||
CSimulatorPluginInfo CSimulationEnvironmentAware::getSimulatorPluginInfo() const
|
||||
{
|
||||
if (!this->hasProvider()) { return CSimulatorPluginInfo(); }
|
||||
|
||||
@@ -52,6 +52,10 @@ namespace BlackMisc
|
||||
//! \threadsafe
|
||||
QPair<int, int> getElevationsFoundMissed() const;
|
||||
|
||||
//! Elevations found/missed statistics info as string
|
||||
//! \threadsafe
|
||||
QString getElevationsFoundMissedInfo() const;
|
||||
|
||||
//! Get the represented plugin
|
||||
//! \threadsafe
|
||||
CSimulatorPluginInfo getSimulatorPluginInfo() const;
|
||||
@@ -88,7 +92,7 @@ namespace BlackMisc
|
||||
//! Ctor
|
||||
ISimulationEnvironmentProvider(const CSimulatorPluginInfo &pluginInfo);
|
||||
|
||||
//! All remembered coordiantes plus max remembered situations
|
||||
//! All remembered coordiantes plus max.remembered situations
|
||||
//! \threadsafe
|
||||
Geo::CCoordinateGeodeticList getElevationCoordinates(int &maxRemembered) const;
|
||||
|
||||
@@ -146,10 +150,10 @@ namespace BlackMisc
|
||||
CSimulatorPluginInfo m_simulatorPluginInfo; //!< info object
|
||||
Geo::CCoordinateGeodeticList m_elvCoordinates;
|
||||
QMap<Aviation::CCallsign, PhysicalQuantities::CLength> m_cgs; //! CGs
|
||||
mutable int m_elvFound = 0; //!< statistics only
|
||||
mutable int m_elvMissed = 0; //!< statistics only
|
||||
mutable int m_elvFound = 0; //!< statistics only
|
||||
mutable int m_elvMissed = 0; //!< statistics only
|
||||
mutable QReadWriteLock m_lockElvCoordinates; //!< lock m_coordinates
|
||||
mutable QReadWriteLock m_lockCG; //!< lock CGs
|
||||
mutable QReadWriteLock m_lockCG; //!< lock CGs
|
||||
mutable QReadWriteLock m_lockModel; //!< lock models
|
||||
};
|
||||
|
||||
@@ -172,6 +176,9 @@ namespace BlackMisc
|
||||
//! \copydoc ISimulationEnvironmentProvider::getElevationsFoundMissed
|
||||
QPair<int, int> getElevationsFoundMissed() const;
|
||||
|
||||
//! \copydoc ISimulationEnvironmentProvider::getElevationsFoundMissedInfo
|
||||
QString getElevationsFoundMissedInfo() const;
|
||||
|
||||
//! \copydoc ISimulationEnvironmentProvider::getSimulatorPluginInfo
|
||||
CSimulatorPluginInfo getSimulatorPluginInfo() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user