mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-08-12 04:35:41 +08:00
Ref T260, ext. version of updating ground elevation, allows to guess gnd. again with updated elevation
This commit is contained in:
committed by
Roland Winklmeier
parent
075ffa8ccb
commit
d0addd547a
@@ -129,6 +129,13 @@ 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() };
|
||||
@@ -947,16 +954,19 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
if (situation.getOnGroundDetails() != CAircraftSituation::NotSet)
|
||||
{
|
||||
const bool vtol = this->isVtolAircraft(callsign);
|
||||
const CLength cg = this->getCG(callsign);
|
||||
correctedSituation.guessOnGround(vtol, cg);
|
||||
}
|
||||
|
||||
this->guessOnGround(correctedSituation); // does nothing if situation is not appropriate for guessing
|
||||
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)
|
||||
{
|
||||
if (!this->isConnected()) { return; }
|
||||
|
||||
@@ -76,6 +76,7 @@ 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
|
||||
@@ -169,6 +170,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;
|
||||
|
||||
//! Remove ATC online stations
|
||||
void removeAllOnlineAtcStations();
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "blackmisc/verify.h"
|
||||
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::Json;
|
||||
|
||||
@@ -355,6 +356,11 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
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; }
|
||||
|
||||
@@ -363,7 +369,10 @@ namespace BlackMisc
|
||||
int updated = 0;
|
||||
{
|
||||
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; }
|
||||
m_situationsLastModified[callsign] = ts;
|
||||
}
|
||||
|
||||
@@ -356,6 +356,10 @@ namespace BlackMisc
|
||||
//! \threadsafe
|
||||
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
|
||||
//! \remark latest parts are kept first
|
||||
//! \threadsafe
|
||||
|
||||
Reference in New Issue
Block a user