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

feat(editor): the joints check finds the tracks lying off the terrain model

The joints check also compares the tracks with the terrain model (NMT), every 5 m. Bridges, tunnels and tracks over others are left out.
- Each path lying higher or lower than the model by more than the threshold (0.5 m by default) is listed once, at its farthest place off.
- The places are compared with the same offset the model has against the scenery; a scenery not fitted to the model as a whole is measured about its median.
- The squares of the model are loaded in the background, and the check waits for them with a progress bar.
- These entries can't be fixed from the list. In the top view, the overlay shows the issues over the whole screen.
- Self-test: jointsmodel <threshold>.
This commit is contained in:
maj00r
2026-10-19 17:17:01 +02:00
parent d1dbd40566
commit 59ee32da58
4 changed files with 219 additions and 16 deletions

View File

@@ -75,14 +75,14 @@ class editor_mode : public application_mode, private editor_track::observer
// joint of the paths found wrong by the joints check
struct joint_issue
{
enum class kind { gap, step, kink, cant, grade, open };
enum class kind { gap, step, kink, cant, grade, model, open };
kind type{kind::gap};
TTrack *track{nullptr};
editor_track::point_ref point;
TTrack *other{nullptr};
editor_track::point_ref theirs;
glm::dvec3 position{0.0};
double value{0.0}; // m, deg, mm, per mille
double value{0.0}; // m, deg, mm, per mille; m of the track over the terrain model
bool fixed{false};
};
// constructors
@@ -2511,9 +2511,19 @@ class editor_mode : public application_mode, private editor_track::observer
double angle{0.2}; // deg
double cant{5.0}; // mm
double grade{10.0}; // per mille
double model{0.5}; // m, the track over or under the terrain model (NMT)
bool free_ends{false};
bool model_check{true};
std::vector<TTrack *> queue;
std::size_t next{0};
// the places of the tracks compared with the terrain model, in runs of one path each, once the model under them is in
std::vector<nmt_place> places;
std::vector<std::pair<std::size_t, std::size_t>> runs;
std::size_t run_next{0};
bool model_waiting{false};
bool model_asked{false};
double model_polled{0.0};
bool model_unplaced{false};
std::vector<joint_issue> issues;
int filter{-1};
int selected{-1};
@@ -2524,6 +2534,8 @@ class editor_mode : public application_mode, private editor_track::observer
void joints_start();
void joints_step();
void joints_check(TTrack &Track);
// the paths lying off the terrain model by more than the threshold. returns: false while the model under them is coming
bool joints_model();
void joints_focus(int const Index);
bool joint_fix(joint_issue &Issue, std::vector<std::pair<TTrack *, editor_track::state>> &States, std::vector<TTrack *> &Changed);
void joints_fix(std::vector<int> const &Indices);