Ref T515, consolidated removed and disabled models, only use "disaabled"

This commit is contained in:
Klaus Basan
2019-01-26 17:51:14 +01:00
committed by Mat Sutcliffe
parent 365c52613a
commit d12f164d26
2 changed files with 10 additions and 13 deletions

View File

@@ -49,7 +49,7 @@ namespace BlackCore
CAircraftMatcher::~CAircraftMatcher()
{
this->saveRemovedModels();
this->saveDisabledForMatchingModels();
}
bool CAircraftMatcher::setSetup(const CAircraftMatcherSetup &setup)
@@ -826,21 +826,19 @@ namespace BlackCore
if (remoteAircraft.hasCallsign() && remoteAircraft.hasModelString())
{
const QString modelString = remoteAircraft.getModelString();
const bool r = m_modelSet.removeModelWithString(modelString, Qt::CaseInsensitive);
if (r)
{
CLogMessage(this).warning(u"Removed model '%1' from matching model set") << modelString;
m_removedModels.replaceOrAddModelWithString(remoteAircraft.getModel(), Qt::CaseInsensitive);
}
const CAircraftModelList disabledModels({ remoteAircraft.getModel() });
this->disableModelsForMatching(disabledModels, true);
CLogMessage(this).warning(u"Disabled model '%1' for matching") << modelString;
}
}
bool CAircraftMatcher::saveRemovedModels()
bool CAircraftMatcher::saveDisabledForMatchingModels()
{
if (m_removedModels.isEmpty()) { return false; }
if (m_disabledModels.isEmpty()) { return false; }
// log the models
const QString ts = QDateTime::currentDateTimeUtc().toString("yyyyMMddHHmmss");
const QString json = m_removedModels.toJsonString();
const QString json = m_disabledModels.toJsonString();
return CFileUtils::writeStringToFile(json, CFileUtils::appendFilePathsAndFixUnc(CDirectoryUtils::logDirectory(), QStringLiteral("removed models %1.json").arg(ts)));
}

View File

@@ -222,8 +222,8 @@ namespace BlackCore
void setupChanged();
private:
//! Save the removed models if any
bool saveRemovedModels();
//! Save the disabled models if any
bool saveDisabledForMatchingModels();
//! The search based implementation
static BlackMisc::Simulation::CAircraftModelList getClosestMatchStepwiseReduceImplementation(const BlackMisc::Simulation::CAircraftModelList &modelSet, const BlackMisc::Simulation::CAircraftMatcherSetup &setup, const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, BlackMisc::CStatusMessageList *log = nullptr);
@@ -303,7 +303,6 @@ namespace BlackCore
BlackMisc::Simulation::CAircraftMatcherSetup m_setup; //!< setup
BlackMisc::Simulation::CAircraftModel m_defaultModel; //!< model to be used as default model
BlackMisc::Simulation::CAircraftModelList m_modelSet; //!< models used for model matching
BlackMisc::Simulation::CAircraftModelList m_removedModels; //!< removed models
BlackMisc::Simulation::CAircraftModelList m_disabledModels; //!< disabled models for matching
BlackMisc::Simulation::CSimulatorInfo m_simulator; //!< simulator (optional)
BlackMisc::Simulation::CMatchingStatistics m_statistics; //!< matching statistics