swift
interpolationlogdisplay.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_GUI_COMPONENTS_INTERPOLATIONLOGDISPLAY_H
7 #define SWIFT_GUI_COMPONENTS_INTERPOLATIONLOGDISPLAY_H
8 
9 #include <QFrame>
10 #include <QPointer>
11 #include <QScopedPointer>
12 #include <QStringListModel>
13 #include <QTimer>
14 
15 #include "core/simulator.h"
17 #include "gui/swiftguiexport.h"
19 #include "misc/aviation/callsign.h"
20 #include "misc/identifiable.h"
21 #include "misc/logcategories.h"
23 
24 namespace Ui
25 {
26  class CInterpolationLogDisplay;
27 }
28 namespace swift::core
29 {
30  class CAirspaceMonitor;
31 }
32 namespace swift::gui::components
33 {
38  {
39  Q_OBJECT
40 
41  public:
43  static const QStringList &getLogCategories();
44 
46  enum Tab
47  {
48  TabFlow,
49  TabFlow2,
50  TabInterpolation,
51  TabLoopback,
52  TabTextLog,
53  TabElevation
54  };
55 
57  explicit CInterpolationLogDisplay(QWidget *parent = nullptr);
58 
60  virtual ~CInterpolationLogDisplay() override;
61 
63  void setSimulator(swift::core::ISimulator *simulator);
64 
66  void setAirspaceMonitor(swift::core::CAirspaceMonitor *airspaceMonitor);
67 
69  void linkWithAirspaceMonitor();
70 
71  private:
73  void updateLog();
74 
76  void getLogAmdDisplayLastInterpolation();
77 
79  void displayLastInterpolation(const swift::misc::simulation::SituationLog &sLog);
80 
82  void displayLoopback();
83 
85  void onSliderChanged(int timeSecs);
86 
88  void onCallsignEntered();
89 
91  void onPseudoElevationToggled(bool checked);
92 
94  void toggleStartStop();
95 
97  void followInSimulator();
98 
100  bool start();
101 
103  void stop();
104 
106  bool logCallsign(const swift::misc::aviation::CCallsign &cs) const;
107 
109  void onAboutToShutdown();
110 
112  void onSimulatorUnloaded();
113 
115  void onSituationAdded(const swift::misc::aviation::CAircraftSituation &situation);
116 
118  void onPartsAdded(const swift::misc::aviation::CCallsign &callsign,
120 
122  void onSimulatorStatusChanged(swift::core::ISimulator::SimulatorStatus status);
123 
125  void onElevationReceived(const swift::misc::geo::CElevationPlane &elevationPlane,
126  const swift::misc::aviation::CCallsign &callsign);
127 
129  void onElevationRequested(const swift::misc::aviation::CCallsign &callsign);
130 
132  void onInjectElevation();
133 
135  void onElevationHistoryCountFinished();
136 
138  void resetStatistics();
139 
141  void resetLastSentValues();
142 
144  void clear();
145 
147  void clearElevationResults();
148 
150  void clearLogCommand();
151 
153  void writeLogCommand();
154 
156  void logPosCommand();
157 
159  bool checkLogPrerequisites();
160 
162  void initPartsView();
163 
165  void displayElevationRequestReceive();
166 
168  void displayArbitraryElevation(const swift::misc::geo::CElevationPlane &elevation);
169 
171  void requestElevationClicked();
172 
174  void requestElevation(const swift::misc::aviation::CAircraftSituation &situation);
175 
177  void requestElevationAtPosition();
178 
180  void requestRecalculateAll();
181 
183  bool canLog() const;
184 
186  static const swift::misc::aviation::CCallsign &pseudoCallsignElevation();
187 
188  QScopedPointer<Ui::CInterpolationLogDisplay> ui;
189  QTimer m_updateTimer;
190  QPointer<swift::core::ISimulator> m_simulator;
191  QPointer<swift::core::CAirspaceMonitor> m_airspaceMonitor;
192  swift::misc::aviation::CAircraftSituationList m_lastInterpolations;
194 
195  int m_elvRequested = 0;
196  int m_elvReceived = 0;
197  int m_elvRequestedLoggedCs = 0;
198  int m_elvReceivedLoggedCs = 0;
199 
200  int m_elvHistoryCount = -1;
201  QStringListModel *m_elvHistoryModel = nullptr;
202 
203  static const QString &startText();
204  static const QString &stopText();
205  };
206 } // namespace swift::gui::components
207 
208 #endif // SWIFT_GUI_COMPONENTS_INTERPOLATIONLOGDISPLAY_H
Keeps track of other entities in the airspace: aircraft, ATC stations, etc. Central instance of data ...
Interface to a simulator.
Definition: simulator.h:59
Using this class provides a QFrame with the overlay functionality already integrated.
Base class with a member CIdentifier to be inherited by a class which has an identity in the environm...
Definition: identifiable.h:24
Value object encapsulating information of aircraft's parts.
Definition: aircraftparts.h:26
Value object encapsulating information of an aircraft's situation.
Value object encapsulating information of a callsign.
Definition: callsign.h:30
Plane of same elevation, can be a single point or larger area (e.g. airport)
Backend services of the swift project, like dealing with the network or the simulators.
Definition: actionbind.cpp:7
High level reusable GUI components.
Definition: aboutdialog.cpp:13
Log entry for situation interpolation.
#define SWIFT_GUI_EXPORT
Export a class or function from the library.