swift
Loading...
Searching...
No Matches
metar.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2015 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#ifndef SWIFT_MISC_AVIATION_METAR_H
7#define SWIFT_MISC_AVIATION_METAR_H
8
9#include <QMetaType>
10#include <QString>
11
13#include "misc/metaclass.h"
14#include "misc/pq/length.h"
15#include "misc/pq/pressure.h"
16#include "misc/pq/temperature.h"
17#include "misc/pq/time.h"
19#include "misc/valueobject.h"
23
24SWIFT_DECLARE_VALUEOBJECT_MIXINS(swift::misc::weather, CMetar)
25
26namespace swift::misc::weather
27{
28 class CCloudLayer;
29 class CPresentWeather;
30
37 class SWIFT_MISC_EXPORT CMetar : public CValueObject<CMetar>
38 {
39 public:
42 {
43 METAR,
44 SPECI
45 };
46
48 CMetar();
49
51 void setMessage(const QString &message);
52
54 const QString &getMessage() const { return m_metarMessage; }
55
57 bool hasMessage() const;
58
60 void setReportType(ReportType type);
61
63 ReportType getReportType() const { return m_reportType; }
64
66 void setAirportIcaoCode(const swift::misc::aviation::CAirportIcaoCode &icao);
67
69 const aviation::CAirportIcaoCode &getAirportIcaoCode() const { return m_airport; }
70
72 void setDayTime(int reportDay, const physical_quantities::CTime &reportTime);
73
75 int getDay() const { return m_reportDay; }
76
78 const physical_quantities::CTime &getTime() const { return m_reportTime; }
79
81 void setAutomated(bool isAutomated);
82
84 bool isAutomated() const { return m_isAutomated; }
85
87 void setCavok();
88
90 void setWindLayer(const CWindLayer &windLayer);
91
93 CWindLayer getWindLayer() const { return m_windLayer; }
94
96 void setVisibility(const physical_quantities::CLength &visibility);
97
99 physical_quantities::CLength getVisibility() const;
100
102 void addPresentWeather(const CPresentWeather &presentWeather);
103
105 const CPresentWeatherList &getPresentWeather() const { return m_presentWeathers; }
106
108 void addCloudLayer(const CCloudLayer &cloudLayer);
109
111 const CCloudLayerList &getCloudLayers() const { return m_cloudLayers; }
112
114 void removeAllClouds() { m_cloudLayers.clear(); }
115
117 void setTemperature(const physical_quantities::CTemperature &temperature);
118
120 physical_quantities::CTemperature getTemperature() const;
121
123 void setDewPoint(const physical_quantities::CTemperature &dewPoint);
124
126 const physical_quantities::CTemperature &getDewPoint() const { return m_dewPoint; }
127
129 void setAltimeter(const physical_quantities::CPressure &altimeter);
130
132 const physical_quantities::CPressure &getAltimeter() const { return m_altimeter; }
133
135 QString getMetarText() const;
136
138 QString convertToQString(bool i18n = false) const;
139
141 static CMetar CAVOK();
142
143 private:
144 QString m_metarMessage;
145 ReportType m_reportType = METAR;
147 int m_reportDay = 0;
148 physical_quantities::CTime m_reportTime;
149 bool m_isAutomated = false;
150 CWindLayer m_windLayer;
151 physical_quantities::CLength m_visibility;
152 CPresentWeatherList m_presentWeathers;
153 CCloudLayerList m_cloudLayers;
157
159 CMetar,
160 SWIFT_METAMEMBER(metarMessage),
161 SWIFT_METAMEMBER(reportType),
162 SWIFT_METAMEMBER(airport),
163 SWIFT_METAMEMBER(reportDay),
164 SWIFT_METAMEMBER(reportTime),
165 SWIFT_METAMEMBER(isAutomated),
166 SWIFT_METAMEMBER(windLayer),
167 SWIFT_METAMEMBER(visibility),
168 SWIFT_METAMEMBER(presentWeathers),
169 SWIFT_METAMEMBER(cloudLayers),
170 SWIFT_METAMEMBER(temperature),
171 SWIFT_METAMEMBER(dewPoint),
172 SWIFT_METAMEMBER(altimeter));
173 };
174} // namespace swift::misc::weather
175
176Q_DECLARE_METATYPE(swift::misc::weather::CMetar)
177
178#endif // SWIFT_MISC_AVIATION_METAR_H
Value object encapsulating information of airport ICAO data.
Physical unit length (length).
Definition length.h:18
Value object for a cloud layer.
Definition cloudlayer.h:27
Value object encapsulating a set of cloud layers.
Value object encapsulating information about METAR FIXME: runway visibilities FIXME: runway wind shea...
Definition metar.h:38
CMetar()
Default constructor.
Definition metar.cpp:19
CWindLayer getWindLayer() const
Get wind layer.
Definition metar.h:93
const QString & getMessage() const
Get METAR message.
Definition metar.h:54
const CPresentWeatherList & getPresentWeather() const
Get present weather list.
Definition metar.h:105
const physical_quantities::CPressure & getAltimeter() const
Get altimeter.
Definition metar.h:132
const physical_quantities::CTime & getTime() const
Get report time.
Definition metar.h:78
bool isAutomated() const
Is the station automated?
Definition metar.h:84
ReportType getReportType() const
Get report type.
Definition metar.h:63
int getDay() const
Get report day.
Definition metar.h:75
void removeAllClouds()
Remove all cloud layers.
Definition metar.h:114
const physical_quantities::CTemperature & getDewPoint() const
Get dew point.
Definition metar.h:126
const aviation::CAirportIcaoCode & getAirportIcaoCode() const
Get airport icao code.
Definition metar.h:69
const CCloudLayerList & getCloudLayers() const
Get all cloud layers.
Definition metar.h:111
Value object for present weather flags.
Value object encapsulating a list of present weathers.
Value object for a wind layer.
Definition windlayer.h:28
#define SWIFT_METAMEMBER(MEMBER,...)
Macro to define an element within a metaclass.
Definition metaclass.h:72
#define SWIFT_METACLASS(CLASS,...)
Macro to define a nested metaclass that describes the attributes of its enclosing class.
Definition metaclass.h:52
#define SWIFT_MISC_EXPORT
Export a class or function from the library.
#define SWIFT_DECLARE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template declaration of mixins for a CValueObject subclass to be placed near the top of the ...
Definition valueobject.h:65