mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 15:25:35 +08:00
Ref T298, improved/fixed re-matching (match all aircraft again)
- reset to network model (otherwise we match "matched model" -> "matched model") - renamed/added functions doMtachingAgain/doMatchinsAgain in contexts
This commit is contained in:
@@ -242,8 +242,11 @@ namespace BlackCore
|
||||
//! Request weather grid. Argument identifier is past in the signal to identify the requestor
|
||||
virtual void requestWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid, const BlackMisc::CIdentifier &identifier) = 0;
|
||||
|
||||
//! Repeat all mappings
|
||||
virtual int doMatchingsAgain() = 0;
|
||||
|
||||
//! Repeat the mapping
|
||||
virtual bool doMappingAgain(const BlackMisc::Aviation::CCallsign &callsign) = 0;
|
||||
virtual bool doMatchingAgain(const BlackMisc::Aviation::CCallsign &callsign) = 0;
|
||||
|
||||
//! Current matching statistics
|
||||
virtual BlackMisc::Simulation::CMatchingStatistics getCurrentMatchingStatistics(bool missingOnly) const = 0;
|
||||
|
||||
@@ -238,8 +238,15 @@ namespace BlackCore
|
||||
return false;
|
||||
}
|
||||
|
||||
//! \copydoc IContextSimulator::doMappingAgain
|
||||
virtual bool doMappingAgain(const BlackMisc::Aviation::CCallsign &callsign) override
|
||||
|
||||
//! \copydoc IContextSimulator::doMatchingsAgain
|
||||
virtual int doMatchingsAgain() override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//! \copydoc IContextSimulator::doMatchingAgain
|
||||
virtual bool doMatchingAgain(const BlackMisc::Aviation::CCallsign &callsign) override
|
||||
{
|
||||
Q_UNUSED(callsign);
|
||||
return false;
|
||||
|
||||
@@ -863,7 +863,26 @@ namespace BlackCore
|
||||
m_weatherManager.requestWeatherGrid(weatherGrid, identifier);
|
||||
}
|
||||
|
||||
bool CContextSimulator::doMappingAgain(const CCallsign &callsign)
|
||||
int CContextSimulator::doMatchingsAgain()
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
const CCallsignSet callsigns = this->getAircraftInRangeCallsigns();
|
||||
if (callsigns.isEmpty()) { return 0; }
|
||||
int delayMs = 25;
|
||||
QPointer<CContextSimulator> myself(this);
|
||||
for (const CCallsign &cs : callsigns)
|
||||
{
|
||||
QTimer::singleShot(delayMs, this, [ = ]
|
||||
{
|
||||
if (!sApp || sApp->isShuttingDown() || !myself) { return; }
|
||||
this->doMatchingAgain(cs);
|
||||
});
|
||||
delayMs += 25;
|
||||
}
|
||||
return callsigns.size();
|
||||
}
|
||||
|
||||
bool CContextSimulator::doMatchingAgain(const CCallsign &callsign)
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << callsign.asString(); }
|
||||
if (!this->isAircraftInRange(callsign)) { return false; }
|
||||
@@ -872,10 +891,12 @@ namespace BlackCore
|
||||
QPointer<CContextSimulator> myself(this);
|
||||
QTimer::singleShot(2500, this, [ = ]
|
||||
{
|
||||
if (!myself) { return; }
|
||||
if (!sApp || sApp->isShuttingDown() || !myself) { return; }
|
||||
const CSimulatedAircraft aircraft = this->getAircraftInRangeForCallsign(callsign);
|
||||
if (!aircraft.hasCallsign()) { return; } // no longer valid
|
||||
this->xCtxAddedRemoteAircraftReadyForModelMatching(aircraft);
|
||||
CSimulatedAircraft resetAircraft(aircraft);
|
||||
resetAircraft.resetToNetworkModel();
|
||||
this->xCtxAddedRemoteAircraftReadyForModelMatching(resetAircraft);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,8 @@ namespace BlackCore
|
||||
virtual bool resetToModelMatchingAircraft(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
virtual void setWeatherActivated(bool activated) override;
|
||||
virtual void requestWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid, const BlackMisc::CIdentifier &identifier) override;
|
||||
virtual bool doMappingAgain(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
virtual int doMatchingsAgain() override;
|
||||
virtual bool doMatchingAgain(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
virtual BlackMisc::CStatusMessageList getMatchingMessages(const BlackMisc::Aviation::CCallsign &callsign) const override;
|
||||
virtual bool isMatchingMessagesEnabled() const override;
|
||||
virtual void enableMatchingMessages(bool enabled) override;
|
||||
|
||||
@@ -261,9 +261,14 @@ namespace BlackCore
|
||||
return m_dBusInterface->callDBusRet<bool>(QLatin1String("parseCommandLine"), commandLine, originator);
|
||||
}
|
||||
|
||||
bool CContextSimulatorProxy::doMappingAgain(const CCallsign &callsign)
|
||||
int CContextSimulatorProxy::doMatchingsAgain()
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<bool>(QLatin1String("doMappingAgain"), callsign);
|
||||
return m_dBusInterface->callDBusRet<int>(QLatin1String("doMatchingsAgain"));
|
||||
}
|
||||
|
||||
bool CContextSimulatorProxy::doMatchingAgain(const CCallsign &callsign)
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<bool>(QLatin1String("doMatchingAgain"), callsign);
|
||||
}
|
||||
|
||||
CMatchingStatistics CContextSimulatorProxy::getCurrentMatchingStatistics(bool missingOnly) const
|
||||
|
||||
@@ -91,7 +91,8 @@ namespace BlackCore
|
||||
virtual bool isMatchingMessagesEnabled() const override;
|
||||
virtual void enableMatchingMessages(bool enabled) override;
|
||||
virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) override;
|
||||
virtual bool doMappingAgain(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
virtual int doMatchingsAgain() override;
|
||||
virtual bool doMatchingAgain(const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
virtual BlackMisc::Simulation::CMatchingStatistics getCurrentMatchingStatistics(bool missingOnly) const override;
|
||||
virtual void setMatchingSetup(const BlackMisc::Simulation::CAircraftMatcherSetup &setup) override;
|
||||
virtual BlackMisc::Simulation::CAircraftMatcherSetup getMatchingSetup() const override;
|
||||
|
||||
@@ -491,6 +491,14 @@ namespace BlackMisc
|
||||
m_models[NetworkModel] = model;
|
||||
}
|
||||
|
||||
bool CSimulatedAircraft::resetToNetworkModel()
|
||||
{
|
||||
Q_ASSERT_X(m_models.size() == 2, Q_FUNC_INFO, "Wrong model size");
|
||||
const CAircraftModel nwModel = m_models[NetworkModel];
|
||||
m_models[CurrentModel] = nwModel;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSimulatedAircraft::setCG(const CLength &cg)
|
||||
{
|
||||
if (cg.isNull()) { return false; }
|
||||
|
||||
@@ -390,6 +390,9 @@ namespace BlackMisc
|
||||
//! Set network model
|
||||
void setNetworkModel(const CAircraftModel &model);
|
||||
|
||||
//! Reset to the newtork model
|
||||
bool resetToNetworkModel();
|
||||
|
||||
//! Set the center of gravity
|
||||
bool setCG(const PhysicalQuantities::CLength &cg);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user