Ref T773, improved info texts and statistics values

This commit is contained in:
Klaus Basan
2020-02-20 02:25:27 +01:00
committed by Mat Sutcliffe
parent f2096bd826
commit 181c2b8061
5 changed files with 46 additions and 16 deletions

View File

@@ -443,6 +443,9 @@ namespace BlackCore
this->removeAllOnlineAtcStations();
this->removeAllAircraft();
this->clearClients();
m_foundInNonMovingAircraft = 0;
m_foundInElevationsOnGnd = 0;
}
void CAirspaceMonitor::gracefulShutdown()
@@ -470,10 +473,10 @@ namespace BlackCore
return;
}
const int rInt = range.valueInteger(CLengthUnit::NM());
CLogMessage(this).info(u"Set airspace max. range to %1NM") << rInt;
m_maxDistanceNM = rInt;
m_maxDistanceNMHysteresis = qRound(rInt * 1.1);
const int rIntNM = range.valueInteger(CLengthUnit::NM());
CLogMessage(this).info(u"Set airspace max. range to %1NM") << rIntNM;
m_maxDistanceNM = rIntNM;
m_maxDistanceNMHysteresis = qRound(rIntNM * 1.1);
}
void CAirspaceMonitor::onRealNameReplyReceived(const CCallsign &callsign, const QString &realname)
@@ -1419,17 +1422,18 @@ namespace BlackCore
bool fromNonMoving = false;
bool triedExtrapolation = false;
bool couldNotExtrapolate = false;
CElevationPlane averagePlane = this->averageElevationOfOnGroundAircraft(situation, CElevationPlane::majorAirportRadius(), 2, 3);
if (averagePlane.isNull())
{
averagePlane = this->averageElevationOfNonMovingAircraft(situation, CElevationPlane::majorAirportRadius(), 2);
fromNonMoving = true;
}
// do we have a elevation yet?
if (!averagePlane.isNull())
{
correctedSituation.setGroundElevation(averagePlane, CAircraftSituation::Average);
if (fromNonMoving) { m_foundInNonMovingAircraft++; } else { m_foundInElevationsOnGnd++; }
}
else
{

View File

@@ -293,6 +293,8 @@ namespace BlackCore
bool m_bookingsRequested = false; //!< bookings have been requested, it can happen we receive an BlackCore::Vatsim::CVatsimBookingReader::atcBookingsReadUnchanged signal
int m_maxDistanceNM = 125; //!< position range / FSD range
int m_maxDistanceNMHysteresis = qRound(1.1 * m_maxDistanceNM);
int m_foundInNonMovingAircraft = 0;
int m_foundInElevationsOnGnd = 0;
// Processing for queries etc. (fast)
static constexpr int FastProcessIntervalMs = 50; //!< interval in ms

View File

@@ -371,7 +371,6 @@ namespace BlackGui
void CInterpolationLogDisplay::onElevationReceived(const CElevationPlane &elevationPlane, const CCallsign &callsign)
{
m_elvReceived++;
if (m_elvHistoryCount > 0)
{
const QString history = callsign.asString() %
@@ -388,6 +387,7 @@ namespace BlackGui
}
}
// not for a real plane, but to get elevation at any position for testing
if (callsign == CInterpolationLogDisplay::pseudoCallsignElevation())
{
this->displayArbitraryElevation(elevationPlane);
@@ -395,6 +395,9 @@ namespace BlackGui
}
if (!this->logCallsign(callsign)) { return; }
// for logged callsign
m_elvReceivedLoggedCs++;
ui->le_Elevation->setText(elevationPlane.toQString());
this->displayElevationRequestReceive();
ui->led_Elevation->blink();
@@ -402,8 +405,11 @@ namespace BlackGui
void CInterpolationLogDisplay::onElevationRequested(const CCallsign &callsign)
{
if (!this->logCallsign(callsign)) { return; }
m_elvRequested++;
if (!this->logCallsign(callsign)) { return; }
// for logged callsign
m_elvRequestedLoggedCs++;
this->displayElevationRequestReceive();
ui->led_Elevation->blink();
}
@@ -456,10 +462,12 @@ namespace BlackGui
ui->le_CG->clear();
ui->le_Elevation->clear();
ui->le_ElevationReqRec->clear();
ui->le_ElevationReqRec->setToolTip("elevation requested");
ui->le_Parts->clear();
ui->le_UpdateTimes->clear();
ui->le_UpdateTimes->clear();
ui->le_Limited->clear();
m_elvReceivedLoggedCs = m_elvRequestedLoggedCs = 0;
m_elvReceived = m_elvRequested = 0;
m_lastInterpolations.clear();
@@ -551,10 +559,14 @@ namespace BlackGui
void CInterpolationLogDisplay::displayElevationRequestReceive()
{
if (!m_airspaceMonitor) { return; }
static const QString info("%1/%2 hits %3 times: %4");
static const QString info("req. %1, %2/rec. %3, %4 | found/missed: '%5' | times: %6");
const QString foundMissed = m_airspaceMonitor->getElevationsFoundMissedInfo();
const QString reqTimes = m_airspaceMonitor->getElevationRequestTimesInfo();
ui->le_ElevationReqRec->setText(info.arg(m_elvRequested).arg(m_elvReceived).arg(foundMissed, reqTimes));
const QString reqRec = info.arg(m_elvRequestedLoggedCs).arg(m_elvRequested).arg(m_elvReceivedLoggedCs).arg(m_elvReceived).arg(foundMissed, reqTimes);
ui->le_ElevationReqRec->setText(reqRec);
ui->le_ElevationReqRec->setToolTip(reqRec);
ui->le_ElevationReqRec->home(false);
}
void CInterpolationLogDisplay::displayArbitraryElevation(const CElevationPlane &elevation)

View File

@@ -182,13 +182,17 @@ namespace BlackGui
QScopedPointer<Ui::CInterpolationLogDisplay> ui;
QTimer m_updateTimer;
QPointer<BlackCore::ISimulator> m_simulator; //!< related simulator
QPointer<BlackCore::CAirspaceMonitor> m_airspaceMonitor; //!< related airspace monitor
QPointer<BlackCore::ISimulator> m_simulator; //!< related simulator
QPointer<BlackCore::CAirspaceMonitor> m_airspaceMonitor; //!< related airspace monitor
BlackMisc::Aviation::CAircraftSituationList m_lastInterpolations; //!< list of last interpolations
BlackMisc::Aviation::CCallsign m_callsign; //!< current callsign
int m_elvRequested = 0; //!< counted via signal
int m_elvReceived = 0; //!< counted via signal
int m_elvHistoryCount = -1; //!< how many in history
int m_elvRequested = 0; //!< counted via signal
int m_elvReceived = 0; //!< counted via signal
int m_elvRequestedLoggedCs = 0; //!< counted via signal
int m_elvReceivedLoggedCs = 0; //!< counted via signal
int m_elvHistoryCount = -1; //!< how many in history
QStringListModel *m_elvHistoryModel = nullptr;
static const QString &startText();

View File

@@ -261,12 +261,20 @@ namespace BlackMisc
QString ISimulationEnvironmentProvider::getElevationsFoundMissedInfo() const
{
static const QString info("%1/%2 %3%");
static const QString info("%1/%2 %3% in %4 (all)/%5 (gnd)");
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));
int elvGnd;
int elv;
{
QReadLocker l(&m_lockElvCoordinates);
elvGnd = m_elvCoordinatesGnd.sizeInt();
elv = m_elvCoordinates.sizeInt();
}
return info.arg(f).arg(m).arg(QString::number(hitRatioPercent, 'f', 1)).arg(elv).arg(elvGnd);
}
QPair<qint64, qint64> ISimulationEnvironmentProvider::getElevationRequestTimes() const