0.5.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 "Const";
27 return "WGS84";
29 return "WGS84 (Skydel Constants)";
31 return "Somigliana";
33 return "EGM96";
35 return "";
36 }
37 return "";
38}
39
40bool ComboGravitationModel(const char* label, GravitationModel& gravitationModel)
41{
42 bool clicked = false;
43 if (ImGui::BeginCombo(label, NAV::to_string(gravitationModel)))
44 {
45 for (size_t i = 0; i < static_cast<size_t>(GravitationModel::COUNT); i++)
46 {
47 const bool is_selected = (static_cast<size_t>(gravitationModel) == i);
48 if (ImGui::Selectable(NAV::to_string(static_cast<GravitationModel>(i)), is_selected))
49 {
50 gravitationModel = static_cast<GravitationModel>(i);
51 clicked = true;
52 }
53
54 // Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
55 if (is_selected)
56 {
57 ImGui::SetItemDefaultFocus();
58 }
59 }
60
61 ImGui::EndCombo();
62 }
63 return clicked;
64}
65
66} // 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:34
@ COUNT
Amount of items in the enum.
Definition Gravity.hpp:37
@ WGS84
World Geodetic System 1984.
Definition Gravity.hpp:33
@ None
Gravity Model turned off.
Definition Gravity.hpp:31
@ Const
Constant gravitation.
Definition Gravity.hpp:32
@ EGM96
Earth Gravitational Model 1996.
Definition Gravity.hpp:36
@ Somigliana
Somigliana gravity model.
Definition Gravity.hpp:35
bool ComboGravitationModel(const char *label, GravitationModel &gravitationModel)
Shows a ComboBox to select the gravitation model.
Definition Gravity.cpp:40