mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 07:15:34 +08:00
Ref T442, ATC station list split per suffix
This commit is contained in:
@@ -138,5 +138,25 @@ namespace BlackMisc
|
||||
stations.sortByAtcSuffixSortOrderAndDistance();
|
||||
return stations;
|
||||
}
|
||||
|
||||
QHash<QString, CAtcStationList> CAtcStationList::splitPerSuffix(bool sort) const
|
||||
{
|
||||
if (this->isEmpty()) { return QHash<QString, CAtcStationList>(); }
|
||||
const CAtcStationList stations = sort ? this->sortedByAtcSuffixSortOrderAndDistance() : * this;
|
||||
|
||||
QString suffix;
|
||||
QHash<QString, CAtcStationList> split;
|
||||
for (const CAtcStation &s : stations)
|
||||
{
|
||||
const QString currentSuffix = s.getCallsignSuffix();
|
||||
if (suffix != currentSuffix)
|
||||
{
|
||||
suffix = currentSuffix;
|
||||
split[currentSuffix] = CAtcStationList();
|
||||
}
|
||||
split[currentSuffix].push_back(s);
|
||||
}
|
||||
return split;
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user