Line |
Branch |
Exec |
Source |
1 |
|
|
// This file is part of INSTINCT, the INS Toolkit for Integrated |
2 |
|
|
// Navigation Concepts and Training by the Institute of Navigation of |
3 |
|
|
// the University of Stuttgart, Germany. |
4 |
|
|
// |
5 |
|
|
// This Source Code Form is subject to the terms of the Mozilla Public |
6 |
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this |
7 |
|
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/. |
8 |
|
|
|
9 |
|
|
#include "Gravity.hpp" |
10 |
|
|
|
11 |
|
|
#include <cmath> |
12 |
|
|
|
13 |
|
|
#include <imgui.h> |
14 |
|
|
|
15 |
|
|
namespace NAV |
16 |
|
|
{ |
17 |
|
|
|
18 |
|
✗ |
const char* to_string(GravitationModel gravitationModel) |
19 |
|
|
{ |
20 |
|
✗ |
switch (gravitationModel) |
21 |
|
|
{ |
22 |
|
✗ |
case GravitationModel::None: |
23 |
|
✗ |
return "None"; |
24 |
|
✗ |
case GravitationModel::WGS84: |
25 |
|
✗ |
return "WGS84"; |
26 |
|
✗ |
case GravitationModel::WGS84_Skydel: |
27 |
|
✗ |
return "WGS84 (Skydel Constants)"; |
28 |
|
✗ |
case GravitationModel::Somigliana: |
29 |
|
✗ |
return "Somigliana"; |
30 |
|
✗ |
case GravitationModel::EGM96: |
31 |
|
✗ |
return "EGM96"; |
32 |
|
✗ |
case GravitationModel::COUNT: |
33 |
|
✗ |
return ""; |
34 |
|
|
} |
35 |
|
✗ |
return ""; |
36 |
|
|
} |
37 |
|
|
|
38 |
|
✗ |
bool ComboGravitationModel(const char* label, GravitationModel& gravitationModel) |
39 |
|
|
{ |
40 |
|
✗ |
bool clicked = false; |
41 |
|
✗ |
if (ImGui::BeginCombo(label, NAV::to_string(gravitationModel))) |
42 |
|
|
{ |
43 |
|
✗ |
for (size_t i = 0; i < static_cast<size_t>(GravitationModel::COUNT); i++) |
44 |
|
|
{ |
45 |
|
✗ |
const bool is_selected = (static_cast<size_t>(gravitationModel) == i); |
46 |
|
✗ |
if (ImGui::Selectable(NAV::to_string(static_cast<GravitationModel>(i)), is_selected)) |
47 |
|
|
{ |
48 |
|
✗ |
gravitationModel = static_cast<GravitationModel>(i); |
49 |
|
✗ |
clicked = true; |
50 |
|
|
} |
51 |
|
|
|
52 |
|
|
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus) |
53 |
|
✗ |
if (is_selected) |
54 |
|
|
{ |
55 |
|
✗ |
ImGui::SetItemDefaultFocus(); |
56 |
|
|
} |
57 |
|
|
} |
58 |
|
|
|
59 |
|
✗ |
ImGui::EndCombo(); |
60 |
|
|
} |
61 |
|
✗ |
return clicked; |
62 |
|
|
} |
63 |
|
|
|
64 |
|
|
} // namespace NAV |
65 |
|
|
|