mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
Ref T776, matching flag "ForceModeFlag"
This commit is contained in:
committed by
Mat Sutcliffe
parent
fd3ad207bd
commit
6841297c6e
@@ -97,9 +97,10 @@ namespace BlackMisc
|
||||
|
||||
QString CAircraftMatcherSetup::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return u"algorithm: '" % this->getMatchingAlgorithmAsString() %
|
||||
u"' mode: '" % this->getMatchingModeAsString() %
|
||||
Q_UNUSED(i18n)
|
||||
return u"algorithm: '" % this->getMatchingAlgorithmAsString() %
|
||||
u"' mode: '" % this->getMatchingModeAsString() %
|
||||
u"' force: '" % this->getForceModeAsString() %
|
||||
u"' strategy: '" % this->getPickStrategyAsString() %
|
||||
u"\' matching script: " % boolToOnOff(m_msReverseEnabled) % u'/' % boolToOnOff(m_msMatchingEnabled);
|
||||
}
|
||||
@@ -113,6 +114,7 @@ namespace BlackMisc
|
||||
case IndexMatchingAlgorithm: return CVariant::fromValue(m_algorithm);
|
||||
case IndexMatchingMode: return CVariant::fromValue(m_mode);
|
||||
case IndexPickStrategy: return CVariant::fromValue(m_strategy);
|
||||
case IndexForceMode: return CVariant::fromValue(m_force);
|
||||
case IndexMsNetworkEntryFile: return CVariant::fromValue(m_msReverseLookupFile);
|
||||
case IndexMsMatchingStageFile: return CVariant::fromValue(m_msMatchingStageFile);
|
||||
case IndexMsNetworkEnabled: return CVariant::fromValue(m_msReverseEnabled);
|
||||
@@ -129,7 +131,8 @@ namespace BlackMisc
|
||||
switch (i)
|
||||
{
|
||||
case IndexMatchingAlgorithm: m_algorithm = variant.toInt(); break;
|
||||
case IndexMatchingMode: m_mode = variant.toInt(); break;
|
||||
case IndexMatchingMode: m_mode = variant.toInt(); break;
|
||||
case IndexForceMode: m_force = variant.toInt(); break;
|
||||
case IndexPickStrategy: m_strategy = variant.toInt(); break;
|
||||
case IndexMsNetworkEntryFile: m_msReverseLookupFile = variant.toQString(); break;
|
||||
case IndexMsMatchingStageFile: m_msMatchingStageFile = variant.toQString(); break;
|
||||
@@ -280,6 +283,36 @@ namespace BlackMisc
|
||||
return modes.join(", ");
|
||||
}
|
||||
|
||||
const QString &CAircraftMatcherSetup::forceFlagToString(CAircraftMatcherSetup::ForceModeFlag forceFlag)
|
||||
{
|
||||
static const QString t("type");
|
||||
static const QString ec("engine count");
|
||||
static const QString e("engine");
|
||||
static const QString n("nothing");
|
||||
|
||||
switch (forceFlag)
|
||||
{
|
||||
case ForceType: return t;
|
||||
case ForceEnginecount: return ec;
|
||||
case ForceEngine: return e;
|
||||
case ForceNothing:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
const QString CAircraftMatcherSetup::forceToString(ForceMode force)
|
||||
{
|
||||
if (force.testFlag(ForceNothing)) { return QStringLiteral("nothing"); }
|
||||
|
||||
QStringList forces;
|
||||
if (force.testFlag(ForceType)) { forces << forceToString(ForceType); }
|
||||
if (force.testFlag(ForceEnginecount)) { forces << forceToString(ForceEnginecount); }
|
||||
if (force.testFlag(ForceEngine)) { forces << forceToString(ForceEngine); }
|
||||
return forces.join(", ");
|
||||
}
|
||||
|
||||
const QString &CAircraftMatcherSetup::strategyToString(CAircraftMatcherSetup::PickSimilarStrategy strategy)
|
||||
{
|
||||
static const QString f("first");
|
||||
|
||||
@@ -87,6 +87,16 @@ namespace BlackMisc
|
||||
};
|
||||
Q_DECLARE_FLAGS(MatchingMode, MatchingModeFlag)
|
||||
|
||||
//! Force values
|
||||
enum ForceModeFlag
|
||||
{
|
||||
ForceNothing = 0,
|
||||
ForceType = 1 << 0,
|
||||
ForceEnginecount = 1 << 1,
|
||||
ForceEngine = 1 << 2
|
||||
};
|
||||
Q_DECLARE_FLAGS(ForceMode, ForceModeFlag)
|
||||
|
||||
//! How to pick among similar candiates
|
||||
enum PickSimilarStrategy
|
||||
{
|
||||
@@ -100,6 +110,7 @@ namespace BlackMisc
|
||||
{
|
||||
IndexMatchingAlgorithm = CPropertyIndex::GlobalIndexCAircraftMatcherSetup,
|
||||
IndexMatchingMode,
|
||||
IndexForceMode,
|
||||
IndexPickStrategy,
|
||||
IndexMsNetworkEntryFile,
|
||||
IndexMsMatchingStageFile,
|
||||
@@ -128,6 +139,15 @@ namespace BlackMisc
|
||||
//! Matching mode
|
||||
MatchingMode getMatchingMode() const { return static_cast<MatchingMode>(m_mode); }
|
||||
|
||||
//! Force mode
|
||||
ForceMode getForceMode() const { return static_cast<ForceMode>(m_force); }
|
||||
|
||||
//! Force mode
|
||||
void setForceMode(ForceMode fm) { m_force = static_cast<int>(fm); }
|
||||
|
||||
//! Force mode as string
|
||||
QString getForceModeAsString() const { return forceToString(this->getForceMode()); }
|
||||
|
||||
//! Reverse lookup @{
|
||||
bool isReverseLookupModelString() const;
|
||||
bool isReverseLookupSwiftLiveryIds() const;
|
||||
@@ -228,22 +248,29 @@ namespace BlackMisc
|
||||
//! Enumeration as string
|
||||
static QString modeToString(MatchingMode mode);
|
||||
|
||||
//! Force flag to string
|
||||
static const QString &forceFlagToString(ForceModeFlag forceFlag);
|
||||
|
||||
//! Force to string
|
||||
static const QString forceToString(ForceMode force);
|
||||
|
||||
//! Strategy to string
|
||||
static const QString &strategyToString(PickSimilarStrategy strategy);
|
||||
|
||||
//! Mode by flags
|
||||
static MatchingMode matchingMode(bool revModelString, bool revLiveryIds,
|
||||
bool byModelString, bool byIcaoDataAircraft1st, bool byIcaoDataAirline1st,
|
||||
bool byFamily, bool byLivery, bool byCombinedType,
|
||||
static MatchingMode matchingMode(bool revModelString, bool revLiveryIds,
|
||||
bool byModelString, bool byIcaoDataAircraft1st, bool byIcaoDataAirline1st,
|
||||
bool byFamily, bool byLivery, bool byCombinedType,
|
||||
bool byForceMilitary, bool byForceCivilian,
|
||||
bool byVtol, bool byGliderCategory, bool byMilitaryCategory, bool bySmallAircraftCategory,
|
||||
bool scoreIgnoreZeros, bool scorePreferColorLiveries, bool excludeNoDbData, bool excludeNoExcluded,
|
||||
bool byVtol, bool byGliderCategory, bool byMilitaryCategory, bool bySmallAircraftCategory,
|
||||
bool scoreIgnoreZeros, bool scorePreferColorLiveries, bool excludeNoDbData, bool excludeNoExcluded,
|
||||
bool modelVerification, bool modelVerificationWarnError, bool modelSetRemoveFailedModel, bool modelFailover);
|
||||
|
||||
private:
|
||||
int m_algorithm = static_cast<int>(MatchingStepwiseReducePlusScoreBased);
|
||||
int m_mode = static_cast<int>(ModeDefaultReducePlusScore);
|
||||
int m_strategy = static_cast<int>(PickByOrder);
|
||||
int m_force = static_cast<int>(ForceNothing);
|
||||
QString m_msReverseLookupFile; //!< network entry matching script file
|
||||
QString m_msMatchingStageFile; //!< matching stage matching script file
|
||||
bool m_msReverseEnabled = false; //!< enable network matching script
|
||||
@@ -254,6 +281,7 @@ namespace BlackMisc
|
||||
BLACK_METAMEMBER(algorithm),
|
||||
BLACK_METAMEMBER(mode),
|
||||
BLACK_METAMEMBER(strategy),
|
||||
BLACK_METAMEMBER(force),
|
||||
BLACK_METAMEMBER(msReverseLookupFile),
|
||||
BLACK_METAMEMBER(msMatchingStageFile),
|
||||
BLACK_METAMEMBER(msReverseEnabled),
|
||||
@@ -267,6 +295,8 @@ Q_DECLARE_METATYPE(BlackMisc::Simulation::CAircraftMatcherSetup)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::CAircraftMatcherSetup::MatchingAlgorithm)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::CAircraftMatcherSetup::MatchingMode)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::CAircraftMatcherSetup::MatchingModeFlag)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::CAircraftMatcherSetup::ForceMode)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::CAircraftMatcherSetup::ForceModeFlag)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::CAircraftMatcherSetup::PickSimilarStrategy)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackMisc::Simulation::CAircraftMatcherSetup::MatchingMode)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user