17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-03 01:30:16 +01:00

feat(editor): a measuring tape in the track mode, M: the distance, the difference of height, the grade and the azimuth between two clicks

M in any tab of the track mode turns the tape on: a click puts its start, the next one its end, at a free end, on the axis
of the track under the cursor or else on the ground. The readout at the cursor gives the distance in plan and in space,
the difference of height and the grade between them and the azimuth, while the second point follows the cursor and once
it's put; a further click starts a new measure, M or Esc puts the tape away. Self-test command tape.
This commit is contained in:
maj00r
2026-10-21 17:57:05 +02:00
parent 8171bdc7d5
commit 79642a95c7
6 changed files with 133 additions and 2 deletions

View File

@@ -501,6 +501,11 @@ void editor_mode::arm_switch()
bool editor_mode::track_shortcut(int const Key)
{
if (Key == GLFW_KEY_M)
{
m_tape = {false == m_tape.active, {}, m_tape.mouse};
return true;
}
auto const key{Key == GLFW_KEY_C ? GLFW_KEY_G : Key};
for (auto const &mode : track_modes())
{
@@ -531,6 +536,8 @@ bool editor_mode::track_busy() const
std::string editor_mode::track_mode_name() const
{
if (m_tape.active)
return STR_C("Measure");
if (false == m_track_window_open)
return STR_C("Select");
switch (m_track_tab)
@@ -1750,6 +1757,8 @@ std::vector<editor_mode::key_hint> editor_mode::track_key_hints(bool const All)
// values of the change in progress, shown next to the cursor
std::string editor_mode::track_readout() const
{
if (m_tape.active)
return tape_readout();
auto const name = [](TTrack const *Track) { return name_of(*Track); };
auto const azimuth = [](glm::dvec3 const &From, glm::dvec3 const &To) {
auto const degrees{glm::degrees(std::atan2(To.x - From.x, To.z - From.z))};