refs #395, prepared for logical / physical add/remote member functions

* renamed functions
* added access to snapshot
* moved simulator base class in own files (.h/.cpp)
This commit is contained in:
Klaus Basan
2015-05-03 01:28:55 +02:00
committed by Mathew Sutcliffe
parent 91f0b99cc5
commit e9f7810efc
23 changed files with 641 additions and 470 deletions

View File

@@ -18,7 +18,8 @@ namespace BlackMisc
CAirspaceAircraftSnapshot::CAirspaceAircraftSnapshot()
{ }
CAirspaceAircraftSnapshot::CAirspaceAircraftSnapshot(const CSimulatedAircraftList &allAircraft)
CAirspaceAircraftSnapshot::CAirspaceAircraftSnapshot(const CSimulatedAircraftList &allAircraft) :
m_timestampMsSinceEpoch(QDateTime::currentMSecsSinceEpoch())
{
if (!allAircraft.isEmpty())
{
@@ -33,6 +34,11 @@ namespace BlackMisc
}
}
bool CAirspaceAircraftSnapshot::isValidSnapshot() const
{
return m_timestampMsSinceEpoch > 0;
}
CVariant CAirspaceAircraftSnapshot::propertyByIndex(const CPropertyIndex &index) const
{
if (index.isMyself()) { return this->toCVariant(); }

View File

@@ -49,6 +49,9 @@ namespace BlackMisc
//! VTOL aircraft callsigns by distance, only enabled aircraft
const BlackMisc::Aviation::CCallsignSet &getEnabledVtolAircraftCallsignsByDistance() const { return m_enabledVtolAircraftCallsignsByDistance; }
//! Valid snapshot?
bool isValidSnapshot() const;
//! \copydoc CValueObject::propertyByIndex
virtual CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override;
@@ -61,7 +64,7 @@ namespace BlackMisc
private:
BLACK_ENABLE_TUPLE_CONVERSION(CAirspaceAircraftSnapshot)
qint64 m_timestampMsSinceEpoch;
qint64 m_timestampMsSinceEpoch = -1;
// remark closest aircraft always first
BlackMisc::Aviation::CCallsignSet m_aircraftCallsignsByDistance;

View File

@@ -34,6 +34,12 @@ namespace BlackMisc
return this->m_remoteAircraftProvider->getAircraftInRangeForCallsign(callsign);
}
CAirspaceAircraftSnapshot CRemoteAircraftAware::getLatestAirspaceAircraftSnapshot() const
{
Q_ASSERT_X(this->m_remoteAircraftProvider, Q_FUNC_INFO, "No object available");
return this->m_remoteAircraftProvider->getLatestAirspaceAircraftSnapshot();
}
CAircraftSituationList CRemoteAircraftAware::remoteAircraftSituations(const BlackMisc::Aviation::CCallsign &callsign) const
{
Q_ASSERT_X(this->m_remoteAircraftProvider, Q_FUNC_INFO, "No object available");

View File

@@ -49,6 +49,11 @@ namespace BlackMisc
return this->findBy(&CSimulatedAircraft::isEnabled, enabled);
}
CSimulatedAircraftList CSimulatedAircraftList::findByRendered(bool rendered) const
{
return this->findBy(&CSimulatedAircraft::isRendered, rendered);
}
CSimulatedAircraftList CSimulatedAircraftList::findByVtol(bool vtol) const
{
return this->findBy(&CSimulatedAircraft::isVtol, vtol);

View File

@@ -47,6 +47,9 @@ namespace BlackMisc
//! Enabled / disabled aircraft
CSimulatedAircraftList findByEnabled(bool enabled) const;
//! Rendered / not rendered aircraft
CSimulatedAircraftList findByRendered(bool rendered) const;
//! VTOL / non VTOL aircraft
CSimulatedAircraftList findByVtol(bool vtol) const;
@@ -56,7 +59,7 @@ namespace BlackMisc
//! Mark all aircraft as unrendered
void markAllAsNotRendered();
//! Mark as rendered
//! Mark given callsign as rendered
int setRendered(const BlackMisc::Aviation::CCallsign &callsign, bool rendered);
//! Set aircraft parts