mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Ref T261, minor airspace monitor improvements and formatting
This commit is contained in:
committed by
Roland Winklmeier
parent
ac953de6fd
commit
4876569a9d
@@ -129,13 +129,6 @@ namespace BlackCore
|
||||
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()
|
||||
{
|
||||
static const CLogCategoryList cats { CLogCategory::matching(), CLogCategory::network() };
|
||||
@@ -878,16 +871,14 @@ namespace BlackCore
|
||||
Q_UNUSED(oldStatus);
|
||||
switch (newStatus)
|
||||
{
|
||||
case INetwork::Connected:
|
||||
break;
|
||||
case INetwork::Connected: break;
|
||||
case INetwork::Disconnected:
|
||||
case INetwork::DisconnectedError:
|
||||
case INetwork::DisconnectedLost:
|
||||
case INetwork::DisconnectedFailed:
|
||||
this->clear();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -954,17 +945,26 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
this->guessOnGround(correctedSituation); // does nothing if situation is not appropriate for guessing
|
||||
this->guessOnGroundAndUpdateModelCG(correctedSituation); // does nothing if situation is not appropriate for guessing
|
||||
CRemoteAircraftProvider::storeAircraftSituation(correctedSituation);
|
||||
}
|
||||
|
||||
bool CAirspaceMonitor::guessOnGround(CAircraftSituation &situation) const
|
||||
bool CAirspaceMonitor::guessOnGroundAndUpdateModelCG(CAircraftSituation &situation)
|
||||
{
|
||||
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);
|
||||
CAircraftModel aircraftModel = this->getAircraftInRangeModelForCallsign(callsign);
|
||||
const CLength cg = this->getCG(callsign); // always x-check against simulator to override guessed values and reflect changed CGs
|
||||
if (!cg.isNull() && aircraftModel.getCG() != cg)
|
||||
{
|
||||
aircraftModel.setCG(cg);
|
||||
this->updateCG(callsign, cg); // model's CG in remote provider
|
||||
}
|
||||
|
||||
if (!cg.isNull()) { situation.setCG(cg); }
|
||||
const CAircraftSituationChange change = this->remoteAircraftSituationChange(callsign);
|
||||
|
||||
if (!situation.shouldGuessOnGround()) { return false; }
|
||||
return situation.guessOnGround(change, aircraftModel);
|
||||
}
|
||||
|
||||
void CAirspaceMonitor::sendInitialAtcQueries(const CCallsign &callsign)
|
||||
|
||||
@@ -76,7 +76,6 @@ namespace BlackCore
|
||||
virtual QObject *asQObject() override { return this; }
|
||||
virtual BlackMisc::Simulation::CAirspaceAircraftSnapshot getLatestAirspaceAircraftSnapshot() const 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
|
||||
@@ -170,8 +169,9 @@ namespace BlackCore
|
||||
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
|
||||
|
||||
//! Guess situation if applicable
|
||||
bool guessOnGround(BlackMisc::Aviation::CAircraftSituation &situation) const;
|
||||
//! Guess situation "on ground" and update model's CG if applicable
|
||||
//! \remark updates CG and ground flag in situation
|
||||
bool guessOnGroundAndUpdateModelCG(BlackMisc::Aviation::CAircraftSituation &situation);
|
||||
|
||||
//! Remove ATC online stations
|
||||
void removeAllOnlineAtcStations();
|
||||
|
||||
Reference in New Issue
Block a user