mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-30 05:51:23 +08:00
Ref T27, improvements in matcher
* reverseLookupAircraftIcao using CAircraftIcaoCode instead of string * use getCombinedTypeDefaultModel for default model * removed redundant military flag in signature
This commit is contained in:
committed by
Mathew Sutcliffe
parent
8cf79e4ddb
commit
1d5c8edae8
@@ -214,18 +214,19 @@ namespace BlackCore
|
|||||||
// aircraft ICAO if not from DB yet
|
// aircraft ICAO if not from DB yet
|
||||||
if (!model.getAircraftIcaoCode().hasValidDbKey())
|
if (!model.getAircraftIcaoCode().hasValidDbKey())
|
||||||
{
|
{
|
||||||
CAircraftIcaoCode aircraftIcaoUsedForLookup(model.getAircraftIcaoCode());
|
CAircraftIcaoCode reverseIcaoCode(model.getAircraftIcaoCode());
|
||||||
if (!aircraftIcaoUsedForLookup.isLoadedFromDb())
|
if (!reverseIcaoCode.isLoadedFromDb())
|
||||||
{
|
{
|
||||||
aircraftIcaoUsedForLookup = CAircraftMatcher::reverseLookupAircraftIcao(aircraftIcaoUsedForLookup.getDesignator(), callsign, log);
|
reverseIcaoCode = CAircraftMatcher::reverseLookupAircraftIcao(reverseIcaoCode, callsign, log);
|
||||||
if (aircraftIcaoUsedForLookup.isLoadedFromDb())
|
if (reverseIcaoCode.isLoadedFromDb())
|
||||||
{
|
{
|
||||||
if (log) { CMatchingUtils::addLogDetailsToList(log, callsign, QString("Set aircraft ICAO to '%1' from DB").arg(aircraftIcaoUsedForLookup.getCombinedIcaoStringWithKey())); }
|
if (log) { CMatchingUtils::addLogDetailsToList(log, callsign, QString("Set aircraft ICAO to '%1' from DB").arg(reverseIcaoCode.getCombinedIcaoStringWithKey())); }
|
||||||
|
model.setAircraftIcaoCode(reverseIcaoCode);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// no DB data, we update as much as possible
|
// no DB data
|
||||||
if (log) { CMatchingUtils::addLogDetailsToList(log, callsign, QString("Reverse lookup, ICAO '%1' not resolved from DB").arg(aircraftIcaoUsedForLookup.getDesignator())); }
|
if (log) { CMatchingUtils::addLogDetailsToList(log, callsign, QString("Reverse lookup, ICAO '%1' not resolved from DB").arg(reverseIcaoCode.getDesignator())); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -244,30 +245,32 @@ namespace BlackCore
|
|||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAircraftIcaoCode CAircraftMatcher::reverseLookupAircraftIcao(const QString &icaoDesignator, const CCallsign &callsign, CStatusMessageList *log)
|
CAircraftIcaoCode CAircraftMatcher::reverseLookupAircraftIcao(const CAircraftIcaoCode &icaoCandidate, const CCallsign &logCallsign, CStatusMessageList *log)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(sApp, Q_FUNC_INFO, "Missing sApp");
|
Q_ASSERT_X(sApp, Q_FUNC_INFO, "Missing sApp");
|
||||||
Q_ASSERT_X(sApp->getWebDataServices(), Q_FUNC_INFO, "No web services");
|
Q_ASSERT_X(sApp->getWebDataServices(), Q_FUNC_INFO, "No web services");
|
||||||
|
|
||||||
const QString designator(icaoDesignator.trimmed().toUpper());
|
const QString designator(icaoCandidate.getDesignator());
|
||||||
CAircraftIcaoCodeList groupedIcaos = sApp->getWebDataServices()->getAircraftIcaoCodesForDesignator(icaoDesignator).groupByDesignatorAndManufacturer();
|
CAircraftIcaoCodeList foundIcaos = sApp->getWebDataServices()->getAircraftIcaoCodesForDesignator(designator);
|
||||||
if (groupedIcaos.isEmpty())
|
foundIcaos.sortByRank();
|
||||||
|
|
||||||
|
if (foundIcaos.isEmpty())
|
||||||
{
|
{
|
||||||
CAircraftIcaoCode icao(designator);
|
CAircraftIcaoCode icao(designator);
|
||||||
|
|
||||||
// sometimes from network we receive something like "CESSNA C172"
|
// sometimes from network we receive something like "CESSNA C172"
|
||||||
if (CAircraftIcaoCode::isValidDesignator(designator))
|
if (CAircraftIcaoCode::isValidDesignator(designator))
|
||||||
{
|
{
|
||||||
CMatchingUtils::addLogDetailsToList(log, callsign, QString("Reverse lookup of ICAO '%1' did not find anything, using smart search").arg(designator), CAircraftMatcher::getLogCategories());
|
CMatchingUtils::addLogDetailsToList(log, logCallsign, QString("Reverse lookup of ICAO '%1' did not find anything, using smart search").arg(designator), CAircraftMatcher::getLogCategories());
|
||||||
icao = sApp->getWebDataServices()->smartAircraftIcaoSelector(icaoDesignator);
|
icao = sApp->getWebDataServices()->smartAircraftIcaoSelector(icaoCandidate);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CMatchingUtils::addLogDetailsToList(log, callsign, QString("Reverse lookup of invalid ICAO code '%1' did not find anything so far").arg(designator), CAircraftMatcher::getLogCategories());
|
CMatchingUtils::addLogDetailsToList(log, logCallsign, QString("Reverse lookup of invalid ICAO code '%1' did not find anything so far").arg(designator), CAircraftMatcher::getLogCategories());
|
||||||
QStringList parts(icaoDesignator.split(' '));
|
const QStringList parts(designator.split(' '));
|
||||||
for (const QString &p : parts)
|
for (const QString &p : parts)
|
||||||
{
|
{
|
||||||
CMatchingUtils::addLogDetailsToList(log, callsign, QString("Trying parts, now reverse lookup of ICAO '%1' using smart search").arg(p), CAircraftMatcher::getLogCategories());
|
CMatchingUtils::addLogDetailsToList(log, logCallsign, QString("Trying parts, now reverse lookup of ICAO '%1' using smart search").arg(p), CAircraftMatcher::getLogCategories());
|
||||||
icao = sApp->getWebDataServices()->smartAircraftIcaoSelector(p);
|
icao = sApp->getWebDataServices()->smartAircraftIcaoSelector(p);
|
||||||
if (icao.isLoadedFromDb()) break;
|
if (icao.isLoadedFromDb()) break;
|
||||||
}
|
}
|
||||||
@@ -275,35 +278,38 @@ namespace BlackCore
|
|||||||
if (icao.isLoadedFromDb())
|
if (icao.isLoadedFromDb())
|
||||||
{
|
{
|
||||||
// smart search found DB data
|
// smart search found DB data
|
||||||
groupedIcaos = CAircraftIcaoCodeList({icao});
|
foundIcaos = CAircraftIcaoCodeList({icao});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CMatchingUtils::addLogDetailsToList(log, callsign, QString("No DB data for ICAO '%1', valid ICAO?").arg(designator), CAircraftMatcher::getLogCategories());
|
CMatchingUtils::addLogDetailsToList(log, logCallsign, QString("No DB data for ICAO '%1', valid ICAO?").arg(designator), CAircraftMatcher::getLogCategories());
|
||||||
return CAircraftIcaoCode(icaoDesignator);
|
return CAircraftIcaoCode(icaoCandidate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (groupedIcaos.size() < 1)
|
if (foundIcaos.size() < 1)
|
||||||
{
|
{
|
||||||
CMatchingUtils::addLogDetailsToList(log, callsign, QString("Reverse lookup of ICAO '%1'', nothing found").arg(designator), CAircraftMatcher::getLogCategories());
|
CMatchingUtils::addLogDetailsToList(log, logCallsign, QString("Reverse lookup of ICAO '%1'', nothing found").arg(designator), CAircraftMatcher::getLogCategories());
|
||||||
return CAircraftIcaoCode(icaoDesignator);
|
return CAircraftIcaoCode(icaoCandidate);
|
||||||
}
|
}
|
||||||
else if (groupedIcaos.size() == 1)
|
else if (foundIcaos.size() == 1)
|
||||||
{
|
{
|
||||||
const CAircraftIcaoCode icao(groupedIcaos.front());
|
const CAircraftIcaoCode icao(foundIcaos.front());
|
||||||
CMatchingUtils::addLogDetailsToList(log, callsign, QString("Reverse lookup of ICAO '%1'', found one manufacturer '%2'").arg(designator, icao.getDesignatorManufacturer()), CAircraftMatcher::getLogCategories());
|
CMatchingUtils::addLogDetailsToList(log, logCallsign, QString("Reverse lookup of ICAO '%1'', found one manufacturer '%2'").arg(designator, icao.getDesignatorManufacturer()), CAircraftMatcher::getLogCategories());
|
||||||
return icao;
|
return icao;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// copy over those data I am sure about
|
// multiple ICAOs
|
||||||
CAircraftIcaoCode icao = groupedIcaos.front();
|
bool reduced = false;
|
||||||
|
foundIcaos.groupByDesignatorAndManufacturer();
|
||||||
|
ifPossibleReduceAircraftIcaoByManufacturer(icaoCandidate, foundIcaos, "Reverse lookup reduction", reduced, logCallsign, log);
|
||||||
|
CAircraftIcaoCode icao = foundIcaos.front();
|
||||||
icao = CAircraftIcaoCode(icao.getDesignator(), icao.getIataCode(), "", "", icao.getWtc(), icao.isRealWorld(), icao.isLegacyAircraft(), icao.isMilitary(), 10);
|
icao = CAircraftIcaoCode(icao.getDesignator(), icao.getIataCode(), "", "", icao.getWtc(), icao.isRealWorld(), icao.isLegacyAircraft(), icao.isMilitary(), 10);
|
||||||
CMatchingUtils::addLogDetailsToList(log, callsign, QString("Reverse lookup of ICAO '%1'', found >1 manufacturer (ambiguous), using ICAO '%2'").arg(designator, icao.toQString()), CAircraftMatcher::getLogCategories());
|
CMatchingUtils::addLogDetailsToList(log, logCallsign, QString("Reverse lookup of ICAO '%1'', found >1 manufacturer (ambiguous), using ICAO '%2'").arg(designator, icao.toQString()), CAircraftMatcher::getLogCategories());
|
||||||
return icao;
|
return icao;
|
||||||
}
|
}
|
||||||
return CAircraftIcaoCode(icaoDesignator);
|
return CAircraftIcaoCode(icaoCandidate);
|
||||||
}
|
}
|
||||||
|
|
||||||
CAirlineIcaoCode BlackCore::CAircraftMatcher::reverseLookupAirlineIcao(const QString &icaoDesignator, const CCallsign &callsign, CStatusMessageList *log)
|
CAirlineIcaoCode BlackCore::CAircraftMatcher::reverseLookupAirlineIcao(const QString &icaoDesignator, const CCallsign &callsign, CStatusMessageList *log)
|
||||||
@@ -507,26 +513,22 @@ namespace BlackCore
|
|||||||
// the last resort is to use the combined type
|
// the last resort is to use the combined type
|
||||||
if (mode.testFlag(ByCombinedType) && matchedModels.isEmpty() && remoteAircraft.getModel().getAircraftIcaoCode().hasValidCombinedType())
|
if (mode.testFlag(ByCombinedType) && matchedModels.isEmpty() && remoteAircraft.getModel().getAircraftIcaoCode().hasValidCombinedType())
|
||||||
{
|
{
|
||||||
const QString combinedType(remoteAircraft.getModel().getAircraftIcaoCode().getCombinedType());
|
const CAircraftModel defaultModel = getCombinedTypeDefaultModel(modelSet, remoteAircraft, log);
|
||||||
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, "Searching by combined type '" + combinedType + "'", getLogCategories());
|
matchedModels.push_back(defaultModel);
|
||||||
matchedModels = matchedModels.findByCombinedType(combinedType);
|
|
||||||
if (!matchedModels.isEmpty())
|
|
||||||
{
|
|
||||||
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, "Found " + QString::number(matchedModels.size()) + " by combined type '" + combinedType + "'", getLogCategories());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// here we have a list of possible models, we reduce/refine further
|
// here we have a list of possible models, we reduce/refine further
|
||||||
if (!matchedModels.isEmpty())
|
if (matchedModels.size() > 1)
|
||||||
{
|
{
|
||||||
const bool military = remoteAircraft.getModel().isMilitary();
|
|
||||||
matchedModels = ifPossibleReduceByManufacturer(remoteAircraft, matchedModels, "2nd pass", reduced, log);
|
matchedModels = ifPossibleReduceByManufacturer(remoteAircraft, matchedModels, "2nd pass", reduced, log);
|
||||||
matchedModels = ifPossibleReduceByMilitaryFlag(remoteAircraft, military, matchedModels, reduced, log);
|
matchedModels = ifPossibleReduceByMilitaryFlag(remoteAircraft, matchedModels, reduced, log);
|
||||||
}
|
}
|
||||||
|
|
||||||
// expect first to be the right one in order
|
// expect first to be the right one in order
|
||||||
if (matchedModels.isEmpty())
|
if (matchedModels.isEmpty())
|
||||||
{
|
{
|
||||||
|
// in any case return hardwired default
|
||||||
|
// normally I would not expect this to be called, as the combined code default should at least yield one model
|
||||||
matchedModel = getDefaultModel();
|
matchedModel = getDefaultModel();
|
||||||
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, "Using default model (nothing else found)", getLogCategories());
|
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, "Using default model (nothing else found)", getLogCategories());
|
||||||
}
|
}
|
||||||
@@ -596,25 +598,67 @@ namespace BlackCore
|
|||||||
CAircraftModel matchedModel;
|
CAircraftModel matchedModel;
|
||||||
if (map.isEmpty())
|
if (map.isEmpty())
|
||||||
{
|
{
|
||||||
matchedModel = getDefaultModel();
|
matchedModel = getCombinedTypeDefaultModel(modelSet, remoteAircraft, log);
|
||||||
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, "Using default model (nothing else found)", getLogCategories());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const int maxScore = map.lastKey();
|
const int maxScore = map.lastKey();
|
||||||
const CAircraftModelList maxScoreAircraft(map.values(maxScore));
|
const CAircraftModelList maxScoreAircraft(map.values(maxScore));
|
||||||
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, QString("Scores: %1").arg(scoresToString(map).replace("\n", "<br>")), getLogCategories());
|
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, QString("Scores: %1").arg(scoresToString(map)), getLogCategories());
|
||||||
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, QString("Scoring with score %1 out of %2 models yielded %3 models").arg(maxScore).arg(map.size()).arg(maxScoreAircraft.size()), getLogCategories());
|
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, QString("Scoring with score %1 out of %2 models yielded %3 models").arg(maxScore).arg(map.size()).arg(maxScoreAircraft.size()), getLogCategories());
|
||||||
|
|
||||||
const CAircraftModel pickedModel = (maxScoreAircraft.size() > 1) ?
|
const CAircraftModel pickedModel = (maxScoreAircraft.size() > 1) ?
|
||||||
maxScoreAircraft.randomElements(1).front() :
|
maxScoreAircraft.randomElements(1).front() :
|
||||||
maxScoreAircraft.front();
|
maxScoreAircraft.front();
|
||||||
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, QString("Picked with score %1: %2").arg(maxScore).arg(pickedModel.toQString()), getLogCategories());
|
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, QString("Picked with score %1: '%2'").arg(maxScore).arg(pickedModel.toQString()), getLogCategories());
|
||||||
return pickedModel;
|
return pickedModel;
|
||||||
}
|
}
|
||||||
return matchedModel;
|
return matchedModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CAircraftModel CAircraftMatcher::getCombinedTypeDefaultModel(const CAircraftModelList &modelSet, const CSimulatedAircraft &remoteAircraft, CStatusMessageList *log) const
|
||||||
|
{
|
||||||
|
const QString combinedType = remoteAircraft.getAircraftIcaoCombinedType();
|
||||||
|
if (combinedType.isEmpty())
|
||||||
|
{
|
||||||
|
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, "No combined type, using default", getLogCategories(), CStatusMessage::SeverityInfo);
|
||||||
|
return this->getDefaultModel();
|
||||||
|
}
|
||||||
|
if (modelSet.isEmpty())
|
||||||
|
{
|
||||||
|
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, "No models, using default", getLogCategories(), CStatusMessage::SeverityError);
|
||||||
|
return this->getDefaultModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, "Searching by combined type with color livery '" + combinedType + "'", getLogCategories());
|
||||||
|
CAircraftModelList matchedModels = modelSet.findByCombinedTypeWithColorLivery(combinedType);
|
||||||
|
if (!matchedModels.isEmpty())
|
||||||
|
{
|
||||||
|
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, "Found " + QString::number(matchedModels.size()) + " by combined type w/color livery '" + combinedType + "'", getLogCategories());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, "Searching by combined type '" + combinedType + "'", getLogCategories());
|
||||||
|
matchedModels = matchedModels.findByCombinedType(combinedType);
|
||||||
|
if (!matchedModels.isEmpty())
|
||||||
|
{
|
||||||
|
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, "Found " + QString::number(matchedModels.size()) + " by combined '" + combinedType + "'", getLogCategories());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// here we have a list of possible models, we reduce/refine further
|
||||||
|
if (matchedModels.size() > 1)
|
||||||
|
{
|
||||||
|
bool reduced = false;
|
||||||
|
matchedModels = ifPossibleReduceByManufacturer(remoteAircraft, matchedModels, "combined code reduction", reduced, log);
|
||||||
|
matchedModels = ifPossibleReduceByMilitaryFlag(remoteAircraft, matchedModels, reduced, log);
|
||||||
|
}
|
||||||
|
|
||||||
|
// return
|
||||||
|
if (matchedModels.isEmpty()) { return getDefaultModel(); }
|
||||||
|
return matchedModels.front();
|
||||||
|
}
|
||||||
|
|
||||||
CAircraftModel CAircraftMatcher::matchByExactModelString(const CSimulatedAircraft &remoteAircraft, const CAircraftModelList &models, CStatusMessageList *log)
|
CAircraftModel CAircraftMatcher::matchByExactModelString(const CSimulatedAircraft &remoteAircraft, const CAircraftModelList &models, CStatusMessageList *log)
|
||||||
{
|
{
|
||||||
if (remoteAircraft.getModelString().isEmpty())
|
if (remoteAircraft.getModelString().isEmpty())
|
||||||
@@ -771,6 +815,34 @@ namespace BlackCore
|
|||||||
return outList;
|
return outList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CAircraftIcaoCodeList CAircraftMatcher::ifPossibleReduceAircraftIcaoByManufacturer(const CAircraftIcaoCode &icaoCode, const CAircraftIcaoCodeList &inList, const QString &info, bool &reduced, const CCallsign &logCallsign, CStatusMessageList *log)
|
||||||
|
{
|
||||||
|
reduced = false;
|
||||||
|
if (inList.isEmpty())
|
||||||
|
{
|
||||||
|
if (log) { CMatchingUtils::addLogDetailsToList(log, logCallsign, info + " " + "Empty input list, cannot reduce", getLogCategories()); }
|
||||||
|
return inList;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString m = icaoCode.getManufacturer();
|
||||||
|
if (m.isEmpty())
|
||||||
|
{
|
||||||
|
if (log) { CMatchingUtils::addLogDetailsToList(log, logCallsign, info + " No manufacturer, cannot reduce " + QString::number(inList.size()) + " entries", getLogCategories()); }
|
||||||
|
return inList;
|
||||||
|
}
|
||||||
|
|
||||||
|
const CAircraftIcaoCodeList outList(inList.findByManufacturer(m));
|
||||||
|
if (outList.isEmpty())
|
||||||
|
{
|
||||||
|
if (log) { CMatchingUtils::addLogDetailsToList(log, logCallsign, info + " Not found " + m + ", cannot reduce", getLogCategories()); }
|
||||||
|
return inList;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (log) { CMatchingUtils::addLogDetailsToList(log, logCallsign, info + " Reduced by " + m + " results: " + QString::number(outList.size()), getLogCategories()); }
|
||||||
|
reduced = true;
|
||||||
|
return outList;
|
||||||
|
}
|
||||||
|
|
||||||
CAircraftModelList CAircraftMatcher::ifPossibleReduceByAirline(const CSimulatedAircraft &remoteAircraft, const CAircraftModelList &inList, const QString &info, bool &reduced, CStatusMessageList *log)
|
CAircraftModelList CAircraftMatcher::ifPossibleReduceByAirline(const CSimulatedAircraft &remoteAircraft, const CAircraftModelList &inList, const QString &info, bool &reduced, CStatusMessageList *log)
|
||||||
{
|
{
|
||||||
reduced = false;
|
reduced = false;
|
||||||
@@ -825,14 +897,15 @@ namespace BlackCore
|
|||||||
return byCombinedCode;
|
return byCombinedCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAircraftModelList CAircraftMatcher::ifPossibleReduceByMilitaryFlag(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, bool military, const CAircraftModelList &inList, bool &reduced, CStatusMessageList *log)
|
CAircraftModelList CAircraftMatcher::ifPossibleReduceByMilitaryFlag(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, const CAircraftModelList &inList, bool &reduced, CStatusMessageList *log)
|
||||||
{
|
{
|
||||||
reduced = false;
|
reduced = false;
|
||||||
CAircraftModelList byMilitaryFlag(inList.findByMilitaryFlag(military));
|
const bool military = remoteAircraft.getModel().isMilitary();
|
||||||
|
const CAircraftModelList byMilitaryFlag(inList.findByMilitaryFlag(military));
|
||||||
const QString mil(military ? "military" : "civilian");
|
const QString mil(military ? "military" : "civilian");
|
||||||
if (byMilitaryFlag.isEmpty())
|
if (byMilitaryFlag.isEmpty())
|
||||||
{
|
{
|
||||||
if (log) { CMatchingUtils::addLogDetailsToList(log, remoteAircraft, "Not found by " + mil, getLogCategories()); }
|
if (log) { CMatchingUtils::addLogDetailsToList(log, remoteAircraft, "Models not found by " + mil, getLogCategories()); }
|
||||||
return inList;
|
return inList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -840,11 +913,11 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
if (inList.size() > byMilitaryFlag.size())
|
if (inList.size() > byMilitaryFlag.size())
|
||||||
{
|
{
|
||||||
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, "Reduced to " + mil + " aircraft, size " + QString::number(byMilitaryFlag.size()), getLogCategories());
|
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, "Models reduced to " + mil + " aircraft, size " + QString::number(byMilitaryFlag.size()), getLogCategories());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, "Not reduced by " + mil + ", size " + QString::number(byMilitaryFlag.size()), getLogCategories());
|
CMatchingUtils::addLogDetailsToList(log, remoteAircraft, "Models not reduced by " + mil + ", size " + QString::number(byMilitaryFlag.size()), getLogCategories());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return byMilitaryFlag;
|
return byMilitaryFlag;
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
//! Try to find the DB corresponding ICAO code
|
//! Try to find the DB corresponding ICAO code
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
static BlackMisc::Aviation::CAircraftIcaoCode reverseLookupAircraftIcao(const QString &icaoDesignator, const BlackMisc::Aviation::CCallsign &callsign = BlackMisc::Aviation::CCallsign(), BlackMisc::CStatusMessageList *log = nullptr);
|
static BlackMisc::Aviation::CAircraftIcaoCode reverseLookupAircraftIcao(const BlackMisc::Aviation::CAircraftIcaoCode &icaoDesignator, const BlackMisc::Aviation::CCallsign &logCallsign = BlackMisc::Aviation::CCallsign(), BlackMisc::CStatusMessageList *log = nullptr);
|
||||||
|
|
||||||
//! Try to find the DB corresponding ICAO code
|
//! Try to find the DB corresponding ICAO code
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
@@ -112,7 +112,7 @@ namespace BlackCore
|
|||||||
//! Default model
|
//! Default model
|
||||||
const BlackMisc::Simulation::CAircraftModel &getDefaultModel() const;
|
const BlackMisc::Simulation::CAircraftModel &getDefaultModel() const;
|
||||||
|
|
||||||
//! Set default model
|
//! Set default model, can be set by driver specific for simulator
|
||||||
void setDefaultModel(const BlackMisc::Simulation::CAircraftModel &defaultModel);
|
void setDefaultModel(const BlackMisc::Simulation::CAircraftModel &defaultModel);
|
||||||
|
|
||||||
//! The current statistics
|
//! The current statistics
|
||||||
@@ -129,10 +129,16 @@ namespace BlackCore
|
|||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
BlackMisc::Simulation::CAircraftModel getClosestMatchSearchImplementation(MatchingMode mode, const BlackMisc::Simulation::CAircraftModelList &modelSet, const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, BlackMisc::CStatusMessageList *log = nullptr) const;
|
BlackMisc::Simulation::CAircraftModel getClosestMatchSearchImplementation(MatchingMode mode, const BlackMisc::Simulation::CAircraftModelList &modelSet, const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, BlackMisc::CStatusMessageList *log = nullptr) const;
|
||||||
|
|
||||||
//! The search based implementation
|
//! The score based implementation
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
BlackMisc::Simulation::CAircraftModel getClosestMatchScoreImplementation(MatchingMode mode, const BlackMisc::Simulation::CAircraftModelList &modelSet, const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, BlackMisc::CStatusMessageList *log = nullptr) const;
|
BlackMisc::Simulation::CAircraftModel getClosestMatchScoreImplementation(MatchingMode mode, const BlackMisc::Simulation::CAircraftModelList &modelSet, const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, BlackMisc::CStatusMessageList *log = nullptr) const;
|
||||||
|
|
||||||
|
//! Get combined type default model, i.e. get a default model under consideration of the combined code such as "L2J"
|
||||||
|
//! \see BlackMisc::Simulation::CSimulatedAircraft::getAircraftIcaoCombinedType
|
||||||
|
//! \remark in any case a (default) model is returned
|
||||||
|
//! \threadsafe
|
||||||
|
BlackMisc::Simulation::CAircraftModel getCombinedTypeDefaultModel(const BlackMisc::Simulation::CAircraftModelList &modelSet, const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, BlackMisc::CStatusMessageList *log = nullptr) const;
|
||||||
|
|
||||||
//! Search in models by key (aka model string)
|
//! Search in models by key (aka model string)
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
static BlackMisc::Simulation::CAircraftModel matchByExactModelString(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, const BlackMisc::Simulation::CAircraftModelList &models, BlackMisc::CStatusMessageList *log);
|
static BlackMisc::Simulation::CAircraftModel matchByExactModelString(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, const BlackMisc::Simulation::CAircraftModelList &models, BlackMisc::CStatusMessageList *log);
|
||||||
@@ -151,7 +157,11 @@ namespace BlackCore
|
|||||||
|
|
||||||
//! Reduce by manufacturer
|
//! Reduce by manufacturer
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
static BlackMisc::Simulation::CAircraftModelList ifPossibleReduceByManufacturer(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, const BlackMisc::Simulation::CAircraftModelList &inList, const QString &info, bool &reduceed, BlackMisc::CStatusMessageList *log);
|
static BlackMisc::Simulation::CAircraftModelList ifPossibleReduceByManufacturer(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, const BlackMisc::Simulation::CAircraftModelList &inList, const QString &info, bool &reduced, BlackMisc::CStatusMessageList *log);
|
||||||
|
|
||||||
|
//! Reduce by manufacturer
|
||||||
|
//! \threadsafe
|
||||||
|
static BlackMisc::Aviation::CAircraftIcaoCodeList ifPossibleReduceAircraftIcaoByManufacturer(const BlackMisc::Aviation::CAircraftIcaoCode &icaoCode, const BlackMisc::Aviation::CAircraftIcaoCodeList &inList, const QString &info, bool &reduced, const BlackMisc::Aviation::CCallsign &logCallsign, BlackMisc::CStatusMessageList *log);
|
||||||
|
|
||||||
//! Reduce by airline ICAO
|
//! Reduce by airline ICAO
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
@@ -163,7 +173,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
//! By military flag
|
//! By military flag
|
||||||
//! \threadsafe
|
//! \threadsafe
|
||||||
static BlackMisc::Simulation::CAircraftModelList ifPossibleReduceByMilitaryFlag(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, bool military, const BlackMisc::Simulation::CAircraftModelList &inList, bool &reduced, BlackMisc::CStatusMessageList *log);
|
static BlackMisc::Simulation::CAircraftModelList ifPossibleReduceByMilitaryFlag(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, const BlackMisc::Simulation::CAircraftModelList &inList, bool &reduced, BlackMisc::CStatusMessageList *log);
|
||||||
|
|
||||||
//! Scores to string for debugging
|
//! Scores to string for debugging
|
||||||
static QString scoresToString(const BlackMisc::Simulation::ScoredModels &scores, int lastElements = 5);
|
static QString scoresToString(const BlackMisc::Simulation::ScoredModels &scores, int lastElements = 5);
|
||||||
|
|||||||
Reference in New Issue
Block a user