mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 07:35:41 +08:00
Ref T171, count of aircraft supporting parts
* added functions in providers, aware class * some utility functions in aircraft list
This commit is contained in:
@@ -192,6 +192,12 @@ namespace BlackCore
|
||||
return m_aircraftSupportingParts.contains(callsign);
|
||||
}
|
||||
|
||||
int CAirspaceMonitor::getRemoteAircraftSupportingPartsCount() const
|
||||
{
|
||||
QReadLocker l(&m_lockParts);
|
||||
return m_aircraftSupportingParts.size();
|
||||
}
|
||||
|
||||
CCallsignSet CAirspaceMonitor::remoteAircraftSupportingParts() const
|
||||
{
|
||||
QReadLocker l(&m_lockParts);
|
||||
|
||||
@@ -95,6 +95,7 @@ namespace BlackCore
|
||||
virtual int remoteAircraftSituationsCount(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||
virtual BlackMisc::Aviation::CAircraftPartsList remoteAircraftParts(const BlackMisc::Aviation::CCallsign &callsign, qint64 cutoffTimeValuesBefore = -1) const override;
|
||||
virtual bool isRemoteAircraftSupportingParts(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||
virtual int getRemoteAircraftSupportingPartsCount() const override;
|
||||
virtual BlackMisc::Aviation::CCallsignSet remoteAircraftSupportingParts() const override;
|
||||
virtual bool updateAircraftEnabled(const BlackMisc::Aviation::CCallsign &callsign, bool enabledForRedering) override;
|
||||
virtual bool updateAircraftModel(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Simulation::CAircraftModel &model, const BlackMisc::CIdentifier &originator) override;
|
||||
|
||||
@@ -553,6 +553,12 @@ namespace BlackCore
|
||||
return m_airspace->remoteAircraftParts(callsign, cutoffTimeValuesBefore);
|
||||
}
|
||||
|
||||
int CContextNetwork::getRemoteAircraftSupportingPartsCount() const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
return m_airspace->getRemoteAircraftSupportingPartsCount();
|
||||
}
|
||||
|
||||
bool CContextNetwork::isAircraftPartsHistoryEnabled() const
|
||||
{
|
||||
if (this->isDebugEnabled()) { CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
|
||||
@@ -124,6 +124,7 @@ namespace BlackCore
|
||||
virtual void enableReverseLookupMessages(bool enabled) override;
|
||||
virtual BlackMisc::CStatusMessageList getAircraftPartsHistory(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||
virtual BlackMisc::Aviation::CAircraftPartsList getRemoteAircraftParts(const BlackMisc::Aviation::CCallsign &callsign, qint64 cutoffTimeValuesBefore) const override;
|
||||
virtual int getRemoteAircraftSupportingPartsCount() const override;
|
||||
virtual bool isAircraftPartsHistoryEnabled() const override;
|
||||
virtual void enableAircraftPartsHistory(bool enabled) override;
|
||||
//! @}
|
||||
|
||||
@@ -118,6 +118,12 @@ namespace BlackMisc
|
||||
return m_remoteAircraftProvider->isRemoteAircraftSupportingParts(callsign);
|
||||
}
|
||||
|
||||
int CRemoteAircraftAware::getRemoteAircraftSupportingPartsCount() const
|
||||
{
|
||||
Q_ASSERT_X(m_remoteAircraftProvider, Q_FUNC_INFO, "No object available");
|
||||
return m_remoteAircraftProvider->getRemoteAircraftSupportingPartsCount();
|
||||
}
|
||||
|
||||
bool CRemoteAircraftAware::updateAircraftEnabled(const Aviation::CCallsign &callsign, bool enabledForRedering)
|
||||
{
|
||||
Q_ASSERT_X(m_remoteAircraftProvider, Q_FUNC_INFO, "No object available");
|
||||
|
||||
@@ -100,6 +100,10 @@ namespace BlackMisc
|
||||
//! \threadsafe
|
||||
virtual bool isRemoteAircraftSupportingParts(const BlackMisc::Aviation::CCallsign &callsign) const = 0;
|
||||
|
||||
//! Number of aircraft supporting parts
|
||||
//! \threadsafe
|
||||
virtual int getRemoteAircraftSupportingPartsCount() const = 0;
|
||||
|
||||
//! Remote aircraft supporting parts.
|
||||
//! \threadsafe
|
||||
virtual BlackMisc::Aviation::CCallsignSet remoteAircraftSupportingParts() const = 0;
|
||||
@@ -214,6 +218,9 @@ namespace BlackMisc
|
||||
//! \copydoc IRemoteAircraftProvider::isRemoteAircraftSupportingParts
|
||||
bool isRemoteAircraftSupportingParts(const BlackMisc::Aviation::CCallsign &callsign) const;
|
||||
|
||||
//! \copydoc IRemoteAircraftProvider::getRemoteAircraftSupportingPartsCount
|
||||
int getRemoteAircraftSupportingPartsCount() const;
|
||||
|
||||
//! \copydoc IRemoteAircraftProvider::updateAircraftEnabled
|
||||
bool updateAircraftEnabled(const BlackMisc::Aviation::CCallsign &callsign, bool enabledForRedering);
|
||||
|
||||
|
||||
@@ -195,5 +195,35 @@ namespace BlackMisc
|
||||
this->push_back(aircraft);
|
||||
return true;
|
||||
}
|
||||
|
||||
int CSimulatedAircraftList::countEnabled() const
|
||||
{
|
||||
int c = 0;
|
||||
for (const CSimulatedAircraft &aircraft : (*this))
|
||||
{
|
||||
if (aircraft.isEnabled()) { c++; }
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
int CSimulatedAircraftList::countRendered() const
|
||||
{
|
||||
int c = 0;
|
||||
for (const CSimulatedAircraft &aircraft : (*this))
|
||||
{
|
||||
if (aircraft.isRendered()) { c++; }
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
int CSimulatedAircraftList::countAircraftPartsSyncronized() const
|
||||
{
|
||||
int c = 0;
|
||||
for (const CSimulatedAircraft &aircraft : (*this))
|
||||
{
|
||||
if (aircraft.isPartsSynchronized()) { c++; }
|
||||
}
|
||||
return c;
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -100,6 +100,15 @@ namespace BlackMisc
|
||||
|
||||
//! Replace or add by callsign
|
||||
bool replaceOrAddByCallsign(const CSimulatedAircraft &aircraft);
|
||||
|
||||
//! Number of enabled aircraft
|
||||
int countEnabled() const;
|
||||
|
||||
//! Number of rendered aircraft
|
||||
int countRendered() const;
|
||||
|
||||
//! Number of aircraft with parts
|
||||
int countAircraftPartsSyncronized() const;
|
||||
};
|
||||
} //namespace
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user