Ref T298, exclude models from matching configurable

This commit is contained in:
Klaus Basan
2018-08-23 17:50:12 +02:00
parent 109c1554f9
commit a640343433
6 changed files with 148 additions and 89 deletions

View File

@@ -129,6 +129,8 @@ namespace BlackMisc
static const QString combined("by combined code");
static const QString noZeros("scoring, ignore zero scores");
static const QString preferColorLiveries("scoring, prefer color liveries");
static const QString exNoDb("excl.without DB data");
static const QString exExcl("excl.excluded");
switch (modeFlag)
{
@@ -141,6 +143,8 @@ namespace BlackMisc
case ByIcaoOrderAirlineFirst: return icaoAirline;
case ScoreIgnoreZeros: return noZeros;
case ScorePreferColorLiveries: return preferColorLiveries;
case ExcludeNoDbData: return exNoDb;
case ExcludeNoExcluded: return exExcl;
default: break;
}
@@ -184,7 +188,8 @@ namespace BlackMisc
CAircraftMatcherSetup::MatchingMode CAircraftMatcherSetup::matchingMode(
bool byModelString, bool byIcaoDataAircraft1st, bool byIcaoDataAirline1st, bool byFamily, bool byLivery, bool byCombinedType,
bool byMilitary, bool byVtol,
bool scoreIgnoreZeros, bool scorePreferColorLiveries)
bool scoreIgnoreZeros, bool scorePreferColorLiveries,
bool excludeNoDbData, bool excludeNoExcluded)
{
MatchingMode mode = byModelString ? ByModelString : ModeNone;
if (byIcaoDataAircraft1st) { mode |= ByIcaoOrderAircraftFirst; }
@@ -196,6 +201,8 @@ namespace BlackMisc
if (byVtol) { mode |= ByVtol; }
if (scoreIgnoreZeros) { mode |= ScoreIgnoreZeros; }
if (scorePreferColorLiveries) { mode |= ScorePreferColorLiveries; }
if (excludeNoDbData) { mode |= ExcludeNoDbData; }
if (excludeNoExcluded) { mode |= ExcludeNoExcluded; }
return mode;
}
} // namespace

View File

@@ -48,12 +48,16 @@ namespace BlackMisc
// --- score based matching ---
ScoreIgnoreZeros = 1 << 10, //!< zero scores are ignored
ScorePreferColorLiveries = 1 << 11, //!< prefer color liveries
// --- exclusion ---
ExcludeNoDbData = 1 << 12,
ExcludeNoExcluded = 1 << 13,
ExcludeDefault = ExcludeNoExcluded | ExcludeNoDbData,
// --- others ---
ModeNone = 0,
ModeByFLags = ByMilitary | ByVtol,
ModeDefaultScore = ScoreIgnoreZeros | ScorePreferColorLiveries,
ModeDefaultReduce = ModeByFLags | ByModelString | ByFamily | ByManufacturer | ByCombinedType | ByIcaoOrderAircraftFirst | ByLivery,
ModeDefaultReducePlusScore = ModeByFLags | ByModelString | ByFamily | ByManufacturer | ByCombinedType | ByIcaoOrderAircraftFirst | ModeDefaultScore,
ModeDefaultScore = ScoreIgnoreZeros | ScorePreferColorLiveries | ExcludeDefault,
ModeDefaultReduce = ModeByFLags | ByModelString | ByFamily | ByManufacturer | ByCombinedType | ByIcaoOrderAircraftFirst | ByLivery | ExcludeDefault,
ModeDefaultReducePlusScore = ModeByFLags | ByModelString | ByFamily | ByManufacturer | ByCombinedType | ByIcaoOrderAircraftFirst | ModeDefaultScore | ExcludeDefault
};
Q_DECLARE_FLAGS(MatchingMode, MatchingModeFlag)
@@ -136,7 +140,7 @@ namespace BlackMisc
//! Mode by flags
static MatchingMode matchingMode(bool byModelString, bool byIcaoDataAircraft1st, bool byIcaoDataAirline1st,
bool byFamily, bool byLivery, bool byCombinedType, bool byMilitary, bool byVtol,
bool scoreIgnoreZeros, bool scorePreferColorLiveries);
bool scoreIgnoreZeros, bool scorePreferColorLiveries, bool excludeNoDbData, bool excludeNoExcluded);
private:
int m_algorithm = static_cast<int>(MatchingStepwiseReducePlusScoreBased);