Enroute Flight Navigation
A navigation app for VFR pilots
BaroCache.h
1/***************************************************************************
2 * Copyright (C) 2025 by Markus Marks and Stefan Kebekus *
3 * stefan.kebekus@gmail.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20
21
22#pragma once
23
24#include <QGeoPositionInfo>
25#include <QPropertyNotifier>
26#include <QTime>
27
28#include "units/Distance.h"
29
30
31namespace Navigation
32{
33
46class BaroCache : public QObject
47{
48 Q_OBJECT
49
50public:
55 BaroCache(QObject* parent = nullptr);
56
57 // Default destructor
58 ~BaroCache() override = default;
59
60
61 //
62 // Methods
63 //
64
80 [[nodiscard]] Q_INVOKABLE Units::Distance estimatedPressureAltitude(Units::Distance geometricAltitude);
81
82private:
83 Q_DISABLE_COPY_MOVE(BaroCache)
84
85 void addIncomingBaroCacheData();
86
87 Units::Distance m_incomingGeometricAltitude;
88 QDateTime m_incomingGeometricAltitudeTimestamp;
89
90 Units::Distance m_incomingPressureAltitude;
91 QDateTime m_incomingPressureAltitudeTimestamp;
92
93 struct altitudeElement
94 {
95 QDateTime timestamp;
96 Units::Distance pressureAltitude;
97 Units::Distance geometricAltitude;
98 };
99
100 QMap<int, altitudeElement> m_altitudeElementsByFlightLevel;
101
102 std::vector<QPropertyNotifier> notifiers;
103};
104
105} // namespace Navigation
BaroCache(QObject *parent=nullptr)
Standard constructor.
Q_INVOKABLE Units::Distance estimatedPressureAltitude(Units::Distance geometricAltitude)
Estimate pressure altitude for a given geometric altitude.
Convenience class for distance computations.
Definition Distance.h:35