17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 10:59:20 +02:00

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

This commit is contained in:
maj00r
2026-10-11 16:33:25 +02:00
parent 572daeb274
commit 0bfb8a4e7c
11 changed files with 635 additions and 8 deletions

View File

@@ -12,6 +12,7 @@ http://mozilla.org/MPL/2.0/.
#include "editor/editorFormat.hpp"
#include "editor/editorGeometry.hpp"
#include "editor/editorTrack.hpp"
#include "editor/editorSwitchStore.hpp"
#include "world/Track.h"
@@ -232,6 +233,10 @@ verdict check(TTrack &Track, int const Path, options const &Options)
auto const gauge{Options.norms.gauge / 1000.0};
bool const branch{Track.eType == tt_Switch && Path == 1};
double kept{0.0};
if (branch)
if (auto const known{switch_store::of(Track)})
kept = switch_store::branch_radius(*known);
auto const &own{Track.m_paths[Path]};
geometry::bezier const curve{own};
auto const before{continuations(Track, Path, false, curve.first(0.0), true)};
@@ -273,7 +278,7 @@ verdict check(TTrack &Track, int const Path, options const &Options)
if (sampled[i].span != own_span)
continue;
auto const &here{samples[i]};
auto const curvature{std::abs(here.curvature)};
auto const curvature{kept > 0.0 ? std::min(std::abs(here.curvature), 1.0 / kept) : std::abs(here.curvature)};
auto const cant{std::abs(here.cant)};
double safe{Options.top};
cause why{cause::none};