diff --git a/src/blackcore/airspacemonitor.cpp b/src/blackcore/airspacemonitor.cpp index 810d1b4ee..a115451e3 100644 --- a/src/blackcore/airspacemonitor.cpp +++ b/src/blackcore/airspacemonitor.cpp @@ -185,6 +185,18 @@ namespace BlackCore return CFlightPlanRemarks(); } + CAtcStationList CAirspaceMonitor::getAtcStationsOnlineRecalculated() + { + m_atcStationsOnline.calculcateAndUpdateRelativeDistanceAndBearing(this->getOwnAircraftSituation()); + return m_atcStationsOnline; + } + + CAtcStationList CAirspaceMonitor::getAtcStationsBookedRecalculated() + { + m_atcStationsBooked.calculcateAndUpdateRelativeDistanceAndBearing(this->getOwnAircraftSituation()); + return m_atcStationsBooked; + } + CUserList CAirspaceMonitor::getUsers() const { CUserList users; @@ -439,6 +451,8 @@ namespace BlackCore m_atcStationsBooked = newBookedStations; } m_bookingsRequested = false; // we already emit here + m_atcStationsBooked.calculcateAndUpdateRelativeDistanceAndBearing(this->getOwnAircraftSituation()); + emit this->changedAtcStationsBooked(); // all booked stations reloaded } @@ -547,6 +561,9 @@ namespace BlackCore // subsequent queries this->sendInitialAtcQueries(callsign); + // update distances + m_atcStationsOnline.calculcateAndUpdateRelativeDistanceAndBearing(this->getOwnAircraftSituation()); + emit this->changedAtcStationsOnline(); // Remark: this->changedAtcStationOnlineConnectionStatus // will be sent in psFsdAtisVoiceRoomReceived diff --git a/src/blackcore/airspacemonitor.h b/src/blackcore/airspacemonitor.h index bdbbc1622..2eebdf3ba 100644 --- a/src/blackcore/airspacemonitor.h +++ b/src/blackcore/airspacemonitor.h @@ -97,9 +97,15 @@ namespace BlackCore //! Returns the current online ATC stations (consolidated with booked stations) BlackMisc::Aviation::CAtcStationList getAtcStationsOnline() const { return m_atcStationsOnline; } + //! Recalculate distance to own aircraft + BlackMisc::Aviation::CAtcStationList getAtcStationsOnlineRecalculated(); + //! Returns the current booked ATC stations (consolidated with online stations) BlackMisc::Aviation::CAtcStationList getAtcStationsBooked() const { return m_atcStationsBooked; } + //! Recalculate distance to own aircraft + BlackMisc::Aviation::CAtcStationList getAtcStationsBookedRecalculated(); + //! Returns the closest ATC station operating on the given frequency, if any BlackMisc::Aviation::CAtcStation getAtcStationForComUnit(const BlackMisc::Aviation::CComSystem &comSystem) const;