mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-10 22:15:34 +08:00
Some convenience functions ATC station
This commit is contained in:
@@ -85,6 +85,17 @@ namespace BlackMisc
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Find by suffix
|
||||
*/
|
||||
CAtcStationList CAtcStationList::findBySuffix(const QString &suffix) const
|
||||
{
|
||||
CAtcStationList r;
|
||||
if (suffix.isEmpty()) { return r; }
|
||||
r = this->findBy(&CAtcStation::getCallsignSuffix, suffix);
|
||||
return r;
|
||||
}
|
||||
|
||||
/*
|
||||
* Distances to own plane
|
||||
*/
|
||||
@@ -104,6 +115,28 @@ namespace BlackMisc
|
||||
return this->findBy(Predicates::MemberValid(&CAtcStation::getController)).transform(Predicates::MemberTransform(&CAtcStation::getController));
|
||||
}
|
||||
|
||||
/*
|
||||
* Suffixes with count
|
||||
*/
|
||||
QMap<QString, int> CAtcStationList::getSuffixes() const
|
||||
{
|
||||
QMap<QString, int> r;
|
||||
for (const CAtcStation &station : (*this))
|
||||
{
|
||||
const QString s = station.getCallsignSuffix();
|
||||
if (s.isEmpty()) { continue; }
|
||||
if (r.contains(s))
|
||||
{
|
||||
r[s] = r[s] + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
r.insert(s, 1);
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/*
|
||||
* Merge with booking, both (online/booking will be updated)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user