mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-21 00:32:39 +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:
@@ -230,18 +230,49 @@ editor_mode::selftest_result editor_mode::selftest_join(std::string const &comma
|
||||
WriteLog(format("SELFTEST layclicks %d paths, ballast foot over the ground up to %.3f m, under it up to %.3f m", paths, hanging, buried));
|
||||
return selftest_result::handled;
|
||||
}
|
||||
if (command == "jointsmodel")
|
||||
{
|
||||
// the whole scenery against the terrain model, as the check of the panel does it, waiting for the model
|
||||
static bool started{false};
|
||||
if (false == started)
|
||||
{
|
||||
double threshold{0.5};
|
||||
words >> threshold;
|
||||
m_joints.scope = 1;
|
||||
m_joints.model_check = true;
|
||||
m_joints.model = threshold;
|
||||
joints_start();
|
||||
started = true;
|
||||
}
|
||||
joints_step();
|
||||
if (m_joints.next < m_joints.queue.size() || m_joints.model_waiting)
|
||||
{
|
||||
--m_selftest.next;
|
||||
return selftest_result::pause;
|
||||
}
|
||||
started = false;
|
||||
std::size_t count{0};
|
||||
for (auto const &issue : m_joints.issues)
|
||||
if (issue.type == joint_issue::kind::model && count++ < 40)
|
||||
WriteLog(format("SELFTEST jointsmodel: %+.2f m at %.1f %.1f, %s path %d", issue.value, issue.position.x, issue.position.z, issue.track != nullptr ? issue.track->name().c_str() : "-", issue.point.path));
|
||||
WriteLog("SELFTEST jointsmodel: " + m_joints.status);
|
||||
return selftest_result::handled;
|
||||
}
|
||||
if (command == "joints")
|
||||
{
|
||||
std::vector<glm::dvec3> points;
|
||||
for (glm::dvec3 point{0.0}; words >> point.x >> point.z;)
|
||||
points.push_back(point);
|
||||
auto const scope{m_joints.scope};
|
||||
auto const model{m_joints.model_check};
|
||||
m_joints.scope = 1;
|
||||
m_joints.model_check = false;
|
||||
joints_start();
|
||||
while (m_joints.next < m_joints.queue.size())
|
||||
joints_step();
|
||||
m_joints.scope = scope;
|
||||
char const *const kinds[]{"gap", "step", "kink", "cant jump", "grade break", "free end"};
|
||||
m_joints.model_check = model;
|
||||
char const *const kinds[]{"gap", "step", "kink", "cant jump", "grade break", "off the terrain model", "free end"};
|
||||
int around{0};
|
||||
for (auto const &issue : m_joints.issues)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user