Hello everyone,
I plan to start implementing a new feature allowing to get METAR and TAF weather data.
Here is a description of the proposed implementation. Note that I am not familiar with the code, so the implementation I describe here might change as I code. I look forward to reading your comments or suggestions, should you have any.
QML
An entry "Weather" will be added to the drawer. On click, it will open a new Weather
page with:
- a scrolling list showing the different aerodromes
- a search bar allowing to filter the aerodromes by name or ICAO code
All in all, this page should look similar to the FlightRouteAddWPDialog
dialog.
When an aerodrome is selected, a new Weather
dialog will be opened. This dialog will consist of three sections:
- Epheremis: two rows showing the sunrise and sunset time
- METAR: one row showing the raw METAR data
- TAF: one row showing the raw TAF data
The dialog will have two buttons: Refresh
and Close
.
Additionally, a colored badge displaying the flight rules (VFR, MVFR, ...) and a row showing the time at which the data was fetched will be added.
C++
The logic powering the Weather
page and dialog described above will be held in the class Meteorologist
.
The class will be constructed using a Waypoint
(an aerodrome). It will have the following members:
file
, the file where the weather data will be saved to disk (Appdata/weather/icao.json, where icao is the ICAO code of the aerodrome)
sunrise
, the sunrise time
sunset
, the sunset time
metar
, the raw metar data
taf
, the raw taf data
rules
, a pair containing the flight rule and its associated color
fTime
, the time at which the weather data were fetched
Each of these members will be private and accessible through dedicated getters.
Additionally, the class will have the following methods:
read()
, read the weather data from disk and set the members accordingly
computeTimes()
compute the sunrise and sunset times and set the members accordingly
fetch()
, fetch the weather data from NOAA, set the members accordingly and save to disk
A Meteorologist
object will be constructed when an aerodrome is clicked on the Weather
page, and destroyed when the Close
button is clicked.
The constructor will call read()
and computeTimes()
. A click on the Refresh
button will call fetch()
.