0.3.0
Loading...
Searching...
No Matches
Gravity.cpp
Go to the documentation of this file.
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
15namespace NAV
16{
17
18const char* to_string(GravitationModel gravitationModel)
19{
20 switch (gravitationModel)
21 {
23 return "None";
25 return "WGS84";
27 return "WGS84 (Skydel Constants)";
29 return "Somigliana";
31 return "EGM96";
33 return "";
34 }
35 return "";
36}
37
38bool 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
Different Gravity Models.
const char * to_string(gui::widgets::PositionWithFrame::ReferenceFrame refFrame)
Converts the enum to a string.
GravitationModel
Available Gravitation Models.
Definition Gravity.hpp:30
@ WGS84_Skydel
World Geodetic System 1984 implemented by the Skydel Simulator // FIXME: Remove after Skydel uses the...
Definition Gravity.hpp:33
@ COUNT
Amount of items in the enum.
Definition Gravity.hpp:36
@ WGS84
World Geodetic System 1984.
Definition Gravity.hpp:32
@ None
Gravity Model turned off.
Definition Gravity.hpp:31
@ EGM96
Earth Gravitational Model 1996.
Definition Gravity.hpp:35
@ Somigliana
Somigliana gravity model.
Definition Gravity.hpp:34
bool ComboGravitationModel(const char *label, GravitationModel &gravitationModel)
Shows a ComboBox to select the gravitation model.
Definition Gravity.cpp:38