mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
refs #577, better data consolidation/auto find by also using IATA/family
also refs #586, refs #580, refs #576
This commit is contained in:
@@ -135,29 +135,40 @@ namespace BlackMisc
|
||||
if (c.hasCompleteData()) { return c; }
|
||||
}
|
||||
|
||||
CAircraftIcaoCodeList codes(*this); // copy and reduce
|
||||
CAircraftIcaoCodeList codes;
|
||||
if (icaoPattern.hasKnownDesignator())
|
||||
{
|
||||
const QString d(icaoPattern.getDesignator());
|
||||
codes = codes.findByDesignator(d);
|
||||
codes = this->findByDesignator(d);
|
||||
|
||||
// we have an exact match
|
||||
// we have one exact match
|
||||
if (codes.size() == 1) { return codes.front(); }
|
||||
|
||||
if (codes.isEmpty())
|
||||
{
|
||||
// now we search if the ICAO designator is
|
||||
// actually an IATA code
|
||||
codes = codes.findByIataCode(d);
|
||||
codes = this->findByIataCode(d);
|
||||
|
||||
// we have one exact match
|
||||
if (codes.size() == 1) { return codes.front(); }
|
||||
|
||||
if (codes.isEmpty())
|
||||
{
|
||||
// still empty, bye
|
||||
return icaoPattern;
|
||||
// still empty, try to find by family
|
||||
codes = this->findByFamily(d);
|
||||
|
||||
// we have one exact match
|
||||
if (codes.size() == 1) { return codes.front(); }
|
||||
|
||||
// still empty, hopeless
|
||||
if (codes.isEmpty()) { return icaoPattern; }
|
||||
|
||||
// continue here, we have more than one code and
|
||||
// will try to further reduce
|
||||
}
|
||||
}
|
||||
codes.sortByRank();
|
||||
|
||||
// intentionally continue here
|
||||
}
|
||||
|
||||
// further reduce by manufacturer
|
||||
@@ -166,7 +177,6 @@ namespace BlackMisc
|
||||
const QString m(icaoPattern.getManufacturer());
|
||||
codes = codes.findByManufacturer(m);
|
||||
if (codes.size() == 1) { return codes.front(); }
|
||||
if (codes.isEmpty()) { return icaoPattern; }
|
||||
|
||||
// intentionally continue here
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace BlackMisc
|
||||
//! Find by designator, then best match by rank
|
||||
CAircraftIcaoCode findFirstByDesignatorAndRank(const QString &designator) const;
|
||||
|
||||
//! Best selection by given pattern
|
||||
//! Best selection by given pattern, also searches IATA and family information
|
||||
CAircraftIcaoCode smartAircraftIcaoSelector(const CAircraftIcaoCode &icaoPattern) const;
|
||||
|
||||
//! Sort by rank
|
||||
|
||||
Reference in New Issue
Block a user