mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-06 02:16:04 +08:00
refs #369, first version of IRenderedAircraftProvider in airspace monitor
(no aircraft parts yet)
This commit is contained in:
@@ -26,8 +26,9 @@ using namespace BlackMisc::PhysicalQuantities;
|
|||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
{
|
{
|
||||||
|
|
||||||
CAirspaceMonitor::CAirspaceMonitor(QObject *parent, const BlackMisc::Simulation::IOwnAircraftProviderReadOnly *ownAircraft, INetwork *network, CVatsimBookingReader *bookings, CVatsimDataFileReader *dataFile)
|
CAirspaceMonitor::CAirspaceMonitor(QObject *parent, const BlackMisc::Simulation::IOwnAircraftProviderReadOnly *ownAircraftProvider, INetwork *network, CVatsimBookingReader *bookings, CVatsimDataFileReader *dataFile)
|
||||||
: QObject(parent), COwnAircraftProviderSupportReadOnly(ownAircraft), m_network(network), m_vatsimBookingReader(bookings), m_vatsimDataFileReader(dataFile),
|
: QObject(parent), COwnAircraftProviderSupportReadOnly(ownAircraftProvider),
|
||||||
|
m_network(network), m_vatsimBookingReader(bookings), m_vatsimDataFileReader(dataFile),
|
||||||
m_atcWatchdog(this), m_aircraftWatchdog(this)
|
m_atcWatchdog(this), m_aircraftWatchdog(this)
|
||||||
{
|
{
|
||||||
this->connect(this->m_network, &INetwork::atcPositionUpdate, this, &CAirspaceMonitor::ps_atcPositionUpdate);
|
this->connect(this->m_network, &INetwork::atcPositionUpdate, this, &CAirspaceMonitor::ps_atcPositionUpdate);
|
||||||
@@ -57,6 +58,28 @@ namespace BlackCore
|
|||||||
this->connect(&this->m_atcWatchdog, &CAirspaceWatchdog::timeout, this, &CAirspaceMonitor::ps_atcControllerDisconnected);
|
this->connect(&this->m_atcWatchdog, &CAirspaceWatchdog::timeout, this, &CAirspaceMonitor::ps_atcControllerDisconnected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CAirspaceMonitor::updateAircraftEnabled(const CCallsign &callsign, bool enabledForRedering, const QString &originator)
|
||||||
|
{
|
||||||
|
CPropertyIndexVariantMap vm(CSimulatedAircraft::IndexEnabled, CVariant::fromValue(enabledForRedering));
|
||||||
|
Q_UNUSED(originator);
|
||||||
|
int c = m_aircraftInRange.applyIfCallsign(callsign, vm);
|
||||||
|
return c > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CAirspaceMonitor::updateAircraftModel(const CCallsign &callsign, const CAircraftModel &model, const QString &originator)
|
||||||
|
{
|
||||||
|
Q_UNUSED(originator);
|
||||||
|
CSimulatedAircraft aircraft = m_aircraftInRange.findFirstByCallsign(callsign);
|
||||||
|
if (!aircraft.hasValidCallsign()) { return false; }
|
||||||
|
|
||||||
|
CAircraftModel newModel(model);
|
||||||
|
aircraft.setModel(newModel); // this consolidates all common data such as callsign, ICAO ...
|
||||||
|
|
||||||
|
CPropertyIndexVariantMap vm(CSimulatedAircraft::IndexModel, aircraft.getModel().toCVariant());
|
||||||
|
int c = m_aircraftInRange.applyIfCallsign(callsign, vm);
|
||||||
|
return c > 0;
|
||||||
|
}
|
||||||
|
|
||||||
CFlightPlan CAirspaceMonitor::loadFlightPlanFromNetwork(const CCallsign &callsign)
|
CFlightPlan CAirspaceMonitor::loadFlightPlanFromNetwork(const CCallsign &callsign)
|
||||||
{
|
{
|
||||||
CFlightPlan plan;
|
CFlightPlan plan;
|
||||||
@@ -213,12 +236,6 @@ namespace BlackCore
|
|||||||
return station;
|
return station;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAircraftSituationList CAirspaceMonitor::getAircraftSituations(const CCallsign &callsign) const
|
|
||||||
{
|
|
||||||
if (callsign.isEmpty()) { return this->m_aircraftSituations; }
|
|
||||||
return this->m_aircraftSituations.findByCallsign(callsign);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CAirspaceMonitor::requestDataUpdates()
|
void CAirspaceMonitor::requestDataUpdates()
|
||||||
{
|
{
|
||||||
if (!this->m_network->isConnected()) return;
|
if (!this->m_network->isConnected()) return;
|
||||||
@@ -270,7 +287,7 @@ namespace BlackCore
|
|||||||
void CAirspaceMonitor::ps_realNameReplyReceived(const CCallsign &callsign, const QString &realname)
|
void CAirspaceMonitor::ps_realNameReplyReceived(const CCallsign &callsign, const QString &realname)
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->m_vatsimDataFileReader);
|
Q_ASSERT(this->m_vatsimDataFileReader);
|
||||||
if (realname.isEmpty()) return;
|
if (realname.isEmpty()) { return; }
|
||||||
CPropertyIndexVariantMap vm({CAtcStation::IndexController, CUser::IndexRealName}, realname);
|
CPropertyIndexVariantMap vm({CAtcStation::IndexController, CUser::IndexRealName}, realname);
|
||||||
this->m_atcStationsOnline.applyIf(&CAtcStation::getCallsign, callsign, vm);
|
this->m_atcStationsOnline.applyIf(&CAtcStation::getCallsign, callsign, vm);
|
||||||
this->m_atcStationsBooked.applyIf(&CAtcStation::getCallsign, callsign, vm);
|
this->m_atcStationsBooked.applyIf(&CAtcStation::getCallsign, callsign, vm);
|
||||||
@@ -653,7 +670,7 @@ namespace BlackCore
|
|||||||
if (!exists)
|
if (!exists)
|
||||||
{
|
{
|
||||||
// new aircraft
|
// new aircraft
|
||||||
CAircraft aircraft;
|
CSimulatedAircraft aircraft;
|
||||||
aircraft.setCallsign(callsign);
|
aircraft.setCallsign(callsign);
|
||||||
aircraft.setSituation(situation);
|
aircraft.setSituation(situation);
|
||||||
aircraft.setTransponder(transponder);
|
aircraft.setTransponder(transponder);
|
||||||
@@ -681,9 +698,9 @@ namespace BlackCore
|
|||||||
this->m_otherClients.push_back(c); // initial, will be filled by data later
|
this->m_otherClients.push_back(c); // initial, will be filled by data later
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// only if still connected
|
||||||
if (this->m_network->isConnected())
|
if (this->m_network->isConnected())
|
||||||
{
|
{
|
||||||
// only if still connected
|
|
||||||
// the order here makes some sense, as we hope to receive ICAO codes last, and everthing else already in place
|
// the order here makes some sense, as we hope to receive ICAO codes last, and everthing else already in place
|
||||||
this->sendFsipirCustomPacket(callsign); // own aircraft model
|
this->sendFsipirCustomPacket(callsign); // own aircraft model
|
||||||
this->m_network->sendFrequencyQuery(callsign);
|
this->m_network->sendFrequencyQuery(callsign);
|
||||||
@@ -702,12 +719,12 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
this->m_aircraftWatchdog.addCallsign(callsign);
|
this->m_aircraftWatchdog.addCallsign(callsign);
|
||||||
emit this->addedAircraft(callsign, situation);
|
emit this->addedAircraft(aircraft);
|
||||||
} // connected
|
} // connected
|
||||||
}
|
}
|
||||||
else // not exists yet
|
else
|
||||||
{
|
{
|
||||||
// update
|
// update, aircraft already exists
|
||||||
CLength distance = ownAircraft().calculateGreatCircleDistance(situation.getPosition());
|
CLength distance = ownAircraft().calculateGreatCircleDistance(situation.getPosition());
|
||||||
distance.switchUnit(CLengthUnit::NM());
|
distance.switchUnit(CLengthUnit::NM());
|
||||||
CPropertyIndexVariantMap vm;
|
CPropertyIndexVariantMap vm;
|
||||||
@@ -718,7 +735,6 @@ namespace BlackCore
|
|||||||
// here I expect always a changed value
|
// here I expect always a changed value
|
||||||
this->m_aircraftInRange.applyIfCallsign(callsign, vm);
|
this->m_aircraftInRange.applyIfCallsign(callsign, vm);
|
||||||
this->m_aircraftWatchdog.resetCallsign(callsign);
|
this->m_aircraftWatchdog.resetCallsign(callsign);
|
||||||
emit this->changedAircraftSituation(callsign, situation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
emit this->changedAircraftInRange();
|
emit this->changedAircraftInRange();
|
||||||
|
|||||||
@@ -12,15 +12,15 @@
|
|||||||
#ifndef BLACKCORE_AIRSPACE_MONITOR_H
|
#ifndef BLACKCORE_AIRSPACE_MONITOR_H
|
||||||
#define BLACKCORE_AIRSPACE_MONITOR_H
|
#define BLACKCORE_AIRSPACE_MONITOR_H
|
||||||
|
|
||||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
|
||||||
#include "blackmisc/avatcstationlist.h"
|
|
||||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||||
|
#include "blackmisc/simulation/simdirectaccessownaircraft.h"
|
||||||
|
#include "blackmisc/simulation/simdirectaccessrenderedaircraft.h"
|
||||||
|
#include "blackmisc/avatcstationlist.h"
|
||||||
#include "blackmisc/avaircraftsituationlist.h"
|
#include "blackmisc/avaircraftsituationlist.h"
|
||||||
#include "blackmisc/nwclientlist.h"
|
#include "blackmisc/nwclientlist.h"
|
||||||
#include "blackmisc/avflightplan.h"
|
#include "blackmisc/avflightplan.h"
|
||||||
#include "blackmisc/nwuserlist.h"
|
#include "blackmisc/nwuserlist.h"
|
||||||
#include "blackmisc/avcallsignlist.h"
|
#include "blackmisc/avcallsignlist.h"
|
||||||
#include "blackmisc/simulation/simdirectaccessownaircraft.h"
|
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
#include "vatsimbookingreader.h"
|
#include "vatsimbookingreader.h"
|
||||||
#include "vatsimdatafilereader.h"
|
#include "vatsimdatafilereader.h"
|
||||||
@@ -34,7 +34,8 @@ namespace BlackCore
|
|||||||
*/
|
*/
|
||||||
class CAirspaceMonitor :
|
class CAirspaceMonitor :
|
||||||
public QObject,
|
public QObject,
|
||||||
public BlackMisc::Simulation::COwnAircraftProviderSupportReadOnly
|
public BlackMisc::Simulation::COwnAircraftProviderSupportReadOnly,
|
||||||
|
public BlackMisc::Simulation::IRenderedAircraftProvider
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -42,6 +43,24 @@ namespace BlackCore
|
|||||||
//! Constructor
|
//! Constructor
|
||||||
CAirspaceMonitor(QObject *parent, const BlackMisc::Simulation::IOwnAircraftProviderReadOnly *ownAircraft, INetwork *network, CVatsimBookingReader *bookings, CVatsimDataFileReader *dataFile);
|
CAirspaceMonitor(QObject *parent, const BlackMisc::Simulation::IOwnAircraftProviderReadOnly *ownAircraft, INetwork *network, CVatsimBookingReader *bookings, CVatsimDataFileReader *dataFile);
|
||||||
|
|
||||||
|
//! \copydoc IRenderedAircraftProviderReadOnly::renderedAircraft
|
||||||
|
virtual const BlackMisc::Simulation::CSimulatedAircraftList &renderedAircraft() const override { return m_aircraftInRange; }
|
||||||
|
|
||||||
|
//! \copydoc IRenderedAircraftProvider::renderedAircraft
|
||||||
|
virtual BlackMisc::Simulation::CSimulatedAircraftList &renderedAircraft() override { return m_aircraftInRange; }
|
||||||
|
|
||||||
|
//! \copydoc IRenderedAircraftProvider::renderedAircraftSituations
|
||||||
|
virtual const BlackMisc::Aviation::CAircraftSituationList &renderedAircraftSituations() const override { return m_aircraftSituations; }
|
||||||
|
|
||||||
|
//! \copydoc IRenderedAircraftProvider::renderedAircraftSituations
|
||||||
|
virtual BlackMisc::Aviation::CAircraftSituationList &renderedAircraftSituations() override { return m_aircraftSituations; }
|
||||||
|
|
||||||
|
//! \copydoc IRenderedAircraftProvider::updateAircraftEnabled
|
||||||
|
virtual bool updateAircraftEnabled(const BlackMisc::Aviation::CCallsign &callsign, bool enabledForRedering, const QString &originator) override;
|
||||||
|
|
||||||
|
//! \copydoc IRenderedAircraftProvider::updateAircraftModel
|
||||||
|
virtual bool updateAircraftModel(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Simulation::CAircraftModel &model, const QString &originator) override;
|
||||||
|
|
||||||
//! Returns the list of users we know about
|
//! Returns the list of users we know about
|
||||||
BlackMisc::Network::CUserList getUsers() const;
|
BlackMisc::Network::CUserList getUsers() const;
|
||||||
|
|
||||||
@@ -67,15 +86,9 @@ namespace BlackCore
|
|||||||
//! Returns the current booked ATC stations
|
//! Returns the current booked ATC stations
|
||||||
BlackMisc::Aviation::CAtcStationList getAtcStationsBooked() const { return m_atcStationsBooked; }
|
BlackMisc::Aviation::CAtcStationList getAtcStationsBooked() const { return m_atcStationsBooked; }
|
||||||
|
|
||||||
//! Returns the current aircraft in range
|
|
||||||
BlackMisc::Simulation::CSimulatedAircraftList getAircraftInRange() const { return m_aircraftInRange; }
|
|
||||||
|
|
||||||
//! Returns the closest ATC station operating on the given frequency, if any
|
//! Returns the closest ATC station operating on the given frequency, if any
|
||||||
BlackMisc::Aviation::CAtcStation getAtcStationForComUnit(const BlackMisc::Aviation::CComSystem &comSystem);
|
BlackMisc::Aviation::CAtcStation getAtcStationForComUnit(const BlackMisc::Aviation::CComSystem &comSystem);
|
||||||
|
|
||||||
//! Aircraft situations, empty callsign means all
|
|
||||||
BlackMisc::Aviation::CAircraftSituationList getAircraftSituations(const BlackMisc::Aviation::CCallsign &callsign = {}) const;
|
|
||||||
|
|
||||||
//! Request to update other clients' data from the network
|
//! Request to update other clients' data from the network
|
||||||
void requestDataUpdates();
|
void requestDataUpdates();
|
||||||
|
|
||||||
@@ -99,16 +112,13 @@ namespace BlackCore
|
|||||||
void changedAircraftInRange();
|
void changedAircraftInRange();
|
||||||
|
|
||||||
//! A new aircraft appeared
|
//! A new aircraft appeared
|
||||||
void addedAircraft(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftSituation &initialSituation);
|
void addedAircraft(const BlackMisc::Simulation::CSimulatedAircraft &renderedAircraft);
|
||||||
|
|
||||||
//! An aircraft's situation was changed
|
|
||||||
void changedAircraftSituation(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftSituation &situation);
|
|
||||||
|
|
||||||
//! An aircraft disappeared
|
//! An aircraft disappeared
|
||||||
void removedAircraft(const BlackMisc::Aviation::CCallsign &callsign);
|
void removedAircraft(const BlackMisc::Aviation::CCallsign &callsign);
|
||||||
|
|
||||||
//! Read for model matching
|
//! Read for model matching
|
||||||
void readyForModelMatching(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft);
|
void readyForModelMatching(const BlackMisc::Simulation::CSimulatedAircraft &renderedAircraft);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//! Clear the contents
|
//! Clear the contents
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ namespace BlackCore
|
|||||||
virtual BlackMisc::Simulation::CSimulatedAircraftList getAircraftInRange() const override
|
virtual BlackMisc::Simulation::CSimulatedAircraftList getAircraftInRange() const override
|
||||||
{
|
{
|
||||||
BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||||
return this->m_airspace->getAircraftInRange();
|
return this->m_airspace->renderedAircraft();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \copydoc IContextNetwork::connectToNetwork()
|
//! \copydoc IContextNetwork::connectToNetwork()
|
||||||
|
|||||||
65
src/blackmisc/simulation/simdirectaccessrenderedaircraft.cpp
Normal file
65
src/blackmisc/simulation/simdirectaccessrenderedaircraft.cpp
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
/* Copyright (C) 2015
|
||||||
|
* swift project Community / Contributors
|
||||||
|
*
|
||||||
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||||
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||||
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||||
|
* contained in the LICENSE file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "simdirectaccessrenderedaircraft.h"
|
||||||
|
|
||||||
|
namespace BlackMisc
|
||||||
|
{
|
||||||
|
namespace Simulation
|
||||||
|
{
|
||||||
|
const CSimulatedAircraftList &CRenderedAircraftProviderSupportReadOnly::renderedAircraft() const
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(this->m_renderedAircraftProvider, "renderedAircraft", "No object available");
|
||||||
|
return this->m_renderedAircraftProvider->renderedAircraft();
|
||||||
|
}
|
||||||
|
|
||||||
|
const Aviation::CAircraftSituationList &CRenderedAircraftProviderSupportReadOnly::renderedAircraftSituations() const
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(this->m_renderedAircraftProvider, "renderedAircraftSituations", "No object available");
|
||||||
|
return this->m_renderedAircraftProvider->renderedAircraftSituations();
|
||||||
|
}
|
||||||
|
|
||||||
|
const CSimulatedAircraftList &CRenderedAircraftProviderSupport::renderedAircraft() const
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(this->m_renderedAircraftProvider, "renderedAircraft", "No object available");
|
||||||
|
return this->m_renderedAircraftProvider->renderedAircraft();
|
||||||
|
}
|
||||||
|
|
||||||
|
CSimulatedAircraftList &CRenderedAircraftProviderSupport::renderedAircraft()
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(this->m_renderedAircraftProvider, "renderedAircraft", "No object available");
|
||||||
|
return this->m_renderedAircraftProvider->renderedAircraft();
|
||||||
|
}
|
||||||
|
|
||||||
|
const Aviation::CAircraftSituationList &CRenderedAircraftProviderSupport::renderedAircraftSituations() const
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(this->m_renderedAircraftProvider, "renderedAircraftSituations", "No object available");
|
||||||
|
return this->m_renderedAircraftProvider->renderedAircraftSituations();
|
||||||
|
}
|
||||||
|
|
||||||
|
Aviation::CAircraftSituationList &CRenderedAircraftProviderSupport::renderedAircraftSituations()
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(this->m_renderedAircraftProvider, "renderedAircraftSituations", "No object available");
|
||||||
|
return this->m_renderedAircraftProvider->renderedAircraftSituations();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRenderedAircraftProviderSupport::providerUpdateAircraftModel(const Aviation::CCallsign &callsign, const CAircraftModel &model, const QString &originator)
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(this->m_renderedAircraftProvider, "providerUpdateAircraftModel", "No object available");
|
||||||
|
return this->m_renderedAircraftProvider->updateAircraftModel(callsign, model, originator);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRenderedAircraftProviderSupport::providerUpdateAircraftEnabled(const Aviation::CCallsign &callsign, bool enabledForRedering, const QString &originator)
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(this->m_renderedAircraftProvider, "providerUpdateAircraftEnabled", "No object available");
|
||||||
|
return this->m_renderedAircraftProvider->updateAircraftEnabled(callsign, enabledForRedering, originator);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
} // namespace
|
||||||
100
src/blackmisc/simulation/simdirectaccessrenderedaircraft.h
Normal file
100
src/blackmisc/simulation/simdirectaccessrenderedaircraft.h
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
/* Copyright (C) 2015
|
||||||
|
* swift project Community / Contributors
|
||||||
|
*
|
||||||
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||||
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||||
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||||
|
* contained in the LICENSE file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//! \file
|
||||||
|
|
||||||
|
#ifndef BLACKMISC_SIMDIRECTACCESSRENDEREDAIRCRAFT_H
|
||||||
|
#define BLACKMISC_SIMDIRECTACCESSRENDEREDAIRCRAFT_H
|
||||||
|
|
||||||
|
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||||
|
#include "blackmisc/avaircraftsituationlist.h"
|
||||||
|
|
||||||
|
namespace BlackMisc
|
||||||
|
{
|
||||||
|
namespace Simulation
|
||||||
|
{
|
||||||
|
//! Direct in memory access to rendered aircraft
|
||||||
|
class IRenderedAircraftProviderReadOnly
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! All rendered aircraft
|
||||||
|
virtual const CSimulatedAircraftList &renderedAircraft() const = 0;
|
||||||
|
|
||||||
|
//! All rendered aircraft
|
||||||
|
virtual const BlackMisc::Aviation::CAircraftSituationList &renderedAircraftSituations() const = 0;
|
||||||
|
|
||||||
|
//! Destructor
|
||||||
|
virtual ~IRenderedAircraftProviderReadOnly() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Direct in memory access to own aircraft
|
||||||
|
class IRenderedAircraftProvider : public IRenderedAircraftProviderReadOnly
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! All rendered aircraft
|
||||||
|
virtual CSimulatedAircraftList &renderedAircraft() = 0;
|
||||||
|
|
||||||
|
//! Rendered aircraft situations (history)
|
||||||
|
virtual BlackMisc::Aviation::CAircraftSituationList &renderedAircraftSituations() = 0;
|
||||||
|
|
||||||
|
//! Enable/disable rendering
|
||||||
|
virtual bool updateAircraftEnabled(const BlackMisc::Aviation::CCallsign &callsign, bool enabledForRedering, const QString &originator) = 0;
|
||||||
|
|
||||||
|
//! Change model string
|
||||||
|
virtual bool updateAircraftModel(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Simulation::CAircraftModel &model, const QString &originator) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Class which can be directly used providing access to such an interface
|
||||||
|
class CRenderedAircraftProviderSupportReadOnly
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! \copydoc IRenderedAircraftProviderReadOnly::renderedAircraft
|
||||||
|
virtual const CSimulatedAircraftList &renderedAircraft() const;
|
||||||
|
|
||||||
|
//!\copydoc IRenderedAircraftProviderReadOnly::renderedAircraftSituations
|
||||||
|
virtual const BlackMisc::Aviation::CAircraftSituationList &renderedAircraftSituations() const = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! Constructor
|
||||||
|
CRenderedAircraftProviderSupportReadOnly(const IRenderedAircraftProviderReadOnly *renderedAircraftProvider) : m_renderedAircraftProvider(renderedAircraftProvider) {}
|
||||||
|
const IRenderedAircraftProviderReadOnly *m_renderedAircraftProvider = nullptr; //!< access to object
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Delegating class which can be directly used providing access to such an interface
|
||||||
|
class CRenderedAircraftProviderSupport
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! \copydoc IRenderedAircraftProviderReadOnly::renderedAircraft
|
||||||
|
virtual const CSimulatedAircraftList &renderedAircraft() const;
|
||||||
|
|
||||||
|
//! \copydoc IRenderedAircraftProvider::renderedAircraft
|
||||||
|
virtual CSimulatedAircraftList &renderedAircraft();
|
||||||
|
|
||||||
|
//!\copydoc IRenderedAircraftProviderReadOnly::renderedAircraftSituations
|
||||||
|
virtual const BlackMisc::Aviation::CAircraftSituationList &renderedAircraftSituations() const;
|
||||||
|
|
||||||
|
//!\copydoc IRenderedAircraftProvider::renderedAircraftSituations
|
||||||
|
virtual Aviation::CAircraftSituationList &renderedAircraftSituations();
|
||||||
|
|
||||||
|
//! \copydoc IRenderedAircraftProvider::updateAircraftEnabled
|
||||||
|
virtual bool providerUpdateAircraftEnabled(const BlackMisc::Aviation::CCallsign &callsign, bool enabledForRedering, const QString &originator);
|
||||||
|
|
||||||
|
//! \copydoc IRenderedAircraftProvider::updateAircraftModel
|
||||||
|
virtual bool providerUpdateAircraftModel(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Simulation::CAircraftModel &model, const QString &originator);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! Constructor
|
||||||
|
CRenderedAircraftProviderSupport(IRenderedAircraftProvider *renderedAircraftProvider) : m_renderedAircraftProvider(renderedAircraftProvider) { Q_ASSERT(renderedAircraftProvider); }
|
||||||
|
IRenderedAircraftProvider *m_renderedAircraftProvider = nullptr; //!< access to object
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#endif // guard
|
||||||
Reference in New Issue
Block a user