17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-30 01:37:28 +01:00

feat(editor): a switch laid into a curve is checked by ST-T1-A6 as it's placed: the radii of its main and diverging tracks at its start and its end shown at it; warnings where the curvature of a track turns from one side to the other within it (KZW II, 9.7 pkt 12), where the diverging track is sharper or the main track bent more than table 11.9 allows the basic switch (the values allowed by way of exception named), where a switch of 1:9.403 or steeper is bent (11.4 pkt 4), where the cant changes within it (11.4 pkt 7), where a cant ramp starts or ends within it or under 6 m off it (9.6 pkt 16-17) and where the cant is over 100 mm (table 9.6); a note on a transition curve, which only an exception allows. The ends of the cant ramps are marked on the curve, and the start of the switch pressed within 3 m of where it starts or ends at an end of a ramp, or keeps the 6 m off it, is drawn there. The warnings stay in the status once it's laid. The checks stand on their own in editor/editorSwitchCurve, with unit tests

This commit is contained in:
maj00r
2026-10-25 00:29:05 +02:00
parent aeef2cebb3
commit ece61056ff
9 changed files with 633 additions and 12 deletions

View File

@@ -35,6 +35,7 @@ http://mozilla.org/MPL/2.0/.
#include "editor/editorAlignment.hpp"
#include "editor/editorAlignmentStore.hpp"
#include "editor/editorSwitchStore.hpp"
#include "editor/editorSwitchCurve.hpp"
#include "editor/editorKilometrage.hpp"
#include "editor/editorSpeed.hpp"
#include "editor/editorRoad.hpp"
@@ -1240,6 +1241,7 @@ class editor_mode : public application_mode, private editor_track::observer, pri
int last{0}; // template armed the last time
bool placing{false};
double along{0.0};
double pressed{0.0}; // along a curve: where the press was, the start of the switch drawn from it to the ends of the cant ramps
glm::dvec3 point{0.0};
glm::dvec3 mouse{0.0};
editor_track::straight line;
@@ -1528,6 +1530,15 @@ class editor_mode : public application_mode, private editor_track::observer, pri
void switch_placed(std::vector<TTrack *> const &Created);
static std::vector<curve_sample> sample_chain(editor_track::chain const &Chain);
static curve_sample sample_at(std::vector<curve_sample> const &Frame, double const Station);
// the curve a switch goes into as the norms look at it: its headings and its cant along it
std::vector<switch_curve::track_point> frame_points(std::vector<curve_sample> const &Frame) const;
// the way the switch being placed into a curve goes along it and the side its diverging track leaves to, from the drag
void curved_switch_pose(int &Direction, int &Side) const;
// the start of the switch being placed into a curve: where it was pressed, drawn to where the switch meets an end of a cant ramp or
// keeps 6 m off it; What receives which
double curved_switch_start(int const Direction, std::string *What = nullptr) const;
// the switch made of the paths, laid into the curve at the station, as ST-T1-A6 sees it
switch_curve::switch_report curved_switch_report(std::vector<segment_data> const &Paths, double const Station, int const Direction) const;
static double nearest_station(std::vector<curve_sample> const &Frame, glm::dvec3 const &Point);
static std::vector<segment_data> curved_switch_paths(editor_track::switch_template const &Shape, std::vector<curve_sample> const &Frame, double const Station, int const Direction, int const Side);
void insert_curved_switch(int const Direction, int const Side);