mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +08:00
refactor: Remove airport view
This commit is contained in:
@@ -164,9 +164,6 @@ namespace swift::core::context
|
|||||||
//! Simulator setup
|
//! Simulator setup
|
||||||
virtual swift::misc::simulation::CSimulatorInternals getSimulatorInternals() const = 0;
|
virtual swift::misc::simulation::CSimulatorInternals getSimulatorInternals() const = 0;
|
||||||
|
|
||||||
//! Airports in range
|
|
||||||
virtual swift::misc::aviation::CAirportList getAirportsInRange(bool recalculateDistance) const = 0;
|
|
||||||
|
|
||||||
//! Installed models in simulator eco system
|
//! Installed models in simulator eco system
|
||||||
//! \note might be slow since list can be big
|
//! \note might be slow since list can be big
|
||||||
virtual swift::misc::simulation::CAircraftModelList getModelSet() const = 0;
|
virtual swift::misc::simulation::CAircraftModelList getModelSet() const = 0;
|
||||||
|
|||||||
@@ -80,14 +80,6 @@ namespace swift::core::context
|
|||||||
logEmptyContextWarning(Q_FUNC_INFO);
|
logEmptyContextWarning(Q_FUNC_INFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \copydoc IContextSimulator::getAirportsInRange
|
|
||||||
virtual swift::misc::aviation::CAirportList getAirportsInRange(bool recalculatePosition) const override
|
|
||||||
{
|
|
||||||
Q_UNUSED(recalculatePosition)
|
|
||||||
logEmptyContextWarning(Q_FUNC_INFO);
|
|
||||||
return swift::misc::aviation::CAirportList();
|
|
||||||
}
|
|
||||||
|
|
||||||
//! \copydoc IContextSimulator::getModelSet
|
//! \copydoc IContextSimulator::getModelSet
|
||||||
virtual swift::misc::simulation::CAircraftModelList getModelSet() const override
|
virtual swift::misc::simulation::CAircraftModelList getModelSet() const override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -214,14 +214,6 @@ namespace swift::core::context
|
|||||||
return m_simulatorPlugin.second->getSimulatorInternals();
|
return m_simulatorPlugin.second->getSimulatorInternals();
|
||||||
}
|
}
|
||||||
|
|
||||||
CAirportList CContextSimulator::getAirportsInRange(bool recalculateDistance) const
|
|
||||||
{
|
|
||||||
if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
|
|
||||||
// If no ISimulator object is available, return a dummy.
|
|
||||||
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return CAirportList(); }
|
|
||||||
return m_simulatorPlugin.second->getAirportsInRange(recalculateDistance);
|
|
||||||
}
|
|
||||||
|
|
||||||
CAircraftModelList CContextSimulator::getModelSet() const
|
CAircraftModelList CContextSimulator::getModelSet() const
|
||||||
{
|
{
|
||||||
if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
|
if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||||
|
|||||||
@@ -103,9 +103,6 @@ namespace swift::core
|
|||||||
//! \copydoc swift::core::context::IContextSimulator::getSimulatorInternals
|
//! \copydoc swift::core::context::IContextSimulator::getSimulatorInternals
|
||||||
virtual swift::misc::simulation::CSimulatorInternals getSimulatorInternals() const override;
|
virtual swift::misc::simulation::CSimulatorInternals getSimulatorInternals() const override;
|
||||||
|
|
||||||
//! \copydoc swift::core::context::IContextSimulator::getAirportsInRange
|
|
||||||
virtual swift::misc::aviation::CAirportList getAirportsInRange(bool recalculateDistance) const override;
|
|
||||||
|
|
||||||
//! \copydoc swift::core::context::IContextSimulator::getModelSetLoaderSimulator
|
//! \copydoc swift::core::context::IContextSimulator::getModelSetLoaderSimulator
|
||||||
virtual swift::misc::simulation::CSimulatorInfo getModelSetLoaderSimulator() const override;
|
virtual swift::misc::simulation::CSimulatorInfo getModelSetLoaderSimulator() const override;
|
||||||
|
|
||||||
|
|||||||
@@ -136,11 +136,6 @@ namespace swift::core::context
|
|||||||
return m_dBusInterface->callDBusRet<ISimulator::SimulatorStatus>(QLatin1String("getSimulatorStatus"));
|
return m_dBusInterface->callDBusRet<ISimulator::SimulatorStatus>(QLatin1String("getSimulatorStatus"));
|
||||||
}
|
}
|
||||||
|
|
||||||
CAirportList CContextSimulatorProxy::getAirportsInRange(bool recalculatePosition) const
|
|
||||||
{
|
|
||||||
return m_dBusInterface->callDBusRet<CAirportList>(QLatin1String("getAirportsInRange"), recalculatePosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
CAircraftModelList CContextSimulatorProxy::getModelSet() const
|
CAircraftModelList CContextSimulatorProxy::getModelSet() const
|
||||||
{
|
{
|
||||||
return m_dBusInterface->callDBusRet<CAircraftModelList>(QLatin1String("getModelSet"));
|
return m_dBusInterface->callDBusRet<CAircraftModelList>(QLatin1String("getModelSet"));
|
||||||
|
|||||||
@@ -83,9 +83,6 @@ namespace swift::core
|
|||||||
//! \copydoc swift::core::context::IContextSimulator::getSimulatorStatus
|
//! \copydoc swift::core::context::IContextSimulator::getSimulatorStatus
|
||||||
virtual ISimulator::SimulatorStatus getSimulatorStatus() const override;
|
virtual ISimulator::SimulatorStatus getSimulatorStatus() const override;
|
||||||
|
|
||||||
//! \copydoc swift::core::context::IContextSimulator::getAirportsInRange
|
|
||||||
virtual swift::misc::aviation::CAirportList getAirportsInRange(bool recalculatePosition) const override;
|
|
||||||
|
|
||||||
//! \copydoc swift::core::context::IContextSimulator::getModelSet
|
//! \copydoc swift::core::context::IContextSimulator::getModelSet
|
||||||
virtual swift::misc::simulation::CAircraftModelList getModelSet() const override;
|
virtual swift::misc::simulation::CAircraftModelList getModelSet() const override;
|
||||||
|
|
||||||
|
|||||||
@@ -634,8 +634,6 @@ namespace swift::core
|
|||||||
{
|
{
|
||||||
connect(sApp->getWebDataServices(), &CWebDataServices::swiftDbAllDataRead, this,
|
connect(sApp->getWebDataServices(), &CWebDataServices::swiftDbAllDataRead, this,
|
||||||
&ISimulator::onSwiftDbAllDataRead, Qt::QueuedConnection);
|
&ISimulator::onSwiftDbAllDataRead, Qt::QueuedConnection);
|
||||||
connect(sApp->getWebDataServices(), &CWebDataServices::swiftDbAirportsRead, this,
|
|
||||||
&ISimulator::onSwiftDbAirportsRead, Qt::QueuedConnection);
|
|
||||||
connect(sApp->getWebDataServices(), &CWebDataServices::swiftDbModelMatchingEntitiesRead, this,
|
connect(sApp->getWebDataServices(), &CWebDataServices::swiftDbModelMatchingEntitiesRead, this,
|
||||||
&ISimulator::onSwiftDbModelMatchingEntitiesRead, Qt::QueuedConnection);
|
&ISimulator::onSwiftDbModelMatchingEntitiesRead, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
@@ -751,26 +749,6 @@ namespace swift::core
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAirportList ISimulator::getWebServiceAirports() const
|
|
||||||
{
|
|
||||||
if (this->isShuttingDown()) { return {}; }
|
|
||||||
if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return {}; }
|
|
||||||
return sApp->getWebDataServices()->getAirports();
|
|
||||||
}
|
|
||||||
|
|
||||||
CAirport ISimulator::getWebServiceAirport(const CAirportIcaoCode &icao) const
|
|
||||||
{
|
|
||||||
if (this->isShuttingDown()) { return {}; }
|
|
||||||
if (!sApp || sApp->isShuttingDown() || !sApp->hasWebDataServices()) { return {}; }
|
|
||||||
return sApp->getWebDataServices()->getAirports().findFirstByIcao(icao);
|
|
||||||
}
|
|
||||||
|
|
||||||
int ISimulator::maxAirportsInRange() const
|
|
||||||
{
|
|
||||||
// might change in future or become a setting or such
|
|
||||||
return 20;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ISimulator::onSwiftDbAllDataRead()
|
void ISimulator::onSwiftDbAllDataRead()
|
||||||
{
|
{
|
||||||
// void, can be overridden in specialized drivers
|
// void, can be overridden in specialized drivers
|
||||||
@@ -781,11 +759,6 @@ namespace swift::core
|
|||||||
// void, can be overridden in specialized drivers
|
// void, can be overridden in specialized drivers
|
||||||
}
|
}
|
||||||
|
|
||||||
void ISimulator::onSwiftDbAirportsRead()
|
|
||||||
{
|
|
||||||
// void, can be overridden in specialized drivers
|
|
||||||
}
|
|
||||||
|
|
||||||
void ISimulator::initSimulatorInternals()
|
void ISimulator::initSimulatorInternals()
|
||||||
{
|
{
|
||||||
const CSpecializedSimulatorSettings s = this->getSimulatorSettings();
|
const CSpecializedSimulatorSettings s = this->getSimulatorSettings();
|
||||||
@@ -887,23 +860,6 @@ namespace swift::core
|
|||||||
return m_loopbackSituations.value(callsign);
|
return m_loopbackSituations.value(callsign);
|
||||||
}
|
}
|
||||||
|
|
||||||
CAirportList ISimulator::getAirportsInRange(bool recalculateDistance) const
|
|
||||||
{
|
|
||||||
// default implementation
|
|
||||||
if (this->isShuttingDown()) { return {}; }
|
|
||||||
if (!sApp || !sApp->hasWebDataServices()) { return {}; }
|
|
||||||
|
|
||||||
const CAirportList airports = sApp->getWebDataServices()->getAirports();
|
|
||||||
if (airports.isEmpty()) { return airports; }
|
|
||||||
const CCoordinateGeodetic ownPosition = this->getOwnAircraftPosition();
|
|
||||||
CAirportList airportsInRange = airports.findClosest(maxAirportsInRange(), ownPosition);
|
|
||||||
if (recalculateDistance)
|
|
||||||
{
|
|
||||||
airportsInRange.calculcateAndUpdateRelativeDistanceAndBearing(this->getOwnAircraftPosition());
|
|
||||||
}
|
|
||||||
return airportsInRange;
|
|
||||||
}
|
|
||||||
|
|
||||||
CAircraftModel ISimulator::reverseLookupModel(const CAircraftModel &model)
|
CAircraftModel ISimulator::reverseLookupModel(const CAircraftModel &model)
|
||||||
{
|
{
|
||||||
bool modified = false;
|
bool modified = false;
|
||||||
|
|||||||
@@ -133,9 +133,6 @@ namespace swift::core
|
|||||||
//! Display a text message
|
//! Display a text message
|
||||||
virtual void displayTextMessage(const swift::misc::network::CTextMessage &message) const = 0;
|
virtual void displayTextMessage(const swift::misc::network::CTextMessage &message) const = 0;
|
||||||
|
|
||||||
//! Airports in range from simulator, or if not available from web service
|
|
||||||
virtual swift::misc::aviation::CAirportList getAirportsInRange(bool recalculateDistance) const;
|
|
||||||
|
|
||||||
//! Is the aircraft rendered (displayed in simulator)?
|
//! Is the aircraft rendered (displayed in simulator)?
|
||||||
//! This shall only return true if the aircraft is really visible in the simulator
|
//! This shall only return true if the aircraft is really visible in the simulator
|
||||||
virtual bool isPhysicallyRenderedAircraft(const swift::misc::aviation::CCallsign &callsign) const = 0;
|
virtual bool isPhysicallyRenderedAircraft(const swift::misc::aviation::CCallsign &callsign) const = 0;
|
||||||
@@ -407,7 +404,6 @@ namespace swift::core
|
|||||||
//! When swift DB data are read
|
//! When swift DB data are read
|
||||||
virtual void onSwiftDbAllDataRead();
|
virtual void onSwiftDbAllDataRead();
|
||||||
virtual void onSwiftDbModelMatchingEntitiesRead();
|
virtual void onSwiftDbModelMatchingEntitiesRead();
|
||||||
virtual void onSwiftDbAirportsRead();
|
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
//! Init the internals info from the simulator
|
//! Init the internals info from the simulator
|
||||||
@@ -416,15 +412,6 @@ namespace swift::core
|
|||||||
//! Parsed in derived classes
|
//! Parsed in derived classes
|
||||||
virtual bool parseDetails(const swift::misc::CSimpleCommandParser &parser) = 0;
|
virtual bool parseDetails(const swift::misc::CSimpleCommandParser &parser) = 0;
|
||||||
|
|
||||||
//! Airports from web services
|
|
||||||
swift::misc::aviation::CAirportList getWebServiceAirports() const;
|
|
||||||
|
|
||||||
//! Airport from web services by ICAO code
|
|
||||||
swift::misc::aviation::CAirport getWebServiceAirport(const swift::misc::aviation::CAirportIcaoCode &icao) const;
|
|
||||||
|
|
||||||
//! Max.airports in range
|
|
||||||
int maxAirportsInRange() const;
|
|
||||||
|
|
||||||
//! Recalculate the rendered aircraft, this happens when restrictions are applied (max. aircraft, range)
|
//! Recalculate the rendered aircraft, this happens when restrictions are applied (max. aircraft, range)
|
||||||
virtual void onRecalculatedRenderedAircraft(const swift::misc::simulation::CAirspaceAircraftSnapshot &snapshot);
|
virtual void onRecalculatedRenderedAircraft(const swift::misc::simulation::CAirspaceAircraftSnapshot &snapshot);
|
||||||
|
|
||||||
|
|||||||
@@ -675,8 +675,6 @@ add_library(gui SHARED
|
|||||||
models/airlineicaofilter.h
|
models/airlineicaofilter.h
|
||||||
models/airlineicaolistmodel.cpp
|
models/airlineicaolistmodel.cpp
|
||||||
models/airlineicaolistmodel.h
|
models/airlineicaolistmodel.h
|
||||||
models/airportlistmodel.cpp
|
|
||||||
models/airportlistmodel.h
|
|
||||||
models/allmodelcontainers.h
|
models/allmodelcontainers.h
|
||||||
models/allmodels.h
|
models/allmodels.h
|
||||||
models/applicationinfolistmodel.cpp
|
models/applicationinfolistmodel.cpp
|
||||||
@@ -818,8 +816,6 @@ add_library(gui SHARED
|
|||||||
views/aircraftsituationview.h
|
views/aircraftsituationview.h
|
||||||
views/airlineicaoview.cpp
|
views/airlineicaoview.cpp
|
||||||
views/airlineicaoview.h
|
views/airlineicaoview.h
|
||||||
views/airportview.cpp
|
|
||||||
views/airportview.h
|
|
||||||
views/applicationinfoview.cpp
|
views/applicationinfoview.cpp
|
||||||
views/applicationinfoview.h
|
views/applicationinfoview.h
|
||||||
views/atcstationtreeview.cpp
|
views/atcstationtreeview.cpp
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
#include "gui/guiutility.h"
|
#include "gui/guiutility.h"
|
||||||
#include "gui/infoarea.h"
|
#include "gui/infoarea.h"
|
||||||
#include "gui/models/simulatedaircraftlistmodel.h"
|
#include "gui/models/simulatedaircraftlistmodel.h"
|
||||||
#include "gui/views/airportview.h"
|
|
||||||
#include "gui/views/simulatedaircraftview.h"
|
#include "gui/views/simulatedaircraftview.h"
|
||||||
#include "gui/views/viewbase.h"
|
#include "gui/views/viewbase.h"
|
||||||
#include "misc/network/fsdsetup.h"
|
#include "misc/network/fsdsetup.h"
|
||||||
@@ -46,7 +45,6 @@ namespace swift::gui::components
|
|||||||
this->setCurrentIndex(0);
|
this->setCurrentIndex(0);
|
||||||
this->tabBar()->setExpanding(false);
|
this->tabBar()->setExpanding(false);
|
||||||
this->tabBar()->setUsesScrollButtons(true);
|
this->tabBar()->setUsesScrollButtons(true);
|
||||||
ui->tvp_AirportsInRange->setResizeMode(CAirportView::ResizingOnce);
|
|
||||||
ui->tvp_AircraftInRange->setAircraftMode(CSimulatedAircraftListModel::NetworkMode);
|
ui->tvp_AircraftInRange->setAircraftMode(CSimulatedAircraftListModel::NetworkMode);
|
||||||
ui->tvp_AircraftInRange->configureMenu(true, true, false, true, true, true);
|
ui->tvp_AircraftInRange->configureMenu(true, true, false, true, true, true);
|
||||||
|
|
||||||
@@ -54,8 +52,6 @@ namespace swift::gui::components
|
|||||||
&CAircraftComponent::onRowCountChanged);
|
&CAircraftComponent::onRowCountChanged);
|
||||||
connect(ui->tvp_AircraftInRange, &CSimulatedAircraftView::requestTextMessageWidget, this,
|
connect(ui->tvp_AircraftInRange, &CSimulatedAircraftView::requestTextMessageWidget, this,
|
||||||
&CAircraftComponent::requestTextMessageWidget);
|
&CAircraftComponent::requestTextMessageWidget);
|
||||||
connect(ui->tvp_AirportsInRange, &CSimulatedAircraftView::modelDataChangedDigest, this,
|
|
||||||
&CAircraftComponent::onRowCountChanged);
|
|
||||||
connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this,
|
connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this,
|
||||||
&CAircraftComponent::onConnectionStatusChanged, Qt::QueuedConnection);
|
&CAircraftComponent::onConnectionStatusChanged, Qt::QueuedConnection);
|
||||||
connect(sGui->getIContextOwnAircraft(), &IContextOwnAircraft::movedAircraft, this,
|
connect(sGui->getIContextOwnAircraft(), &IContextOwnAircraft::movedAircraft, this,
|
||||||
@@ -74,12 +70,6 @@ namespace swift::gui::components
|
|||||||
return ui->tvp_AircraftInRange->rowCount();
|
return ui->tvp_AircraftInRange->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CAircraftComponent::countAirportsInRangeInView() const
|
|
||||||
{
|
|
||||||
Q_ASSERT(ui->tvp_AirportsInRange);
|
|
||||||
return ui->tvp_AirportsInRange->rowCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CAircraftComponent::setParentDockWidgetInfoArea(CDockWidgetInfoArea *parentDockableWidget)
|
bool CAircraftComponent::setParentDockWidgetInfoArea(CDockWidgetInfoArea *parentDockableWidget)
|
||||||
{
|
{
|
||||||
CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea(parentDockableWidget);
|
CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea(parentDockableWidget);
|
||||||
@@ -103,16 +93,6 @@ namespace swift::gui::components
|
|||||||
ui->tvp_AircraftInRange->updateContainerMaybeAsync(sGui->getIContextNetwork()->getAircraftInRange());
|
ui->tvp_AircraftInRange->updateContainerMaybeAsync(sGui->getIContextNetwork()->getAircraftInRange());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sGui->getIContextSimulator()->getSimulatorStatus() > 0)
|
|
||||||
{
|
|
||||||
const bool visible = (this->isVisibleWidget() && this->currentWidget() == ui->tb_AirportsInRange);
|
|
||||||
const bool counter = ((m_updateCounter % 5) == 0); // less frequent than aircraft
|
|
||||||
if (this->countAirportsInRangeInView() < 1 || (visible && counter))
|
|
||||||
{
|
|
||||||
ui->tvp_AirportsInRange->updateContainerMaybeAsync(
|
|
||||||
sGui->getIContextSimulator()->getAirportsInRange(true));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_updateCounter++;
|
m_updateCounter++;
|
||||||
}
|
}
|
||||||
@@ -127,7 +107,6 @@ namespace swift::gui::components
|
|||||||
{
|
{
|
||||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextNetwork() || !sGui->getIContextSimulator()) { return; }
|
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextNetwork() || !sGui->getIContextSimulator()) { return; }
|
||||||
ui->tvp_AircraftInRange->updateContainerMaybeAsync(sGui->getIContextNetwork()->getAircraftInRange());
|
ui->tvp_AircraftInRange->updateContainerMaybeAsync(sGui->getIContextNetwork()->getAircraftInRange());
|
||||||
ui->tvp_AirportsInRange->updateContainerMaybeAsync(sGui->getIContextSimulator()->getAirportsInRange(true));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAircraftComponent::onInfoAreaTabBarChanged(int index)
|
void CAircraftComponent::onInfoAreaTabBarChanged(int index)
|
||||||
@@ -151,13 +130,8 @@ namespace swift::gui::components
|
|||||||
Q_UNUSED(count)
|
Q_UNUSED(count)
|
||||||
Q_UNUSED(withFilter)
|
Q_UNUSED(withFilter)
|
||||||
const int ac = this->indexOf(ui->tb_AircraftInRange);
|
const int ac = this->indexOf(ui->tb_AircraftInRange);
|
||||||
const int ap = this->indexOf(ui->tb_AirportsInRange);
|
|
||||||
QString acs = this->tabBar()->tabText(ac);
|
QString acs = this->tabBar()->tabText(ac);
|
||||||
QString aps = this->tabBar()->tabText(ap);
|
|
||||||
acs = CGuiUtility::replaceTabCountValue(acs, this->countAircraftInView());
|
acs = CGuiUtility::replaceTabCountValue(acs, this->countAircraftInView());
|
||||||
aps = CGuiUtility::replaceTabCountValue(aps, this->countAirportsInRangeInView());
|
|
||||||
this->tabBar()->setTabText(ac, acs);
|
|
||||||
this->tabBar()->setTabText(ap, aps);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAircraftComponent::onConnectionStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to)
|
void CAircraftComponent::onConnectionStatusChanged(const CConnectionStatus &from, const CConnectionStatus &to)
|
||||||
|
|||||||
@@ -61,9 +61,6 @@ namespace swift::gui
|
|||||||
//! Aircraft in range
|
//! Aircraft in range
|
||||||
int countAircraftInView() const;
|
int countAircraftInView() const;
|
||||||
|
|
||||||
//! Airports in range
|
|
||||||
int countAirportsInRangeInView() const;
|
|
||||||
|
|
||||||
//! \copydoc CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea
|
//! \copydoc CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea
|
||||||
virtual bool setParentDockWidgetInfoArea(swift::gui::CDockWidgetInfoArea *parentDockableWidget) override;
|
virtual bool setParentDockWidgetInfoArea(swift::gui::CDockWidgetInfoArea *parentDockableWidget) override;
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,6 @@
|
|||||||
<height>300</height>
|
<height>300</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Airports in range</string>
|
|
||||||
</property>
|
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -51,41 +48,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tb_AirportsInRange">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Airports in range</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="vl_AirportsInRange">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="swift::gui::views::CAirportView" name="tvp_AirportsInRange">
|
|
||||||
<property name="selectionMode">
|
|
||||||
<enum>QAbstractItemView::NoSelection</enum>
|
|
||||||
</property>
|
|
||||||
<property name="selectionBehavior">
|
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
|
||||||
</property>
|
|
||||||
<attribute name="verticalHeaderVisible">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
@@ -93,11 +55,6 @@
|
|||||||
<extends>QTableView</extends>
|
<extends>QTableView</extends>
|
||||||
<header>gui/views/simulatedaircraftview.h</header>
|
<header>gui/views/simulatedaircraftview.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
|
||||||
<class>swift::gui::views::CAirportView</class>
|
|
||||||
<extends>QTableView</extends>
|
|
||||||
<header>gui/views/airportview.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
|
||||||
|
|
||||||
#include "gui/models/airportlistmodel.h"
|
|
||||||
|
|
||||||
#include <Qt>
|
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
#include "gui/models/columnformatters.h"
|
|
||||||
#include "gui/models/columns.h"
|
|
||||||
#include "misc/geo/coordinategeodetic.h"
|
|
||||||
#include "misc/pq/length.h"
|
|
||||||
#include "misc/pq/units.h"
|
|
||||||
|
|
||||||
using namespace swift::misc::aviation;
|
|
||||||
using namespace swift::misc::geo;
|
|
||||||
using namespace swift::misc::physical_quantities;
|
|
||||||
|
|
||||||
namespace swift::gui::models
|
|
||||||
{
|
|
||||||
CAirportListModel::CAirportListModel(QObject *parent) : CListModelBase("AirportListModel", parent)
|
|
||||||
{
|
|
||||||
m_columns.addColumn(CColumn::standardValueObject("ICAO", CAirport::IndexIcao));
|
|
||||||
m_columns.addColumn(CColumn("distance", CAirport::IndexRelativeDistance, new CAirspaceDistanceFormatter()));
|
|
||||||
m_columns.addColumn(CColumn("bearing", CAirport::IndexRelativeBearing, new CAngleDegreeFormatter()));
|
|
||||||
m_columns.addColumn(CColumn::standardString("name", CAirport::IndexDescriptiveName));
|
|
||||||
m_columns.addColumn(CColumn("elevation", CAirport::IndexElevation, new CAltitudeFormatter()));
|
|
||||||
m_columns.addColumn(CColumn("latitude", CAirport::IndexLatitude, new CLatLonFormatter()));
|
|
||||||
m_columns.addColumn(CColumn("longitude", CAirport::IndexLongitude, new CLatLonFormatter()));
|
|
||||||
|
|
||||||
// default sort order
|
|
||||||
this->setSortColumnByPropertyIndex(CAirport::IndexRelativeDistance);
|
|
||||||
m_sortOrder = Qt::AscendingOrder;
|
|
||||||
|
|
||||||
// force strings for translation in resource files
|
|
||||||
(void)QT_TRANSLATE_NOOP("ModelAirportList", "ICAO");
|
|
||||||
(void)QT_TRANSLATE_NOOP("ModelAirportList", "distance");
|
|
||||||
(void)QT_TRANSLATE_NOOP("ModelAirportList", "name");
|
|
||||||
(void)QT_TRANSLATE_NOOP("ModelAirportList", "elevation");
|
|
||||||
(void)QT_TRANSLATE_NOOP("ModelAirportList", "bearing");
|
|
||||||
}
|
|
||||||
} // namespace swift::gui::models
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
|
||||||
|
|
||||||
//! \file
|
|
||||||
|
|
||||||
#ifndef SWIFT_GUI_MODELS_AIRPORTLISTMODEL_H
|
|
||||||
#define SWIFT_GUI_MODELS_AIRPORTLISTMODEL_H
|
|
||||||
|
|
||||||
#include "gui/models/listmodelbase.h"
|
|
||||||
#include "gui/swiftguiexport.h"
|
|
||||||
#include "misc/aviation/airportlist.h"
|
|
||||||
|
|
||||||
class QObject;
|
|
||||||
|
|
||||||
namespace swift::gui::models
|
|
||||||
{
|
|
||||||
//! Airport list model
|
|
||||||
class SWIFT_GUI_EXPORT CAirportListModel : public CListModelBase<swift::misc::aviation::CAirportList, true>
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
//! Constructor
|
|
||||||
explicit CAirportListModel(QObject *parent = nullptr);
|
|
||||||
|
|
||||||
//! Destructor
|
|
||||||
virtual ~CAirportListModel() override {}
|
|
||||||
};
|
|
||||||
} // namespace swift::gui::models
|
|
||||||
#endif // SWIFT_GUI_MODELS_AIRPORTLISTMODEL_H
|
|
||||||
@@ -12,7 +12,6 @@
|
|||||||
#include "gui/models/aircraftsituationchangelistmodel.h"
|
#include "gui/models/aircraftsituationchangelistmodel.h"
|
||||||
#include "gui/models/aircraftsituationlistmodel.h"
|
#include "gui/models/aircraftsituationlistmodel.h"
|
||||||
#include "gui/models/airlineicaolistmodel.h"
|
#include "gui/models/airlineicaolistmodel.h"
|
||||||
#include "gui/models/airportlistmodel.h"
|
|
||||||
#include "gui/models/applicationinfolistmodel.h"
|
#include "gui/models/applicationinfolistmodel.h"
|
||||||
#include "gui/models/atcstationlistmodel.h"
|
#include "gui/models/atcstationlistmodel.h"
|
||||||
#include "gui/models/audiodeviceinfolistmodel.h"
|
#include "gui/models/audiodeviceinfolistmodel.h"
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
|
||||||
|
|
||||||
#include "gui/views/airportview.h"
|
|
||||||
|
|
||||||
#include "gui/models/airportlistmodel.h"
|
|
||||||
|
|
||||||
using namespace swift::misc;
|
|
||||||
using namespace swift::gui::models;
|
|
||||||
|
|
||||||
namespace swift::gui::views
|
|
||||||
{
|
|
||||||
CAirportView::CAirportView(QWidget *parent) : CViewBase(parent) { this->standardInit(new CAirportListModel(this)); }
|
|
||||||
} // namespace swift::gui::views
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
|
||||||
|
|
||||||
//! \file
|
|
||||||
|
|
||||||
#ifndef SWIFT_GUI_VIEWS_AIRPORTVIEW_H
|
|
||||||
#define SWIFT_GUI_VIEWS_AIRPORTVIEW_H
|
|
||||||
|
|
||||||
#include "gui/models/airportlistmodel.h"
|
|
||||||
#include "gui/swiftguiexport.h"
|
|
||||||
#include "gui/views/viewbase.h"
|
|
||||||
|
|
||||||
namespace swift::gui::views
|
|
||||||
{
|
|
||||||
//! Airports view
|
|
||||||
class SWIFT_GUI_EXPORT CAirportView : public CViewBase<models::CAirportListModel>
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
//! Constructor
|
|
||||||
explicit CAirportView(QWidget *parent = nullptr);
|
|
||||||
};
|
|
||||||
} // namespace swift::gui::views
|
|
||||||
|
|
||||||
#endif // SWIFT_GUI_VIEWS_AIRPORTVIEW_H
|
|
||||||
@@ -11,7 +11,6 @@ namespace swift::gui::views
|
|||||||
template class CViewBase<swift::gui::models::CAirlineIcaoCodeListModel>;
|
template class CViewBase<swift::gui::models::CAirlineIcaoCodeListModel>;
|
||||||
template class CViewBase<swift::gui::models::CAircraftCategoryListModel>;
|
template class CViewBase<swift::gui::models::CAircraftCategoryListModel>;
|
||||||
template class CViewBase<swift::gui::models::CAircraftIcaoCodeListModel>;
|
template class CViewBase<swift::gui::models::CAircraftIcaoCodeListModel>;
|
||||||
template class CViewBase<swift::gui::models::CAirportListModel>;
|
|
||||||
template class CViewBase<swift::gui::models::CAtcStationListModel>;
|
template class CViewBase<swift::gui::models::CAtcStationListModel>;
|
||||||
template class CViewBase<swift::gui::models::CLiveryListModel>;
|
template class CViewBase<swift::gui::models::CLiveryListModel>;
|
||||||
} // namespace swift::gui::views
|
} // namespace swift::gui::views
|
||||||
|
|||||||
@@ -103,10 +103,6 @@ namespace swift::simplugin::flightgear
|
|||||||
const QString &icao, const QString &modelString, const QString &name,
|
const QString &icao, const QString &modelString, const QString &name,
|
||||||
const QString &description);
|
const QString &description);
|
||||||
|
|
||||||
//! Airports in range are updated
|
|
||||||
void airportsInRangeUpdated(const QStringList &icaoCodes, const QStringList &names, const QList<double> &lats,
|
|
||||||
const QList<double> &lons, const QList<double> &alts);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//! Get Flightgear version number
|
//! Get Flightgear version number
|
||||||
int getVersionNumber();
|
int getVersionNumber();
|
||||||
|
|||||||
@@ -356,8 +356,6 @@ namespace swift::simplugin::flightgear
|
|||||||
setSimulatorDetails("Flightgear", {}, "");
|
setSimulatorDetails("Flightgear", {}, "");
|
||||||
connect(m_serviceProxy, &CFGSwiftBusServiceProxy::aircraftModelChanged, this,
|
connect(m_serviceProxy, &CFGSwiftBusServiceProxy::aircraftModelChanged, this,
|
||||||
&CSimulatorFlightgear::emitOwnAircraftModelChanged);
|
&CSimulatorFlightgear::emitOwnAircraftModelChanged);
|
||||||
connect(m_serviceProxy, &CFGSwiftBusServiceProxy::airportsInRangeUpdated, this,
|
|
||||||
&CSimulatorFlightgear::setAirportsInRange);
|
|
||||||
connect(m_trafficProxy, &CFGSwiftBusTrafficProxy::simFrame, this, &CSimulatorFlightgear::updateRemoteAircraft);
|
connect(m_trafficProxy, &CFGSwiftBusTrafficProxy::simFrame, this, &CSimulatorFlightgear::updateRemoteAircraft);
|
||||||
connect(m_trafficProxy, &CFGSwiftBusTrafficProxy::remoteAircraftAdded, this,
|
connect(m_trafficProxy, &CFGSwiftBusTrafficProxy::remoteAircraftAdded, this,
|
||||||
&CSimulatorFlightgear::onRemoteAircraftAdded);
|
&CSimulatorFlightgear::onRemoteAircraftAdded);
|
||||||
@@ -432,36 +430,6 @@ namespace swift::simplugin::flightgear
|
|||||||
m_serviceProxy->addTextMessage(message.getSenderCallsign().toQString() + ": " + message.getMessage());
|
m_serviceProxy->addTextMessage(message.getSenderCallsign().toQString() + ": " + message.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorFlightgear::setAirportsInRange(const QStringList &icaos, const QStringList &names,
|
|
||||||
const CSequence<double> &lats, const CSequence<double> &lons,
|
|
||||||
const CSequence<double> &alts)
|
|
||||||
{
|
|
||||||
//! \todo restrict to maxAirportsInRange()
|
|
||||||
m_airportsInRange.clear();
|
|
||||||
auto icaoIt = icaos.begin();
|
|
||||||
auto nameIt = names.begin();
|
|
||||||
auto latIt = lats.begin();
|
|
||||||
auto lonIt = lons.begin();
|
|
||||||
auto altIt = alts.begin();
|
|
||||||
for (; icaoIt != icaos.end() && nameIt != names.end() && latIt != lats.end() && lonIt != lons.end() &&
|
|
||||||
altIt != alts.end();
|
|
||||||
++icaoIt, ++nameIt, ++latIt, ++lonIt, ++altIt)
|
|
||||||
{
|
|
||||||
m_airportsInRange.push_back({ *icaoIt,
|
|
||||||
{ CLatitude(*latIt, CAngleUnit::deg()), CLongitude(*lonIt, CAngleUnit::deg()),
|
|
||||||
CAltitude(*altIt, CLengthUnit::m()) },
|
|
||||||
*nameIt });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CAirportList CSimulatorFlightgear::getAirportsInRange(bool recalculateDistance) const
|
|
||||||
{
|
|
||||||
if (!recalculateDistance) { return m_airportsInRange; }
|
|
||||||
CAirportList airports(m_airportsInRange);
|
|
||||||
airports.calculcateAndUpdateRelativeDistanceAndBearing(this->getOwnAircraftPosition());
|
|
||||||
return airports;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSimulatorFlightgear::isPhysicallyRenderedAircraft(const CCallsign &callsign) const
|
bool CSimulatorFlightgear::isPhysicallyRenderedAircraft(const CCallsign &callsign) const
|
||||||
{
|
{
|
||||||
return m_flightgearAircraftObjects.contains(callsign);
|
return m_flightgearAircraftObjects.contains(callsign);
|
||||||
|
|||||||
@@ -131,7 +131,6 @@ namespace swift::simplugin::flightgear
|
|||||||
const swift::misc::CIdentifier &originator) override;
|
const swift::misc::CIdentifier &originator) override;
|
||||||
virtual void displayStatusMessage(const swift::misc::CStatusMessage &message) const override;
|
virtual void displayStatusMessage(const swift::misc::CStatusMessage &message) const override;
|
||||||
virtual void displayTextMessage(const swift::misc::network::CTextMessage &message) const override;
|
virtual void displayTextMessage(const swift::misc::network::CTextMessage &message) const override;
|
||||||
virtual swift::misc::aviation::CAirportList getAirportsInRange(bool recalculateDistance) const override;
|
|
||||||
virtual bool isPhysicallyRenderedAircraft(const swift::misc::aviation::CCallsign &callsign) const override;
|
virtual bool isPhysicallyRenderedAircraft(const swift::misc::aviation::CCallsign &callsign) const override;
|
||||||
virtual swift::misc::aviation::CCallsignSet physicallyRenderedAircraft() const override;
|
virtual swift::misc::aviation::CCallsignSet physicallyRenderedAircraft() const override;
|
||||||
virtual void unload() override;
|
virtual void unload() override;
|
||||||
@@ -171,9 +170,6 @@ namespace swift::simplugin::flightgear
|
|||||||
|
|
||||||
using QDoubleList = QList<double>;
|
using QDoubleList = QList<double>;
|
||||||
|
|
||||||
void setAirportsInRange(const QStringList &icaoCodes, const QStringList &names,
|
|
||||||
const swift::misc::CSequence<double> &lats, const swift::misc::CSequence<double> &lons,
|
|
||||||
const swift::misc::CSequence<double> &alts);
|
|
||||||
void emitOwnAircraftModelChanged(const QString &path, const QString &filename, const QString &livery,
|
void emitOwnAircraftModelChanged(const QString &path, const QString &filename, const QString &livery,
|
||||||
const QString &icao, const QString &modelString, const QString &name,
|
const QString &icao, const QString &modelString, const QString &name,
|
||||||
const QString &description);
|
const QString &description);
|
||||||
@@ -234,7 +230,6 @@ namespace swift::simplugin::flightgear
|
|||||||
QTimer m_slowTimer;
|
QTimer m_slowTimer;
|
||||||
QTimer m_airportUpdater;
|
QTimer m_airportUpdater;
|
||||||
QTimer m_pendingAddedTimer;
|
QTimer m_pendingAddedTimer;
|
||||||
swift::misc::aviation::CAirportList m_airportsInRange; //!< aiports in range of own aircraft
|
|
||||||
swift::misc::CData<swift::misc::simulation::data::TModelSetCacheFG> m_modelSet {
|
swift::misc::CData<swift::misc::simulation::data::TModelSetCacheFG> m_modelSet {
|
||||||
this
|
this
|
||||||
}; //!< Flightgear model set
|
}; //!< Flightgear model set
|
||||||
|
|||||||
@@ -58,25 +58,4 @@ namespace swift::simplugin::fscommon
|
|||||||
this->emitSimulatorCombinedStatus();
|
this->emitSimulatorCombinedStatus();
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAirportList CSimulatorFsCommon::getAirportsInRange(bool recalculateDistance) const
|
|
||||||
{
|
|
||||||
if (!m_airportsInRangeFromSimulator.isEmpty())
|
|
||||||
{
|
|
||||||
CAirportList airports = m_airportsInRangeFromSimulator;
|
|
||||||
if (recalculateDistance)
|
|
||||||
{
|
|
||||||
airports.calculcateAndUpdateRelativeDistanceAndBearing(this->getOwnAircraftPosition());
|
|
||||||
}
|
|
||||||
return airports;
|
|
||||||
}
|
|
||||||
return ISimulator::getAirportsInRange(recalculateDistance);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSimulatorFsCommon::onSwiftDbAirportsRead()
|
|
||||||
{
|
|
||||||
const CAirportList webServiceAirports = this->getWebServiceAirports();
|
|
||||||
if (!webServiceAirports.isEmpty()) { m_airportsInRangeFromSimulator.updateMissingParts(webServiceAirports); }
|
|
||||||
ISimulator::onSwiftDbAirportsRead();
|
|
||||||
}
|
|
||||||
} // namespace swift::simplugin::fscommon
|
} // namespace swift::simplugin::fscommon
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ namespace swift::simplugin::fscommon
|
|||||||
// ---------------------- ISimulator ------------------
|
// ---------------------- ISimulator ------------------
|
||||||
virtual bool disconnectFrom() override;
|
virtual bool disconnectFrom() override;
|
||||||
virtual bool isPaused() const override { return m_simPaused; }
|
virtual bool isPaused() const override { return m_simPaused; }
|
||||||
virtual swift::misc::aviation::CAirportList getAirportsInRange(bool recalculateDistance) const override;
|
|
||||||
// ---------------------- ISimulator ------------------
|
// ---------------------- ISimulator ------------------
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -45,9 +44,6 @@ namespace swift::simplugin::fscommon
|
|||||||
//! Init the internal objects
|
//! Init the internal objects
|
||||||
virtual void initSimulatorInternals() override;
|
virtual void initSimulatorInternals() override;
|
||||||
|
|
||||||
//! When swift DB data are read
|
|
||||||
virtual void onSwiftDbAirportsRead() override;
|
|
||||||
|
|
||||||
//! \copydoc swift::core::ISimulator::reset
|
//! \copydoc swift::core::ISimulator::reset
|
||||||
virtual void reset() override;
|
virtual void reset() override;
|
||||||
|
|
||||||
@@ -58,7 +54,6 @@ namespace swift::simplugin::fscommon
|
|||||||
0; //!< own aircraft updates, even with 50 updates/sec long enough even for 32bit
|
0; //!< own aircraft updates, even with 50 updates/sec long enough even for 32bit
|
||||||
int m_skipCockpitUpdateCycles = 0; //!< skip some update cycles to allow changes in simulator cockpit to be set
|
int m_skipCockpitUpdateCycles = 0; //!< skip some update cycles to allow changes in simulator cockpit to be set
|
||||||
bool m_simPaused = false; //!< simulator paused?
|
bool m_simPaused = false; //!< simulator paused?
|
||||||
swift::misc::aviation::CAirportList m_airportsInRangeFromSimulator; //!< airports in range of own aircraft
|
|
||||||
|
|
||||||
// cockpit as set in SIM
|
// cockpit as set in SIM
|
||||||
swift::misc::aviation::CComSystem m_simCom1; //!< cockpit COM1 state in simulator
|
swift::misc::aviation::CComSystem m_simCom1; //!< cockpit COM1 state in simulator
|
||||||
|
|||||||
@@ -2211,39 +2211,6 @@ namespace swift::simplugin::fsxcommon
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorFsxCommon::triggerUpdateAirports(const CAirportList &airports)
|
|
||||||
{
|
|
||||||
if (this->isShuttingDownOrDisconnected()) { return; }
|
|
||||||
if (airports.isEmpty()) { return; }
|
|
||||||
QPointer<CSimulatorFsxCommon> myself(this);
|
|
||||||
QTimer::singleShot(0, this, [=] {
|
|
||||||
if (!myself) { return; }
|
|
||||||
this->updateAirports(airports);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSimulatorFsxCommon::updateAirports(const CAirportList &airports)
|
|
||||||
{
|
|
||||||
if (airports.isEmpty()) { return; }
|
|
||||||
|
|
||||||
static const CLength maxDistance(200.0, CLengthUnit::NM());
|
|
||||||
const CCoordinateGeodetic posAircraft(this->getOwnAircraftPosition());
|
|
||||||
|
|
||||||
for (const CAirport &airport : airports)
|
|
||||||
{
|
|
||||||
CAirport consolidatedAirport(airport);
|
|
||||||
const CLength d = consolidatedAirport.calculcateAndUpdateRelativeDistanceAndBearing(posAircraft);
|
|
||||||
if (d > maxDistance) { continue; }
|
|
||||||
consolidatedAirport.updateMissingParts(this->getWebServiceAirport(airport.getIcao()));
|
|
||||||
m_airportsInRangeFromSimulator.replaceOrAddByIcao(consolidatedAirport);
|
|
||||||
if (m_airportsInRangeFromSimulator.size() > this->maxAirportsInRange())
|
|
||||||
{
|
|
||||||
m_airportsInRangeFromSimulator.sortByDistanceToReferencePosition();
|
|
||||||
m_airportsInRangeFromSimulator.truncate(this->maxAirportsInRange());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSimulatorFsxCommon::sendRemoteAircraftPartsToSimulator(const CSimConnectObject &simObject,
|
bool CSimulatorFsxCommon::sendRemoteAircraftPartsToSimulator(const CSimConnectObject &simObject,
|
||||||
const CAircraftParts &parts)
|
const CAircraftParts &parts)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -461,12 +461,6 @@ namespace swift::simplugin::fsxcommon
|
|||||||
bool updateRemoteAircraftParts(const CSimConnectObject &simObject,
|
bool updateRemoteAircraftParts(const CSimConnectObject &simObject,
|
||||||
const swift::misc::simulation::CInterpolationResult &result, bool forcedUpdate);
|
const swift::misc::simulation::CInterpolationResult &result, bool forcedUpdate);
|
||||||
|
|
||||||
//! Calling CSimulatorFsxCommon::updateAirports
|
|
||||||
void triggerUpdateAirports(const swift::misc::aviation::CAirportList &airports);
|
|
||||||
|
|
||||||
//! Update airports from simulator
|
|
||||||
void updateAirports(const swift::misc::aviation::CAirportList &airports);
|
|
||||||
|
|
||||||
//! Send parts to simulator
|
//! Send parts to simulator
|
||||||
//! \remark does not send if there is no change
|
//! \remark does not send if there is no change
|
||||||
bool sendRemoteAircraftPartsToSimulator(const CSimConnectObject &simObject,
|
bool sendRemoteAircraftPartsToSimulator(const CSimConnectObject &simObject,
|
||||||
|
|||||||
@@ -368,32 +368,6 @@ namespace swift::simplugin::fsxcommon
|
|||||||
}
|
}
|
||||||
break; // SIMCONNECT_RECV_ID_SIMOBJECT_DATA
|
break; // SIMCONNECT_RECV_ID_SIMOBJECT_DATA
|
||||||
}
|
}
|
||||||
case SIMCONNECT_RECV_ID_AIRPORT_LIST:
|
|
||||||
{
|
|
||||||
const SIMCONNECT_RECV_AIRPORT_LIST *pAirportList = static_cast<SIMCONNECT_RECV_AIRPORT_LIST *>(pData);
|
|
||||||
CAirportList simAirports;
|
|
||||||
for (unsigned i = 0; i < pAirportList->dwArraySize; ++i)
|
|
||||||
{
|
|
||||||
const SIMCONNECT_DATA_FACILITY_AIRPORT *pFacilityAirport = pAirportList->rgData + i;
|
|
||||||
if (!pFacilityAirport) { break; }
|
|
||||||
const QString icao(pFacilityAirport->Icao);
|
|
||||||
if (icao.isEmpty()) { continue; } // airfield without ICAO code
|
|
||||||
if (!CAirportIcaoCode::isValidIcaoDesignator(icao, true))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
} // tiny airfields/strips in simulator
|
|
||||||
if (CAirportIcaoCode::containsNumbers(icao)) { continue; } // tiny airfields/strips in simulator
|
|
||||||
const CCoordinateGeodetic pos(pFacilityAirport->Latitude, pFacilityAirport->Longitude,
|
|
||||||
pFacilityAirport->Altitude);
|
|
||||||
const CAirport airport(CAirportIcaoCode(icao), pos);
|
|
||||||
simAirports.push_back(airport);
|
|
||||||
}
|
|
||||||
if (!simAirports.isEmpty())
|
|
||||||
{
|
|
||||||
simulatorFsxP3D->triggerUpdateAirports(simAirports); // real "work" outside SimConnectProc
|
|
||||||
}
|
|
||||||
break; // SIMCONNECT_RECV_ID_AIRPORT_LIST
|
|
||||||
}
|
|
||||||
case SIMCONNECT_RECV_ID_CLIENT_DATA:
|
case SIMCONNECT_RECV_ID_CLIENT_DATA:
|
||||||
{
|
{
|
||||||
if (!simulatorFsxP3D->m_useSbOffsets) { break; }
|
if (!simulatorFsxP3D->m_useSbOffsets) { break; }
|
||||||
|
|||||||
@@ -498,8 +498,6 @@ namespace swift::simplugin::xplane
|
|||||||
setSimulatorDetails("X-Plane", {}, xplaneVersion);
|
setSimulatorDetails("X-Plane", {}, xplaneVersion);
|
||||||
connect(m_serviceProxy, &CXSwiftBusServiceProxy::aircraftModelChanged, this,
|
connect(m_serviceProxy, &CXSwiftBusServiceProxy::aircraftModelChanged, this,
|
||||||
&CSimulatorXPlane::emitOwnAircraftModelChanged);
|
&CSimulatorXPlane::emitOwnAircraftModelChanged);
|
||||||
connect(m_serviceProxy, &CXSwiftBusServiceProxy::airportsInRangeUpdated, this,
|
|
||||||
&CSimulatorXPlane::setAirportsInRange);
|
|
||||||
m_serviceProxy->updateAirportsInRange();
|
m_serviceProxy->updateAirportsInRange();
|
||||||
connect(m_trafficProxy, &CXSwiftBusTrafficProxy::simFrame, this, &CSimulatorXPlane::updateRemoteAircraft);
|
connect(m_trafficProxy, &CXSwiftBusTrafficProxy::simFrame, this, &CSimulatorXPlane::updateRemoteAircraft);
|
||||||
connect(m_trafficProxy, &CXSwiftBusTrafficProxy::remoteAircraftAdded, this,
|
connect(m_trafficProxy, &CXSwiftBusTrafficProxy::remoteAircraftAdded, this,
|
||||||
@@ -606,36 +604,6 @@ namespace swift::simplugin::xplane
|
|||||||
color.redF(), color.greenF(), color.blueF());
|
color.redF(), color.greenF(), color.blueF());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSimulatorXPlane::setAirportsInRange(const QStringList &icaos, const QStringList &names,
|
|
||||||
const CSequence<double> &lats, const CSequence<double> &lons,
|
|
||||||
const CSequence<double> &alts)
|
|
||||||
{
|
|
||||||
//! \todo restrict to maxAirportsInRange()
|
|
||||||
m_airportsInRange.clear();
|
|
||||||
auto icaoIt = icaos.begin();
|
|
||||||
auto nameIt = names.begin();
|
|
||||||
auto latIt = lats.begin();
|
|
||||||
auto lonIt = lons.begin();
|
|
||||||
auto altIt = alts.begin();
|
|
||||||
for (; icaoIt != icaos.end() && nameIt != names.end() && latIt != lats.end() && lonIt != lons.end() &&
|
|
||||||
altIt != alts.end();
|
|
||||||
++icaoIt, ++nameIt, ++latIt, ++lonIt, ++altIt)
|
|
||||||
{
|
|
||||||
m_airportsInRange.push_back({ *icaoIt,
|
|
||||||
{ CLatitude(*latIt, CAngleUnit::deg()), CLongitude(*lonIt, CAngleUnit::deg()),
|
|
||||||
CAltitude(*altIt, CLengthUnit::m()) },
|
|
||||||
*nameIt });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CAirportList CSimulatorXPlane::getAirportsInRange(bool recalculateDistance) const
|
|
||||||
{
|
|
||||||
if (!recalculateDistance) { return m_airportsInRange; }
|
|
||||||
CAirportList airports(m_airportsInRange);
|
|
||||||
airports.calculcateAndUpdateRelativeDistanceAndBearing(this->getOwnAircraftPosition());
|
|
||||||
return airports;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSimulatorXPlane::isPhysicallyRenderedAircraft(const CCallsign &callsign) const
|
bool CSimulatorXPlane::isPhysicallyRenderedAircraft(const CCallsign &callsign) const
|
||||||
{
|
{
|
||||||
return m_xplaneAircraftObjects.contains(callsign);
|
return m_xplaneAircraftObjects.contains(callsign);
|
||||||
|
|||||||
@@ -135,7 +135,6 @@ namespace swift::simplugin::xplane
|
|||||||
const swift::misc::CIdentifier &originator) override;
|
const swift::misc::CIdentifier &originator) override;
|
||||||
virtual void displayStatusMessage(const swift::misc::CStatusMessage &message) const override;
|
virtual void displayStatusMessage(const swift::misc::CStatusMessage &message) const override;
|
||||||
virtual void displayTextMessage(const swift::misc::network::CTextMessage &message) const override;
|
virtual void displayTextMessage(const swift::misc::network::CTextMessage &message) const override;
|
||||||
virtual swift::misc::aviation::CAirportList getAirportsInRange(bool recalculateDistance) const override;
|
|
||||||
virtual bool isPhysicallyRenderedAircraft(const swift::misc::aviation::CCallsign &callsign) const override;
|
virtual bool isPhysicallyRenderedAircraft(const swift::misc::aviation::CCallsign &callsign) const override;
|
||||||
virtual swift::misc::aviation::CCallsignSet physicallyRenderedAircraft() const override;
|
virtual swift::misc::aviation::CCallsignSet physicallyRenderedAircraft() const override;
|
||||||
virtual bool followAircraft(const swift::misc::aviation::CCallsign &callsign) override;
|
virtual bool followAircraft(const swift::misc::aviation::CCallsign &callsign) override;
|
||||||
@@ -188,9 +187,6 @@ namespace swift::simplugin::xplane
|
|||||||
using QDoubleList = QList<double>;
|
using QDoubleList = QList<double>;
|
||||||
using QBoolList = QList<bool>;
|
using QBoolList = QList<bool>;
|
||||||
|
|
||||||
void setAirportsInRange(const QStringList &icaoCodes, const QStringList &names,
|
|
||||||
const swift::misc::CSequence<double> &lats, const swift::misc::CSequence<double> &lons,
|
|
||||||
const swift::misc::CSequence<double> &alts);
|
|
||||||
void emitOwnAircraftModelChanged(const QString &path, const QString &filename, const QString &livery,
|
void emitOwnAircraftModelChanged(const QString &path, const QString &filename, const QString &livery,
|
||||||
const QString &icao, const QString &modelString, const QString &name,
|
const QString &icao, const QString &modelString, const QString &name,
|
||||||
const QString &description);
|
const QString &description);
|
||||||
@@ -284,7 +280,6 @@ namespace swift::simplugin::xplane
|
|||||||
unsigned int m_fastTimerCalls = 0; //!< how often called
|
unsigned int m_fastTimerCalls = 0; //!< how often called
|
||||||
unsigned int m_slowTimerCalls = 0; //!< how often called
|
unsigned int m_slowTimerCalls = 0; //!< how often called
|
||||||
|
|
||||||
swift::misc::aviation::CAirportList m_airportsInRange; //!< aiports in range of own aircraft
|
|
||||||
CXPlaneMPAircraftObjects m_xplaneAircraftObjects; //!< XPlane multiplayer aircraft
|
CXPlaneMPAircraftObjects m_xplaneAircraftObjects; //!< XPlane multiplayer aircraft
|
||||||
|
|
||||||
swift::misc::simulation::CSimulatedAircraftList m_pendingToBeAddedAircraft; //!< aircraft to be added
|
swift::misc::simulation::CSimulatedAircraftList m_pendingToBeAddedAircraft; //!< aircraft to be added
|
||||||
|
|||||||
@@ -86,10 +86,6 @@ namespace swift::simplugin::xplane
|
|||||||
const QString &icao, const QString &modelString, const QString &name,
|
const QString &icao, const QString &modelString, const QString &name,
|
||||||
const QString &description);
|
const QString &description);
|
||||||
|
|
||||||
//! Airports in range are updated
|
|
||||||
void airportsInRangeUpdated(const QStringList &icaoCodes, const QStringList &names, const QList<double> &lats,
|
|
||||||
const QList<double> &lons, const QList<double> &alts);
|
|
||||||
|
|
||||||
//! Scenery was loaded
|
//! Scenery was loaded
|
||||||
void sceneryLoaded();
|
void sceneryLoaded();
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ add_library(xswiftbus SHARED
|
|||||||
menus.h
|
menus.h
|
||||||
messages.cpp
|
messages.cpp
|
||||||
messages.h
|
messages.h
|
||||||
navdatareference.cpp
|
|
||||||
navdatareference.h
|
|
||||||
plugin.cpp
|
plugin.cpp
|
||||||
plugin.h
|
plugin.h
|
||||||
service.cpp
|
service.cpp
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
|
||||||
|
|
||||||
//! \cond PRIVATE
|
|
||||||
|
|
||||||
#include "navdatareference.h"
|
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
namespace XSwiftBus
|
|
||||||
{
|
|
||||||
inline double degreeToRadian(double angle)
|
|
||||||
{
|
|
||||||
static const double PI = acos(-1);
|
|
||||||
return PI * angle / 180.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
double calculateGreatCircleDistance(const CNavDataReference &a, const CNavDataReference &b)
|
|
||||||
{
|
|
||||||
const static double c_earthRadiusKm = 6372.8;
|
|
||||||
|
|
||||||
const double latRad1 = degreeToRadian(a.latitude());
|
|
||||||
const double latRad2 = degreeToRadian(b.latitude());
|
|
||||||
const double lonRad1 = degreeToRadian(a.longitude());
|
|
||||||
const double lonRad2 = degreeToRadian(b.longitude());
|
|
||||||
|
|
||||||
const double diffLa = latRad2 - latRad1;
|
|
||||||
const double doffLo = lonRad2 - lonRad1;
|
|
||||||
|
|
||||||
const double computation = asin(
|
|
||||||
sqrt(sin(diffLa / 2) * sin(diffLa / 2) + cos(latRad1) * cos(latRad2) * sin(doffLo / 2) * sin(doffLo / 2)));
|
|
||||||
return 2 * c_earthRadiusKm * computation;
|
|
||||||
}
|
|
||||||
} // namespace XSwiftBus
|
|
||||||
|
|
||||||
//! \endcond
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
|
||||||
|
|
||||||
//! \file
|
|
||||||
|
|
||||||
#ifndef SWIFT_SIM_XSWIFTBUS_NAVDATAREFERENCE_H
|
|
||||||
#define SWIFT_SIM_XSWIFTBUS_NAVDATAREFERENCE_H
|
|
||||||
|
|
||||||
namespace XSwiftBus
|
|
||||||
{
|
|
||||||
//! Simplified version of CNavDataReference of \sa swift::misc::simulation::XPlane::CNavDataReference
|
|
||||||
class CNavDataReference
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
//! Default constructor
|
|
||||||
CNavDataReference() = default;
|
|
||||||
|
|
||||||
//! Constructor
|
|
||||||
CNavDataReference(int id, double latitudeDegrees, double longitudeDegrees)
|
|
||||||
: m_id(id), m_latitudeDegrees(latitudeDegrees), m_longitudeDegrees(longitudeDegrees)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//! \copydoc swift::misc::simulation::xplane::CNavDataReference::id
|
|
||||||
int id() const { return m_id; }
|
|
||||||
|
|
||||||
//! \copydoc swift::misc::simulation::xplane::CNavDataReference::latitude
|
|
||||||
double latitude() const { return m_latitudeDegrees; }
|
|
||||||
|
|
||||||
//! \copydoc swift::misc::simulation::xplane::CNavDataReference::longitude
|
|
||||||
double longitude() const { return m_longitudeDegrees; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
int m_id = 0;
|
|
||||||
double m_latitudeDegrees = 0.0;
|
|
||||||
double m_longitudeDegrees = 0.0;
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Free function to calculate great circle distance
|
|
||||||
double calculateGreatCircleDistance(const CNavDataReference &a, const CNavDataReference &b);
|
|
||||||
|
|
||||||
} // namespace XSwiftBus
|
|
||||||
|
|
||||||
#endif // SWIFT_SIM_XSWIFTBUS_NAVDATAREFERENCE_H
|
|
||||||
@@ -150,11 +150,7 @@ namespace XSwiftBus
|
|||||||
|
|
||||||
void CPlugin::onAircraftRepositioned()
|
void CPlugin::onAircraftRepositioned()
|
||||||
{
|
{
|
||||||
if (m_service)
|
if (m_service) { m_service->resetFrameTotals(); }
|
||||||
{
|
|
||||||
m_service->updateAirportsInRange();
|
|
||||||
m_service->resetFrameTotals();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugin::onSceneryLoaded()
|
void CPlugin::onSceneryLoaded()
|
||||||
|
|||||||
@@ -91,7 +91,6 @@ namespace XSwiftBus
|
|||||||
CService::CService(CSettingsProvider *settingsProvider)
|
CService::CService(CSettingsProvider *settingsProvider)
|
||||||
: CDBusObject(settingsProvider), m_framePeriodSampler(std::make_unique<FramePeriodSampler>())
|
: CDBusObject(settingsProvider), m_framePeriodSampler(std::make_unique<FramePeriodSampler>())
|
||||||
{
|
{
|
||||||
this->updateAirportsInRange();
|
|
||||||
this->updateMessageBoxFromSettings();
|
this->updateMessageBoxFromSettings();
|
||||||
m_framePeriodSampler->show();
|
m_framePeriodSampler->show();
|
||||||
}
|
}
|
||||||
@@ -259,42 +258,6 @@ namespace XSwiftBus
|
|||||||
if (w) { INFO_LOG("Written new config file"); }
|
if (w) { INFO_LOG("Written new config file"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void CService::readAirportsDatabase()
|
|
||||||
{
|
|
||||||
auto first = XPLMFindFirstNavAidOfType(xplm_Nav_Airport);
|
|
||||||
auto last = XPLMFindLastNavAidOfType(xplm_Nav_Airport);
|
|
||||||
if (first != XPLM_NAV_NOT_FOUND)
|
|
||||||
{
|
|
||||||
for (auto i = first; i <= last; ++i)
|
|
||||||
{
|
|
||||||
float lat, lon;
|
|
||||||
char icao[32];
|
|
||||||
XPLMGetNavAidInfo(i, nullptr, &lat, &lon, nullptr, nullptr, nullptr, icao, nullptr, nullptr);
|
|
||||||
if (icao[0] != 0) { m_airports.emplace_back(i, lat, lon); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CService::updateAirportsInRange()
|
|
||||||
{
|
|
||||||
if (m_airports.empty()) { readAirportsDatabase(); }
|
|
||||||
std::vector<std::string> icaos, names;
|
|
||||||
std::vector<double> lats, lons, alts;
|
|
||||||
std::vector<CNavDataReference> closestAirports = findClosestAirports(20, getLatitudeDeg(), getLongitudeDeg());
|
|
||||||
for (const auto &navref : closestAirports)
|
|
||||||
{
|
|
||||||
float lat, lon, alt;
|
|
||||||
char icao[32], name[256];
|
|
||||||
XPLMGetNavAidInfo(navref.id(), nullptr, &lat, &lon, &alt, nullptr, nullptr, icao, name, nullptr);
|
|
||||||
icaos.emplace_back(icao);
|
|
||||||
names.emplace_back(name);
|
|
||||||
lats.push_back(lat);
|
|
||||||
lons.push_back(lon);
|
|
||||||
alts.push_back(alt);
|
|
||||||
}
|
|
||||||
emitAirportsInRangeUpdated(icaos, names, lats, lons, alts);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *introspection_service = DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
|
static const char *introspection_service = DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
|
||||||
#include "org.swift_project.xswiftbus.service.xml"
|
#include "org.swift_project.xswiftbus.service.xml"
|
||||||
;
|
;
|
||||||
@@ -475,11 +438,6 @@ namespace XSwiftBus
|
|||||||
sendDBusMessage(reply);
|
sendDBusMessage(reply);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (message.getMethodName() == "updateAirportsInRange")
|
|
||||||
{
|
|
||||||
maybeSendEmptyDBusReply(wantsReply, sender, serial);
|
|
||||||
queueDBusCall([=]() { updateAirportsInRange(); });
|
|
||||||
}
|
|
||||||
else if (message.getMethodName() == "getAircraftModelPath")
|
else if (message.getMethodName() == "getAircraftModelPath")
|
||||||
{
|
{
|
||||||
queueDBusCall([=]() { sendDBusReply(sender, serial, getAircraftModelPath()); });
|
queueDBusCall([=]() { sendDBusReply(sender, serial, getAircraftModelPath()); });
|
||||||
@@ -836,21 +794,6 @@ namespace XSwiftBus
|
|||||||
sendDBusMessage(signalAircraftModelChanged);
|
sendDBusMessage(signalAircraftModelChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CService::emitAirportsInRangeUpdated(const std::vector<std::string> &icaoCodes,
|
|
||||||
const std::vector<std::string> &names, const std::vector<double> &lats,
|
|
||||||
const std::vector<double> &lons, const std::vector<double> &alts)
|
|
||||||
{
|
|
||||||
CDBusMessage signalAirportsInRangeUpdated = CDBusMessage::createSignal(
|
|
||||||
XSWIFTBUS_SERVICE_OBJECTPATH, XSWIFTBUS_SERVICE_INTERFACENAME, "airportsInRangeUpdated");
|
|
||||||
signalAirportsInRangeUpdated.beginArgumentWrite();
|
|
||||||
signalAirportsInRangeUpdated.appendArgument(icaoCodes);
|
|
||||||
signalAirportsInRangeUpdated.appendArgument(names);
|
|
||||||
signalAirportsInRangeUpdated.appendArgument(lats);
|
|
||||||
signalAirportsInRangeUpdated.appendArgument(lons);
|
|
||||||
signalAirportsInRangeUpdated.appendArgument(alts);
|
|
||||||
sendDBusMessage(signalAirportsInRangeUpdated);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CService::emitSceneryLoaded()
|
void CService::emitSceneryLoaded()
|
||||||
{
|
{
|
||||||
CDBusMessage signal =
|
CDBusMessage signal =
|
||||||
@@ -858,22 +801,6 @@ namespace XSwiftBus
|
|||||||
sendDBusMessage(signal);
|
sendDBusMessage(signal);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<CNavDataReference> CService::findClosestAirports(int number, double latitude, double longitude)
|
|
||||||
{
|
|
||||||
CNavDataReference ref(0, latitude, longitude);
|
|
||||||
auto compareFunction = [&](const CNavDataReference &a, const CNavDataReference &b) {
|
|
||||||
return calculateGreatCircleDistance(a, ref) < calculateGreatCircleDistance(b, ref);
|
|
||||||
};
|
|
||||||
|
|
||||||
number = std::min(static_cast<int>(m_airports.size()), number);
|
|
||||||
|
|
||||||
std::vector<CNavDataReference> closestAirports = m_airports;
|
|
||||||
std::partial_sort(closestAirports.begin(), closestAirports.begin() + number, closestAirports.end(),
|
|
||||||
compareFunction);
|
|
||||||
closestAirports.resize(static_cast<std::vector<CNavDataReference>::size_type>(number));
|
|
||||||
return closestAirports;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CService::updateMessageBoxFromSettings()
|
void CService::updateMessageBoxFromSettings()
|
||||||
{
|
{
|
||||||
// left, top, right, bottom, height size percentage
|
// left, top, right, bottom, height size percentage
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
#include "dbusobject.h"
|
#include "dbusobject.h"
|
||||||
#include "datarefs.h"
|
#include "datarefs.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "navdatareference.h"
|
|
||||||
#include "terrainprobe.h"
|
#include "terrainprobe.h"
|
||||||
#include <XPLM/XPLMNavigation.h>
|
#include <XPLM/XPLMNavigation.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -70,9 +69,6 @@ namespace XSwiftBus
|
|||||||
//! Add a text message to the on-screen display, with RGB components in the range [0,1]
|
//! Add a text message to the on-screen display, with RGB components in the range [0,1]
|
||||||
void addTextMessage(const std::string &text, double red, double green, double blue);
|
void addTextMessage(const std::string &text, double red, double green, double blue);
|
||||||
|
|
||||||
//! Called by newly connected client to cause airportsInRangeUpdated to be emitted.
|
|
||||||
void updateAirportsInRange();
|
|
||||||
|
|
||||||
//! Get full path to current aircraft model
|
//! Get full path to current aircraft model
|
||||||
std::string getAircraftModelPath() const;
|
std::string getAircraftModelPath() const;
|
||||||
|
|
||||||
@@ -335,10 +331,6 @@ namespace XSwiftBus
|
|||||||
const std::string &icao, const std::string &modelString, const std::string &name,
|
const std::string &icao, const std::string &modelString, const std::string &name,
|
||||||
const std::string &description);
|
const std::string &description);
|
||||||
|
|
||||||
void emitAirportsInRangeUpdated(const std::vector<std::string> &icaoCodes,
|
|
||||||
const std::vector<std::string> &names, const std::vector<double> &lats,
|
|
||||||
const std::vector<double> &lons, const std::vector<double> &alts);
|
|
||||||
|
|
||||||
void emitSceneryLoaded();
|
void emitSceneryLoaded();
|
||||||
|
|
||||||
CMessageBoxControl m_messages { 16, 16, 16 };
|
CMessageBoxControl m_messages { 16, 16, 16 };
|
||||||
@@ -346,12 +338,8 @@ namespace XSwiftBus
|
|||||||
bool m_disappearMessageWindow = true;
|
bool m_disappearMessageWindow = true;
|
||||||
int m_disapperMessageWindowTimeMs = 5000;
|
int m_disapperMessageWindowTimeMs = 5000;
|
||||||
std::chrono::system_clock::time_point m_disappearMessageWindowTime;
|
std::chrono::system_clock::time_point m_disappearMessageWindowTime;
|
||||||
std::vector<CNavDataReference> m_airports;
|
|
||||||
CTerrainProbe m_terrainProbe;
|
CTerrainProbe m_terrainProbe;
|
||||||
|
|
||||||
void readAirportsDatabase();
|
|
||||||
std::vector<CNavDataReference> findClosestAirports(int number, double latitude, double longitude);
|
|
||||||
|
|
||||||
//! Redraw message box after reading from the settings
|
//! Redraw message box after reading from the settings
|
||||||
void updateMessageBoxFromSettings();
|
void updateMessageBoxFromSettings();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user