64 std::string txt =
str;
65 txt = txt.substr(0, txt.find_first_of(
'#'));
66 ImGui::TextUnformatted(txt.c_str());
71 else { ImGui::SetNextItemWidth(itemWidth); }
80 ImGui::SetNextItemWidth(itemWidth);
84 ImGui::SetNextItemWidth(itemWidth);
88 ImGui::SetNextItemWidth(itemWidth);
94 ImGui::SetCursorPosX(ImGui::GetCursorPosX() - ImGui::GetStyle().ItemSpacing.x + ImGui::GetStyle().ItemInnerSpacing.x);
95 ImGui::TextUnformatted(
"XYZ");
101 lla_position(0) =
rad2deg(lla_position(0));
102 lla_position(1) =
rad2deg(lla_position(1));
103 if (lla_position.hasNaN())
105 lla_position = Eigen::Vector3d(0, 0, 0);
109 ImGui::SetNextItemWidth(itemWidth);
111 if (ImGui::IsItemDeactivatedAfterEdit()) { changes =
true; }
114 ImGui::SetNextItemWidth(itemWidth);
116 if (ImGui::IsItemDeactivatedAfterEdit()) { changes =
true; }
119 ImGui::SetNextItemWidth(itemWidth);
120 if (ImGui::InputDouble(fmt::format(
"{}##Alt {}", layout !=
PositionInputLayout::TWO_ROWS ?
"Altitude" :
"",
str).c_str(), &lla_position(2), 0.0, 0.0,
"%.4fm")) { edited =
true; }
121 if (ImGui::IsItemDeactivatedAfterEdit()) { changes =
true; }
126 ImGui::SetCursorPosX(ImGui::GetCursorPosX() - ImGui::GetStyle().ItemSpacing.x + ImGui::GetStyle().ItemInnerSpacing.x);
127 ImGui::TextUnformatted(
"Lat, Lon, Alt");
130 if (changes || edited)
132 lla_position(0) =
deg2rad(lla_position(0));
133 lla_position(1) =
deg2rad(lla_position(1));
134 if (!lla_position.hasNaN())
153 auto text = j.get<std::string>();
159 j[
"frame"] = position.
frame;
167 j[
"position"] = Eigen::Vector3d(
rad2deg(lla(0)),
rad2deg(lla(1)), lla(2));
173 if (j.contains(
"frame"))
175 j.at(
"frame").get_to(position.
frame);
177 if (j.contains(
"position"))
185 auto lla = j.at(
"position").get<Eigen::Vector3d>();
Combo representing an enumeration.
nlohmann::json json
json namespace
bool InputDoubleL(const char *label, double *v, double v_min, double v_max, double step, double step_fast, const char *format, ImGuiInputTextFlags flags)
Shows a value limited InputText GUI element for 'double'.
Eigen::Vector3< typename Derived::Scalar > ecef2lla_WGS84(const Eigen::MatrixBase< Derived > &e_position)
Converts Earth-centered-Earth-fixed coordinates into latitude, longitude and altitude using WGS84.
Eigen::Vector3< typename Derived::Scalar > lla2ecef_WGS84(const Eigen::MatrixBase< Derived > &lla_position)
Converts latitude, longitude and altitude into Earth-centered-Earth-fixed coordinates using WGS84.
const char * to_string(gui::widgets::PositionWithFrame::ReferenceFrame refFrame)
Converts the enum to a string.
constexpr auto deg2rad(const T °)
Convert Degree to Radians.
constexpr auto rad2deg(const T &rad)
Convert Radians to Degree.