0.4.1
Loading...
Searching...
No Matches
TimeEdit.hpp
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/// @file TimeEdit.hpp
10/// @brief Widget to modify time point values
11/// @author T. Topp (topp@ins.uni-stuttgart.de)
12/// @date 2021-11-23
13
14#pragma once
15
18
19#include <nlohmann/json.hpp>
20using json = nlohmann::json; ///< json namespace
21
22namespace NAV
23{
24namespace gui::widgets
25{
26
27/// @brief Time Edit format and system
29{
30 /// Format to edit the time in
31 enum class Format : uint8_t
32 {
33 YMDHMS, ///< YearMonthDayHourMinuteSecond (UTC)
34 GPSWeekToW, ///< GPS Week and TimeOfWeek
35 COUNT, ///< Amount of items in the enum
36 };
37
38 Format format = Format::YMDHMS; ///< Time format
39 TimeSystem system = GPST; ///< Time System
40};
41
42/// @brief Inputs to edit an InsTime object
43/// @param[in] str_id Unique id for the ImGui elements
44/// @param[in, out] insTime Time object to modify
45/// @param[in, out] timeEditFormat Format to modify the time in
46/// @param[in] itemWidth Width of the widget items
47/// @return True if changes were made to the object
48bool TimeEdit(const char* str_id, InsTime& insTime, TimeEditFormat& timeEditFormat, float itemWidth = 170.0F);
49
50/// @brief Converts the provided Object into a json object
51/// @param[out] j Return Json object
52/// @param[in] timeEditFormat Object to convert
53void to_json(json& j, const TimeEditFormat& timeEditFormat);
54/// @brief Converts the provided json object
55/// @param[in] j Json object with the time system
56/// @param[out] timeEditFormat Object to return
57void from_json(const json& j, TimeEditFormat& timeEditFormat);
58
59} // namespace gui::widgets
60
61/// @brief Converts the enum to a string
62/// @param[in] timeEditFormat Enum value to convert into text
63/// @return String representation of the enum
64const char* to_string(gui::widgets::TimeEditFormat::Format timeEditFormat);
65
66} // namespace NAV
nlohmann::json json
json namespace
The class is responsible for all time-related tasks.
Time System defintions.
The class is responsible for all time-related tasks.
Definition InsTime.hpp:710
Time System defintions.
bool TimeEdit(const char *str_id, InsTime &insTime, TimeEditFormat &timeEditFormat, float itemWidth=170.0F)
Inputs to edit an InsTime object.
Definition TimeEdit.cpp:52
void from_json(const json &j, DynamicInputPins &obj, Node *node)
Converts the provided json object into a node object.
void to_json(json &j, const DynamicInputPins &obj)
Converts the provided object into json.
@ GPST
GPS Time.
const char * to_string(gui::widgets::PositionWithFrame::ReferenceFrame refFrame)
Converts the enum to a string.
Time Edit format and system.
Definition TimeEdit.hpp:29
TimeSystem system
Time System.
Definition TimeEdit.hpp:39
Format
Format to edit the time in.
Definition TimeEdit.hpp:32
@ COUNT
Amount of items in the enum.
Definition TimeEdit.hpp:35
@ YMDHMS
YearMonthDayHourMinuteSecond (UTC)
Definition TimeEdit.hpp:33
@ GPSWeekToW
GPS Week and TimeOfWeek.
Definition TimeEdit.hpp:34