Ref T472, utility functions for category

This commit is contained in:
Klaus Basan
2019-03-08 17:41:36 +01:00
committed by Mat Sutcliffe
parent 5c46fa3afa
commit 360edca4b3
4 changed files with 29 additions and 3 deletions

View File

@@ -499,6 +499,11 @@ namespace BlackMisc
this->getDbKeyAsStringInParentheses(" ");
}
bool CAircraftIcaoCode::hasCategory() const
{
return !m_category.isNull();
}
bool CAircraftIcaoCode::hasCompleteData() const
{
return hasValidCombinedType() && hasDesignator() && hasValidWtc() && hasManufacturer();
@@ -704,8 +709,14 @@ namespace BlackMisc
const QString &CAircraftIcaoCode::getUnassignedDesignator()
{
static const QString i("ZZZZ");
return i;
static const QString z("ZZZZ");
return z;
}
const QString &CAircraftIcaoCode::getGliderDesignator()
{
static const QString g("GLID");
return g;
}
const CAircraftIcaoCode &CAircraftIcaoCode::unassignedIcao()
@@ -716,7 +727,7 @@ namespace BlackMisc
const QStringList &CAircraftIcaoCode::getSpecialDesignators()
{
static const QStringList s({ "ZZZZ", "SHIP", "BALL", "GLID", "ULAC", "GYRO", "UHEL" });
static const QStringList s({ "ZZZZ", "SHIP", "BALL", getGliderDesignator(), "ULAC", "GYRO", "UHEL" });
return s;
}

View File

@@ -258,6 +258,9 @@ namespace BlackMisc
//! Get category
const CAircraftCategory &getCategory() const { return m_category; }
//! Has category?
bool hasCategory() const;
//! Set category
void setCategory(const CAircraftCategory &category) { m_category = category; }
@@ -330,6 +333,9 @@ namespace BlackMisc
//! The unassigned designator ("ZZZZ")
static const QString &getUnassignedDesignator();
//! Get the glider designator
static const QString &getGliderDesignator();
//! Unassigned ICAO code "ZZZZ"
static const CAircraftIcaoCode &unassignedIcao();

View File

@@ -112,6 +112,12 @@ namespace BlackMisc
this->setPickStrategy(PickByOrder);
}
bool CAircraftMatcherSetup::useCategoryMatching() const
{
const MatchingMode mm = this->getMatchingMode();
return mm.testFlag(ByCategoryGlider) || mm.testFlag(ByCategoryMilitary);
}
const QString &CAircraftMatcherSetup::algorithmToString(CAircraftMatcherSetup::MatchingAlgorithm algorithm)
{
static const QString rs("reduce + score based");

View File

@@ -156,6 +156,9 @@ namespace BlackMisc
//! Reset
void reset(MatchingAlgorithm algorithm);
//! Use category matching
bool useCategoryMatching() const;
//! Algorithm to string
static const QString &algorithmToString(MatchingAlgorithm algorithm);