Ref T260, ext. version of updating ground elevation, allows to guess gnd. again with updated elevation

This commit is contained in:
Klaus Basan
2018-04-18 05:05:21 +02:00
committed by Roland Winklmeier
parent 075ffa8ccb
commit d0addd547a
4 changed files with 35 additions and 8 deletions

View File

@@ -129,6 +129,13 @@ namespace BlackCore
return r; return r;
} }
int CAirspaceMonitor::updateAircraftGroundElevation(const CCallsign &callsign, const CElevationPlane &elevation)
{
const bool vtol = this->isVtolAircraft(callsign);
const CLength cg = this->getCG(callsign);
return this->updateAircraftGroundElevationExt(callsign, elevation, vtol, cg, true);
}
const CLogCategoryList &CAirspaceMonitor::getLogCategories() const CLogCategoryList &CAirspaceMonitor::getLogCategories()
{ {
static const CLogCategoryList cats { CLogCategory::matching(), CLogCategory::network() }; static const CLogCategoryList cats { CLogCategory::matching(), CLogCategory::network() };
@@ -947,14 +954,17 @@ namespace BlackCore
} }
} }
if (situation.getOnGroundDetails() != CAircraftSituation::NotSet) this->guessOnGround(correctedSituation); // does nothing if situation is not appropriate for guessing
{ CRemoteAircraftProvider::storeAircraftSituation(correctedSituation);
const bool vtol = this->isVtolAircraft(callsign);
const CLength cg = this->getCG(callsign);
correctedSituation.guessOnGround(vtol, cg);
} }
CRemoteAircraftProvider::storeAircraftSituation(correctedSituation); bool CAirspaceMonitor::guessOnGround(CAircraftSituation &situation) const
{
if (!situation.shouldGuessOnGround()) { return false; }
const CCallsign callsign(situation.getCallsign());
const bool vtol = this->isVtolAircraft(callsign);
const CLength cg = this->getCG(callsign);
return situation.guessOnGround(vtol, cg);
} }
void CAirspaceMonitor::sendInitialAtcQueries(const CCallsign &callsign) void CAirspaceMonitor::sendInitialAtcQueries(const CCallsign &callsign)

View File

@@ -76,6 +76,7 @@ namespace BlackCore
virtual QObject *asQObject() override { return this; } virtual QObject *asQObject() override { return this; }
virtual BlackMisc::Simulation::CAirspaceAircraftSnapshot getLatestAirspaceAircraftSnapshot() const override; virtual BlackMisc::Simulation::CAirspaceAircraftSnapshot getLatestAirspaceAircraftSnapshot() const override;
virtual bool updateFastPositionEnabled(const BlackMisc::Aviation::CCallsign &callsign, bool enableFastPositonUpdates) override; virtual bool updateFastPositionEnabled(const BlackMisc::Aviation::CCallsign &callsign, bool enableFastPositonUpdates) override;
virtual int updateAircraftGroundElevation(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Geo::CElevationPlane &elevation) override;
//! @} //! @}
//! Returns the list of users we know about //! Returns the list of users we know about
@@ -169,6 +170,9 @@ namespace BlackCore
CAirspaceAnalyzer *m_analyzer = nullptr; //!< owned analyzer CAirspaceAnalyzer *m_analyzer = nullptr; //!< owned analyzer
bool m_bookingsRequested = false; //!< bookings have been requested, it can happen we receive an BlackCore::Vatsim::CVatsimBookingReader::atcBookingsReadUnchanged signal bool m_bookingsRequested = false; //!< bookings have been requested, it can happen we receive an BlackCore::Vatsim::CVatsimBookingReader::atcBookingsReadUnchanged signal
//! Guess situation if applicable
bool guessOnGround(BlackMisc::Aviation::CAircraftSituation &situation) const;
//! Remove ATC online stations //! Remove ATC online stations
void removeAllOnlineAtcStations(); void removeAllOnlineAtcStations();

View File

@@ -14,6 +14,7 @@
#include "blackmisc/verify.h" #include "blackmisc/verify.h"
using namespace BlackMisc::Aviation; using namespace BlackMisc::Aviation;
using namespace BlackMisc::PhysicalQuantities;
using namespace BlackMisc::Geo; using namespace BlackMisc::Geo;
using namespace BlackMisc::Json; using namespace BlackMisc::Json;
@@ -355,6 +356,11 @@ namespace BlackMisc
} }
int CRemoteAircraftProvider::updateAircraftGroundElevation(const CCallsign &callsign, const CElevationPlane &elevation) int CRemoteAircraftProvider::updateAircraftGroundElevation(const CCallsign &callsign, const CElevationPlane &elevation)
{
return this->updateAircraftGroundElevationExt(callsign, elevation, false, CLength::null(), false);
}
int CRemoteAircraftProvider::updateAircraftGroundElevationExt(const CCallsign &callsign, const CElevationPlane &elevation, bool isVtol, const CLength &cg, bool autoGuessGnd)
{ {
if (!this->isAircraftInRange(callsign)) { return 0; } if (!this->isAircraftInRange(callsign)) { return 0; }
@@ -363,7 +369,10 @@ namespace BlackMisc
int updated = 0; int updated = 0;
{ {
QWriteLocker l(&m_lockSituations); QWriteLocker l(&m_lockSituations);
updated = m_situationsByCallsign[callsign].setGroundElevationChecked(elevation); CAircraftSituationList situations = m_situationsByCallsign[callsign];
updated = autoGuessGnd ?
situations.setGroundElevationCheckedAndGuessGround(elevation, isVtol, cg) :
situations.setGroundElevationChecked(elevation);
if (updated < 1) { return 0; } if (updated < 1) { return 0; }
m_situationsLastModified[callsign] = ts; m_situationsLastModified[callsign] = ts;
} }

View File

@@ -356,6 +356,10 @@ namespace BlackMisc
//! \threadsafe //! \threadsafe
void storeAircraftSituation(const Aviation::CAircraftSituation &situation); void storeAircraftSituation(const Aviation::CAircraftSituation &situation);
//! An extended of IRemoteAircraftProvider::updateAircraftGroundElevation version which allows also guessing of ground
//! \sa IRemoteAircraftProvider::updateAircraftGroundElevation
int updateAircraftGroundElevationExt(const Aviation::CCallsign &callsign, const Geo::CElevationPlane &elevation, bool isVtol, const PhysicalQuantities::CLength &cg, bool autoGuessGnd);
//! Store an aircraft part //! Store an aircraft part
//! \remark latest parts are kept first //! \remark latest parts are kept first
//! \threadsafe //! \threadsafe