6 #ifndef SWIFT_MISC_AVIATION_ALTITUDE_H
7 #define SWIFT_MISC_AVIATION_ALTITUDE_H
13 #include <QRegularExpression>
33 namespace swift::misc::aviation
87 CAltitude() : CLength(0, physical_quantities::CLengthUnit::m()), m_datum(MeanSeaLevel) {}
91 : CLength(value, unit), m_datum(datum)
96 : CLength(value, unit), m_datum(datum), m_altitudeType(type)
101 : CLength(value, unit), m_datum(MeanSeaLevel)
107 : CLength(value, unit), m_datum(MeanSeaLevel)
109 this->switchUnit(switchUnit);
118 : CLength(altitude), m_datum(datum)
124 CAltitude withOffset(
const CLength &offset)
const;
127 void addOffset(
const CLength &offset);
148 bool toFlightLevel();
151 bool toMeanSeaLevel();
166 void parseFromString(
const QString &value);
173 bool parseFromFpAltitudeString(
const QString &value,
CStatusMessageList *msgs =
nullptr);
187 QString asFpICAOAltitudeString()
const;
190 QString asFpVatsimAltitudeString()
const;
194 static const QRegularExpression &fpAltitudeRegExp();
198 static QString fpAltitudeInfo(
const QString &separator =
", ");
201 static QString fpAltitudeExamples();
207 int compare(
const CAltitude &otherAltitude)
const;
210 QString convertToQString(
bool i18n =
false)
const;
217 CAltitude roundedToNearest100ft(
bool roundDown)
const;
221 static int findMetricAltitude(
int feet);
222 static int findAltitudeForMetricAltitude(
int metric);
239 ReferenceDatum m_datum;
240 AltitudeType m_altitudeType = TrueAltitude;
243 static const QVector<MetricTuple> &metricTuples();
QPair< CAltitude, CAltitude > CAltitudePair
Pair of altitude.
IconIndex
Index for each icon, allows to send them via DBus, efficiently store them, etc.
Non-owning reference to a CPropertyIndex with a subset of its features.
Status messages, e.g. from Core -> GUI.
Tag type signifying overloaded marshalling methods that preserve data at the expense of size.
Altitude as used in aviation, can be AGL or MSL altitude.
CAltitude(double value, ReferenceDatum datum, AltitudeType type, const physical_quantities::CLengthUnit &unit)
Constructor.
CAltitude(const physical_quantities::CLength &altitude, ReferenceDatum datum)
Constructor by CLength.
bool hasMeanSeaLevelValue() const
Non-NULL MSL value?
bool isAboveGroundLevel() const
AGL Above ground level?
bool isMeanSeaLevel() const
MSL Mean sea level?
bool isFlightLevel() const
Flight level?
CAltitude(double value, const physical_quantities::CLengthUnit &unit, const physical_quantities::CLengthUnit &switchUnit)
Constructor, value as CAltitude::MeanSeaLevel.
CAltitude()
Default constructor: 0m Altitude MSL.
AltitudeType
Altitude type.
@ PressureAltitude
Altitude above the standard datum plane.
AltitudeType getAltitudeType() const
Current altitude type.
ReferenceDatum
Enum type to distinguish between MSL and AGL.
std::tuple< int, int > MetricTuple
Metric tuple.
CAltitude(double value, ReferenceDatum datum, const physical_quantities::CLengthUnit &unit)
Constructor.
ReferenceDatum getReferenceDatum() const
Get reference datum (MSL or AGL)
CAltitude(double value, const physical_quantities::CLengthUnit &unit)
Constructor, value as CAltitude::MeanSeaLevel.
CRTP class template from which a derived class can inherit icon-related functions.
CRTP class template from which a derived class can inherit property indexing functions.
CRTP class template from which a derived class can inherit string streaming operations.
Physical unit length (length)
Specialized class for distance units (meter, foot, nautical miles).
SeparatorMode
Number separators / group separators.
@ SeparatorBestGuess
try to figure out
#define SWIFT_MISC_DECLARE_USING_MIXIN_DATASTREAM(DERIVED)
When a derived class and a base class both inherit from mixin::DataStreamByMetaClass,...
#define SWIFT_MISC_DECLARE_USING_MIXIN_DBUS(DERIVED,...)
When a derived class and a base class both inherit from mixin::DBusByTuple, the derived class uses th...
#define SWIFT_MISC_DECLARE_USING_MIXIN_ICON(DERIVED)
When a derived class and a base class both inherit from mixin::Icon, the derived class uses this macr...
#define SWIFT_MISC_DECLARE_USING_MIXIN_INDEX(DERIVED)
When a derived class and a base class both inherit from mixin::Index, the derived class uses this mac...
#define SWIFT_MISC_DECLARE_USING_MIXIN_JSON(DERIVED)
When a derived class and a base class both inherit from mixin::JsonByTuple, the derived class uses th...
#define SWIFT_MISC_DECLARE_USING_MIXIN_STRING(DERIVED)
When a derived class and a base class both inherit from mixin::String, the derived class uses this ma...
void registerMetadata()
Register all relevant metadata in Misc.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.