17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-31 15:49:06 +01:00

feat(editor): the tracks are laid to the PKP PLK norms only: the choice of the free laying is gone, its cards in the panels of the laying and of the plan, the question as the laying starts and the setting; the transition curves and the cant of the norms always, the speed of the laying with its chips, the radius below the minimum for the speed a warning. The settings keep the radii the bends of the straights will be eased with instead

This commit is contained in:
maj00r
2026-10-24 20:05:04 +02:00
parent 5ae9932ce7
commit 9855de74b4
11 changed files with 43 additions and 248 deletions

View File

@@ -114,8 +114,18 @@ bool editorSettings::load()
m_top_tracks = std::clamp(std::atoi(value.c_str()), 0, 2);
else if (key == "top_rails")
m_top_rails = static_cast<std::uint32_t>(std::strtoul(value.c_str(), nullptr, 16)) | 0xff000000u;
else if (key == "track_norms")
m_norms = value == "free" ? track_norms::free_laying : value == "plk" ? track_norms::plk : track_norms::ask;
else if (key == "corner_radii")
{
// low;high
double low{0.0}, high{0.0};
if (auto const separator{value.find(';')}; separator != std::string::npos)
{
parse(value.substr(0, separator), low);
parse(value.substr(separator + 1), high);
if (low >= 10.0 && high >= low)
corners(low, high);
}
}
// under a key of its own since the laying goes from point to point unless told otherwise: the fitted heights chosen
// before, when they were the default, are left behind
else if (key == "laying_heights")
@@ -168,7 +178,7 @@ bool editorSettings::save()
stream << "track_tools_all " << (m_track_tools_more ? 1 : 0) << "\n";
stream << "top_tracks " << m_top_tracks << "\n";
stream << "top_rails " << std::hex << (m_top_rails & 0xffffffu) << std::dec << "\n";
stream << "track_norms " << (m_norms == track_norms::free_laying ? "free" : m_norms == track_norms::plk ? "plk" : "ask") << "\n";
stream << "corner_radii " << m_corner_low << ";" << m_corner_high << "\n";
stream << "laying_heights " << (m_heights == lay_heights::points ? "points" : m_heights == lay_heights::level ? "level" : "fitted") << "\n";
stream << std::fixed << std::setprecision(3);
for (auto const &origin : m_orthophoto_origins)

View File

@@ -67,15 +67,14 @@ public:
void top_tracks(int const Tracks) { m_top_tracks = Tracks; }
std::uint32_t top_rails() const { return m_top_rails; }
void top_rails(std::uint32_t const Colour) { m_top_rails = Colour; }
// how the new tracks are laid: asked as the laying starts, or the choice kept
enum class track_norms
// the radii the laying from point to point eases the bends of the straights with, at the peak of the two transition curves
double corner_low() const { return m_corner_low; }
double corner_high() const { return m_corner_high; }
void corners(double const Low, double const High)
{
ask,
free_laying,
plk
};
track_norms norms() const { return m_norms; }
void norms(track_norms Norms) { m_norms = Norms; }
m_corner_low = Low;
m_corner_high = High;
}
// the heights of the tracks laid on the ground: fitted to it as the tracks go onto the terrain, the points clicked on it with
// even grades between them, level
enum class lay_heights
@@ -101,7 +100,8 @@ private:
bool m_track_tools_more{false};
int m_top_tracks{0}; // the railway in the top view: whole, without the ballast, the rails alone
std::uint32_t m_top_rails{0xffff6e28}; // colour of the rails alone, as ImGui keeps it: ABGR
track_norms m_norms{track_norms::ask};
double m_corner_low{3000.0};
double m_corner_high{6000.0};
lay_heights m_heights{lay_heights::points};
};