mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
87 lines
3.1 KiB
C++
87 lines
3.1 KiB
C++
// SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
|
|
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
|
|
|
//! \file
|
|
|
|
#ifndef SWIFT_MISC_AVIATION_ATCSTATIONLIST_H
|
|
#define SWIFT_MISC_AVIATION_ATCSTATIONLIST_H
|
|
|
|
#include <QHash>
|
|
#include <QMetaType>
|
|
|
|
#include "misc/aviation/atcstation.h"
|
|
#include "misc/aviation/callsignobjectlist.h"
|
|
#include "misc/aviation/comsystem.h"
|
|
#include "misc/collection.h"
|
|
#include "misc/geo/geoobjectlist.h"
|
|
#include "misc/network/userlist.h"
|
|
#include "misc/pq/frequency.h"
|
|
#include "misc/sequence.h"
|
|
#include "misc/swiftmiscexport.h"
|
|
|
|
SWIFT_DECLARE_SEQUENCE_MIXINS(swift::misc::aviation, CAtcStation, CAtcStationList)
|
|
|
|
namespace swift::misc::aviation
|
|
{
|
|
//! Value object for a list of ATC stations.
|
|
class SWIFT_MISC_EXPORT CAtcStationList :
|
|
public CSequence<CAtcStation>,
|
|
public aviation::ICallsignObjectList<CAtcStation, CAtcStationList>,
|
|
public geo::IGeoObjectWithRelativePositionList<CAtcStation, CAtcStationList>,
|
|
public mixin::MetaType<CAtcStationList>
|
|
{
|
|
public:
|
|
SWIFT_MISC_DECLARE_USING_MIXIN_METATYPE(CAtcStationList)
|
|
using CSequence::CSequence;
|
|
|
|
//! Default constructor.
|
|
CAtcStationList();
|
|
|
|
//! Construct from a base class object.
|
|
CAtcStationList(const CSequence<CAtcStation> &other);
|
|
|
|
//! Find 0..n stations tuned in frequency of COM unit (with channel spacing)
|
|
CAtcStationList findIfComUnitTunedInChannelSpacing(const CComSystem &comUnit) const;
|
|
|
|
//! Any stations tuned in frequency of COM unit (with channel spacing)
|
|
bool hasComUnitTunedInChannelSpacing(const CComSystem &comUnit) const;
|
|
|
|
//! Find 0..n stations with frequency (with 5 kHz spacing for .x20/.x25 and .x70/.x75)
|
|
CAtcStationList findIfFrequencyIsWithinSpacing(const physical_quantities::CFrequency &frequency);
|
|
|
|
//! Update if message changed
|
|
bool updateIfMessageChanged(const CInformationMessage &im, const CCallsign &callsign, bool overrideWithNewer);
|
|
|
|
//! Set online status
|
|
int setOnline(const CCallsign &callsign, bool online);
|
|
|
|
//! Find 0..n stations with valid COM frequency
|
|
//! \sa CAtcStation::hasValidFrequency
|
|
CAtcStationList stationsWithValidFrequency() const;
|
|
|
|
//! All controllers (with valid data)
|
|
network::CUserList getControllers() const;
|
|
|
|
//! Remove if marked outside of range
|
|
int removeIfOutsideRange();
|
|
|
|
//! Those in range
|
|
CAtcStationList findInRange() const;
|
|
|
|
//! Sort by ATC suffix sort order and distance
|
|
void sortByAtcSuffixSortOrderAndDistance();
|
|
|
|
//! Sorted by ATC suffix sort order and distance
|
|
CAtcStationList sortedByAtcSuffixSortOrderAndDistance() const;
|
|
|
|
//! Split per suffix
|
|
//! \remark sort can be disabled if already sorted
|
|
QHash<QString, CAtcStationList> splitPerSuffix(bool sort = true) const;
|
|
};
|
|
} // namespace swift::misc::aviation
|
|
|
|
Q_DECLARE_METATYPE(swift::misc::aviation::CAtcStationList)
|
|
Q_DECLARE_METATYPE(swift::misc::CCollection<swift::misc::aviation::CAtcStation>)
|
|
|
|
#endif // SWIFT_MISC_AVIATION_ATCSTATIONLIST_H
|