From 0bfb8a4e7c522c04b65b728ce3d4cda7455ecd2b Mon Sep 17 00:00:00 2001 From: maj00r Date: Sun, 11 Oct 2026 16:33:25 +0200 Subject: [PATCH] feat(editor): switches kept in the scenery as //$r lines: type (Rz, arc Rlj/Rld, slip Rkpd), rail, R, 1:n, side, a, b, R of the main track, the parts of a slip, km and number, catalogue or measured; recorded as they are placed on a straight, in a curve (one-sided when diverging to the side the curve turns to), as a double slip, and when their geometry is replaced or flipped; the switch panel shows the kept type and the R of the diverging track bent with the main one, with the number, rail and km to edit (km from the kept horizontal alignment); the speed check of a diverging track takes its R from the kept type; records follow renamed switches and go with removed ones on save; editor records stay out of the terrain files (.txtf), and those written there by hand go with them into .btf; the side of the diverging track shown as seen; self-test commands for placing switches, the kept switches and the .btf conversion; Polish translation --- CMakeLists.txt | 1 + application/editormode.cpp | 3 + application/editormode.h | 3 + application/editormodeselftest.cpp | 112 +++++++++++++ application/editormodetrack.cpp | 165 +++++++++++++++++- editor/editorSpeed.cpp | 7 +- editor/editorSwitchStore.cpp | 257 +++++++++++++++++++++++++++++ editor/editorSwitchStore.hpp | 61 +++++++ editor/editorTrack.cpp | 2 + editor/editorTrack.hpp | 2 + lang/editor_pl.po | 30 ++++ 11 files changed, 635 insertions(+), 8 deletions(-) create mode 100644 editor/editorSwitchStore.cpp create mode 100644 editor/editorSwitchStore.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d6b7d24..4c023ec6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -179,6 +179,7 @@ set(SOURCES "editor/editorRoad.cpp" "editor/editorAlignment.cpp" "editor/editorAlignmentStore.cpp" +"editor/editorSwitchStore.cpp" "editor/editorSpeed.cpp" "editor/editorProfile.cpp" "editor/editorGauge.cpp" diff --git a/application/editormode.cpp b/application/editormode.cpp index 134c5335..bd3000a2 100644 --- a/application/editormode.cpp +++ b/application/editormode.cpp @@ -29,6 +29,7 @@ extern char **environ; #include "editor/editorGroundMesh.hpp" #include "editor/editorFormat.hpp" #include "editor/editorAlignmentStore.hpp" +#include "editor/editorSwitchStore.hpp" #include "editor/editorGeometry.hpp" #include "editor/editorIcons.hpp" #include "utilities/translation.h" @@ -497,6 +498,7 @@ void editor_mode::editormode_input::poll() editor_mode::editor_mode() { alignment_store::reset(); + switch_store::reset(); m_userinterface = std::make_shared(); // the area fill settings live in the node bank window, in the tab of the fill mode ui()->set_fill_options([this]() { render_area_fill(); }); @@ -2904,6 +2906,7 @@ bool editor_mode::save() if (m_profile.changed) profile_store(); + switch_store::tidy(); infra_store(); if (false == m_saved_camera.has_value() || glm::distance(m_saved_camera->first, glm::dvec3{Camera.Pos}) > 0.5 || glm::distance(m_saved_camera->second, glm::vec3{Camera.Angle}) > 0.01f) { diff --git a/application/editormode.h b/application/editormode.h index 015497bd..f5b4fa53 100644 --- a/application/editormode.h +++ b/application/editormode.h @@ -787,6 +787,9 @@ class editor_mode : public application_mode, private editor_track::observer bool route_load(TTrack &Track); void route_read_stored(); void route_take_stored(int const Index); + void record_switch(TTrack &Track, editor_track::switch_template const &Shape); + void record_slip(std::vector const &Parts, std::string const &Kind, std::string const &Type, double const Radius, double const Angle, std::string const &Base); + void render_switch_record(TTrack &Track); void route_store(); void render_route_stored(); void route_update() { m_route.result = alignment::compute(m_route.design); } diff --git a/application/editormodeselftest.cpp b/application/editormodeselftest.cpp index 50558c8c..dd6622b7 100644 --- a/application/editormodeselftest.cpp +++ b/application/editormodeselftest.cpp @@ -34,6 +34,9 @@ http://mozilla.org/MPL/2.0/. #include #include "editor/editorFormat.hpp" #include "editor/editorAlignmentStore.hpp" +#include "editor/editorSwitchStore.hpp" +#include "scene/sceneterrain.h" +#include "editor/editorSpeed.hpp" #include #include @@ -98,6 +101,10 @@ http://mozilla.org/MPL/2.0/. // routeapply, routetake as the buttons of the route design do it // alignments logs the alignments kept in the scenery and the element under each path // splitkind , nudgekind the first path over an element of the kind split in two, or moved +// switchplace