mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +08:00
Ref T298, matcher setup improvements (score only)
This commit is contained in:
@@ -16,7 +16,7 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
CAircraftMatcherSetup::CAircraftMatcherSetup()
|
CAircraftMatcherSetup::CAircraftMatcherSetup()
|
||||||
{
|
{
|
||||||
this->reset(MatchingScoreBased);
|
this->reset(MatchingStepwiseReducePlusScoreBased);
|
||||||
}
|
}
|
||||||
|
|
||||||
CAircraftMatcherSetup::CAircraftMatcherSetup(CAircraftMatcherSetup::MatchingAlgorithm algorithm)
|
CAircraftMatcherSetup::CAircraftMatcherSetup(CAircraftMatcherSetup::MatchingAlgorithm algorithm)
|
||||||
@@ -50,7 +50,7 @@ namespace BlackMisc
|
|||||||
Q_UNUSED(i18n);
|
Q_UNUSED(i18n);
|
||||||
return QStringLiteral("algorithm: '") % this->getMatchingAlgorithmAsString() %
|
return QStringLiteral("algorithm: '") % this->getMatchingAlgorithmAsString() %
|
||||||
QStringLiteral("' mode: '") % this->getMatchingModeAsString() %
|
QStringLiteral("' mode: '") % this->getMatchingModeAsString() %
|
||||||
QStringLiteral("' strategy: ") % this->getPickStrategyAsString() %
|
QStringLiteral("' strategy: '") % this->getPickStrategyAsString() %
|
||||||
QStringLiteral("'");
|
QStringLiteral("'");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,9 +92,12 @@ namespace BlackMisc
|
|||||||
mode = ModeDefaultReduce;
|
mode = ModeDefaultReduce;
|
||||||
break;
|
break;
|
||||||
case MatchingScoreBased:
|
case MatchingScoreBased:
|
||||||
default:
|
|
||||||
mode = ModeDefaultScore;
|
mode = ModeDefaultScore;
|
||||||
break;
|
break;
|
||||||
|
case MatchingStepwiseReducePlusScoreBased:
|
||||||
|
default:
|
||||||
|
mode = ModeDefaultReducePlusScore;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
this->setMatchingMode(mode);
|
this->setMatchingMode(mode);
|
||||||
this->setPickStrategy(PickByOrder);
|
this->setPickStrategy(PickByOrder);
|
||||||
@@ -102,15 +105,17 @@ namespace BlackMisc
|
|||||||
|
|
||||||
const QString &CAircraftMatcherSetup::algorithmToString(CAircraftMatcherSetup::MatchingAlgorithm algorithm)
|
const QString &CAircraftMatcherSetup::algorithmToString(CAircraftMatcherSetup::MatchingAlgorithm algorithm)
|
||||||
{
|
{
|
||||||
|
static const QString rs("reduce + score based");
|
||||||
static const QString s("score based");
|
static const QString s("score based");
|
||||||
static const QString r("stepwise reduce");
|
static const QString r("stepwise reduce");
|
||||||
switch (algorithm)
|
switch (algorithm)
|
||||||
{
|
{
|
||||||
case MatchingStepwiseReduce: return r;
|
case MatchingStepwiseReduce: return r;
|
||||||
case MatchingScoreBased:
|
case MatchingScoreBased: return s;
|
||||||
|
case MatchingStepwiseReducePlusScoreBased:
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
return s;
|
return rs;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &CAircraftMatcherSetup::modeFlagToString(MatchingModeFlag modeFlag)
|
const QString &CAircraftMatcherSetup::modeFlagToString(MatchingModeFlag modeFlag)
|
||||||
@@ -121,7 +126,7 @@ namespace BlackMisc
|
|||||||
static const QString icaoAirline("by ICAO, airline first");
|
static const QString icaoAirline("by ICAO, airline first");
|
||||||
static const QString family("by family");
|
static const QString family("by family");
|
||||||
static const QString livery("by livery");
|
static const QString livery("by livery");
|
||||||
static const QString combined("by combined combined");
|
static const QString combined("by combined code");
|
||||||
static const QString noZeros("scoring, ignore zero scores");
|
static const QString noZeros("scoring, ignore zero scores");
|
||||||
static const QString preferColorLiveries("scoring, prefer color liveries");
|
static const QString preferColorLiveries("scoring, prefer color liveries");
|
||||||
|
|
||||||
@@ -178,6 +183,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
CAircraftMatcherSetup::MatchingMode CAircraftMatcherSetup::matchingMode(
|
CAircraftMatcherSetup::MatchingMode CAircraftMatcherSetup::matchingMode(
|
||||||
bool byModelString, bool byIcaoDataAircraft1st, bool byIcaoDataAirline1st, bool byFamily, bool byLivery, bool byCombinedType,
|
bool byModelString, bool byIcaoDataAircraft1st, bool byIcaoDataAirline1st, bool byFamily, bool byLivery, bool byCombinedType,
|
||||||
|
bool byMilitary, bool byVtol,
|
||||||
bool scoreIgnoreZeros, bool scorePreferColorLiveries)
|
bool scoreIgnoreZeros, bool scorePreferColorLiveries)
|
||||||
{
|
{
|
||||||
MatchingMode mode = byModelString ? ByModelString : ModeNone;
|
MatchingMode mode = byModelString ? ByModelString : ModeNone;
|
||||||
@@ -186,6 +192,8 @@ namespace BlackMisc
|
|||||||
if (byFamily) { mode |= ByFamily; }
|
if (byFamily) { mode |= ByFamily; }
|
||||||
if (byLivery) { mode |= ByLivery; }
|
if (byLivery) { mode |= ByLivery; }
|
||||||
if (byCombinedType) { mode |= ByCombinedType; }
|
if (byCombinedType) { mode |= ByCombinedType; }
|
||||||
|
if (byMilitary) { mode |= ByMilitary; }
|
||||||
|
if (byVtol) { mode |= ByVtol; }
|
||||||
if (scoreIgnoreZeros) { mode |= ScoreIgnoreZeros; }
|
if (scoreIgnoreZeros) { mode |= ScoreIgnoreZeros; }
|
||||||
if (scorePreferColorLiveries) { mode |= ScorePreferColorLiveries; }
|
if (scorePreferColorLiveries) { mode |= ScorePreferColorLiveries; }
|
||||||
return mode;
|
return mode;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace BlackMisc
|
|||||||
enum MatchingAlgorithm
|
enum MatchingAlgorithm
|
||||||
{
|
{
|
||||||
MatchingScoreBased,
|
MatchingScoreBased,
|
||||||
|
MatchingStepwiseReducePlusScoreBased,
|
||||||
MatchingStepwiseReduce
|
MatchingStepwiseReduce
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -39,16 +40,20 @@ namespace BlackMisc
|
|||||||
ByFamily = 1 << 2,
|
ByFamily = 1 << 2,
|
||||||
ByLivery = 1 << 3,
|
ByLivery = 1 << 3,
|
||||||
ByCombinedType = 1 << 4,
|
ByCombinedType = 1 << 4,
|
||||||
ByIcaoOrderAircraftFirst = (1 << 5) | ByIcaoData,
|
ByManufacturer = 1 << 5,
|
||||||
ByIcaoOrderAirlineFirst = (1 << 6) | ByIcaoData,
|
ByMilitary = 1 << 6,
|
||||||
|
ByVtol = 1 << 7,
|
||||||
|
ByIcaoOrderAircraftFirst = (1 << 8) | ByIcaoData,
|
||||||
|
ByIcaoOrderAirlineFirst = (1 << 9) | ByIcaoData,
|
||||||
// --- score based matching ---
|
// --- score based matching ---
|
||||||
ScoreIgnoreZeros = 1 << 7, //!< zero scores are ignored
|
ScoreIgnoreZeros = 1 << 10, //!< zero scores are ignored
|
||||||
ScorePreferColorLiveries = 1 << 8, //!< prefer color liveries
|
ScorePreferColorLiveries = 1 << 11, //!< prefer color liveries
|
||||||
// --- others ---
|
// --- others ---
|
||||||
ModeNone = 0,
|
ModeNone = 0,
|
||||||
ModeScoreDefault = ScoreIgnoreZeros | ScorePreferColorLiveries,
|
ModeByFLags = ByMilitary | ByVtol,
|
||||||
ModeDefaultScore = ByIcaoOrderAircraftFirst | ByModelString | ByCombinedType | ModeScoreDefault,
|
ModeDefaultScore = ScoreIgnoreZeros | ScorePreferColorLiveries,
|
||||||
ModeDefaultReduce = ByModelString | ByFamily | ByLivery | ByCombinedType | ByIcaoOrderAircraftFirst
|
ModeDefaultReduce = ModeByFLags | ByModelString | ByFamily | ByManufacturer | ByCombinedType | ByIcaoOrderAircraftFirst | ByLivery,
|
||||||
|
ModeDefaultReducePlusScore = ModeByFLags | ByModelString | ByFamily | ByManufacturer | ByCombinedType | ByIcaoOrderAircraftFirst | ModeDefaultScore,
|
||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(MatchingMode, MatchingModeFlag)
|
Q_DECLARE_FLAGS(MatchingMode, MatchingModeFlag)
|
||||||
|
|
||||||
@@ -129,13 +134,13 @@ namespace BlackMisc
|
|||||||
static const QString &strategyToString(PickSimilarStrategy strategy);
|
static const QString &strategyToString(PickSimilarStrategy strategy);
|
||||||
|
|
||||||
//! Mode by flags
|
//! Mode by flags
|
||||||
static MatchingMode matchingMode(
|
static MatchingMode matchingMode(bool byModelString, bool byIcaoDataAircraft1st, bool byIcaoDataAirline1st,
|
||||||
bool byModelString, bool byIcaoDataAircraft1st, bool byIcaoDataAirline1st, bool byFamily, bool byLivery, bool byCombinedType,
|
bool byFamily, bool byLivery, bool byCombinedType, bool byMilitary, bool byVtol,
|
||||||
bool scoreIgnoreZeros, bool scorePreferColorLiveries);
|
bool scoreIgnoreZeros, bool scorePreferColorLiveries);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_algorithm = static_cast<int>(MatchingScoreBased);
|
int m_algorithm = static_cast<int>(MatchingStepwiseReducePlusScoreBased);
|
||||||
int m_mode = static_cast<int>(ModeDefaultScore);
|
int m_mode = static_cast<int>(ModeDefaultReducePlusScore);
|
||||||
int m_strategy = static_cast<int>(PickByOrder);
|
int m_strategy = static_cast<int>(PickByOrder);
|
||||||
|
|
||||||
BLACK_METACLASS(
|
BLACK_METACLASS(
|
||||||
|
|||||||
Reference in New Issue
Block a user