Ref T268, airspace monitor also consider closest elevations (from same callsign situations)

This commit is contained in:
Klaus Basan
2018-07-09 22:17:54 +02:00
parent 27f43747ae
commit 1428d39f4b
2 changed files with 19 additions and 10 deletions

View File

@@ -303,12 +303,11 @@ namespace BlackCore
m_bookingsRequested = true; m_bookingsRequested = true;
} }
void CAirspaceMonitor::enableWatchdog(bool enable) bool CAirspaceMonitor::enableWatchdog(bool enable)
{
if (this->analyzer())
{ {
if (!this->analyzer()) { return false; }
this->analyzer()->setEnabled(enable); this->analyzer()->setEnabled(enable);
} return true;
} }
void CAirspaceMonitor::testCreateDummyOnlineAtcStations(int number) void CAirspaceMonitor::testCreateDummyOnlineAtcStations(int number)
@@ -976,10 +975,20 @@ namespace BlackCore
if (!correctedSituation.hasGroundElevation() && !correctedSituation.canLikelySkipNearGroundInterpolation()) if (!correctedSituation.hasGroundElevation() && !correctedSituation.canLikelySkipNearGroundInterpolation())
{ {
// fetch from cache or request // fetch from cache or request
const CLength distance(correctedSituation.getDistancePerTime250ms()); // distnacee per ms const CAircraftSituationList situations = this->remoteAircraftSituations(callsign);
const CElevationPlane ep = this->findClosestElevationWithinRangeOrRequest(correctedSituation, distance, callsign); CElevationPlane ep = situations.findCLosestElevationWithinRange(correctedSituation, correctedSituation.getDistancePerTime(100, CElevationPlane::singlePointRadius()));
if (!ep.isNull())
{
correctedSituation.setGroundElevation(ep, CAircraftSituation::FromOtherSituations);
}
else
{
const CLength distance(correctedSituation.getDistancePerTime250ms(CElevationPlane::singlePointRadius())); // distnacee per ms
ep = this->findClosestElevationWithinRangeOrRequest(correctedSituation, distance, callsign);
Q_ASSERT_X(ep.isNull() || !ep.getRadius().isNull(), Q_FUNC_INFO, "null radius"); Q_ASSERT_X(ep.isNull() || !ep.getRadius().isNull(), Q_FUNC_INFO, "null radius");
correctedSituation.setGroundElevation(ep, CAircraftSituation::FromCache); correctedSituation.setGroundElevation(ep, CAircraftSituation::FromCache);
}
if (!correctedSituation.hasGroundElevation()) if (!correctedSituation.hasGroundElevation())
{ {
// we have a new situation, so we try to get the elevation // we have a new situation, so we try to get the elevation

View File

@@ -119,7 +119,7 @@ namespace BlackCore
CAirspaceAnalyzer *analyzer() const { return m_analyzer; } CAirspaceAnalyzer *analyzer() const { return m_analyzer; }
//! \copydoc CAirspaceAnalyzer::setEnabled //! \copydoc CAirspaceAnalyzer::setEnabled
void enableWatchdog(bool enable); bool enableWatchdog(bool enable);
//! Gracefully shut down, e.g. for thread safety //! Gracefully shut down, e.g. for thread safety
void gracefulShutdown(); void gracefulShutdown();