17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-03 00:26:22 +01:00

fix(editor): the whole-scenery grade fit takes spans a few metres apart for one bridge, leaves the culverts on the embankment and ends a bridge at a joint by its abutment

Bridged stretches less than 5 m apart are merged into one bridge on its piers, and those shorter than 3 m, a ditch or a
culvert under the embankment, are no bridge. A bridge end within 1 m of a joint of the route or a break of the line moves to
it, so the cut leaves no sliver of a path by the abutment. Against the OpenStreetMap railway bridges the marked share stays
the same (lk91 60 of 66, TG 90 of 104); the places with nothing under them in the map fall from 6 to 4 on lk91 and from 18
to 12 on TG, and the bridge paths shorter than 1 m from 9 to 0 and from 11 to 1.
This commit is contained in:
maj00r
2026-10-22 05:56:05 +02:00
parent 0d9fa6337d
commit 7fb9d2d458
2 changed files with 26 additions and 3 deletions

View File

@@ -2073,10 +2073,22 @@ bool editor_mode::nmt_fit_line(TTrack &Track)
// are cut off and set to the bridge, the formation is laid up to it, the ground under it stays as the model has it
double constexpr kBridged{1.0}; // m
double constexpr kAbutment{100.0}; // per mille
// spans a few metres apart are one bridge on its piers; what is shorter than that is a culvert under the embankment
double constexpr kPier{5.0}; // m
double constexpr kCulvert{3.0}; // m
std::vector<double> heights(count);
for (std::size_t i = 0; i < count; ++i)
heights[i] = profile::elevation(fitted_line, sampled[i]);
auto const bridges{profile::bridged(sampled, heights, model, kBridged, kAbutment)};
std::vector<profile::departure> bridges;
for (auto const &stretch : profile::bridged(sampled, heights, model, kBridged, kAbutment))
if (false == bridges.empty() && stretch.from - bridges.back().to < kPier)
{
bridges.back().to = stretch.to;
bridges.back().depth = std::min(bridges.back().depth, stretch.depth);
}
else
bridges.push_back(stretch);
bridges.erase(std::remove_if(bridges.begin(), bridges.end(), [&](profile::departure const &Bridge) { return Bridge.to - Bridge.from < kCulvert; }), bridges.end());
profile_apply(false, bridges);
auto const applied{profile.error.empty()};
// where the line parts from the model: under it a gap, a bridge or a viaduct, over it a wall or a structure above the track