mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 11:05:33 +08:00
* added functions to callsign / callsign list * used in aircraft matcher * also resolve std.livery in matcher * also allow to find aircraft ICAO designator ending with string (e.g. 737 for B737) * renamed CAircraftMatcher::reverseLookup -> CAircraftMatcher::reverselLookupModel * threadsafe isInRange (CAIrspaceMonitor)
This commit is contained in:
@@ -52,6 +52,26 @@ namespace BlackMisc
|
||||
});
|
||||
}
|
||||
|
||||
CAircraftIcaoCodeList CAircraftIcaoCodeList::findEndingWith(const QString &icaoEnding) const
|
||||
{
|
||||
QString ends = icaoEnding.trimmed().toUpper();
|
||||
if (ends.isEmpty()) { return CAircraftIcaoCodeList(); }
|
||||
CAircraftIcaoCodeList icaosDesignator;
|
||||
CAircraftIcaoCodeList icaosFamily;
|
||||
for (const CAircraftIcaoCode &icao : *this)
|
||||
{
|
||||
if (icao.getDesignator().endsWith(ends))
|
||||
{
|
||||
icaosDesignator.push_back(icao);
|
||||
}
|
||||
else if (icao.getFamily().endsWith(ends))
|
||||
{
|
||||
icaosFamily.push_back(icao);
|
||||
}
|
||||
}
|
||||
return icaosDesignator.isEmpty() ? icaosFamily : icaosDesignator;
|
||||
}
|
||||
|
||||
CAircraftIcaoCodeList CAircraftIcaoCodeList::findByIataCode(const QString &iata) const
|
||||
{
|
||||
if (iata.isEmpty()) { return CAircraftIcaoCodeList(); }
|
||||
@@ -221,6 +241,10 @@ namespace BlackMisc
|
||||
// we have one exact match
|
||||
if (codes.size() == 1) { return codes.front(); }
|
||||
|
||||
// now try to find as ending
|
||||
codes = this->findEndingWith(d);
|
||||
if (codes.size() == 1) { return codes.front(); }
|
||||
|
||||
// still empty, hopeless
|
||||
if (codes.isEmpty()) { return icaoPattern; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user