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

feat(editor): the top view draws the tracks whole, without the ballast or the rails alone, in a colour of their own over the imagery and the map: both rails close up, one line further out; a choice by the extent and in the View menu, kept in the settings

This commit is contained in:
maj00r
2026-10-23 13:20:06 +02:00
parent fe3dd758ea
commit a892532fda
9 changed files with 137 additions and 27 deletions

View File

@@ -109,7 +109,11 @@ bool editorSettings::load()
else if (key == "track_tools_all")
m_track_tools_more = (value == "1");
else if (key == "top_ballast")
m_top_ballast = (value == "1");
m_top_tracks = value == "1" ? 0 : 1;
else if (key == "top_tracks")
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.rfind(origin_prefix, 0) == 0)
@@ -158,7 +162,8 @@ bool editorSettings::save()
stream << "first_steps " << (m_first_steps ? 1 : 0) << "\n";
stream << "terrain_offer " << (m_terrain_offer ? 1 : 0) << "\n";
stream << "track_tools_all " << (m_track_tools_more ? 1 : 0) << "\n";
stream << "top_ballast " << (m_top_ballast ? 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 << std::fixed << std::setprecision(3);
for (auto const &origin : m_orthophoto_origins)

View File

@@ -1,5 +1,6 @@
#pragma once
#include <cstdint>
#include <map>
#include <string>
#include <utility>
@@ -62,8 +63,10 @@ public:
bool track_tools_more() const { return m_track_tools_more; }
void track_tools_more(bool Show) { m_track_tools_more = Show; }
// the ballast of the railway drawn in the top view
bool top_ballast() const { return m_top_ballast; }
void top_ballast(bool Show) { m_top_ballast = Show; }
int top_tracks() const { return m_top_tracks; }
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
{
@@ -86,7 +89,8 @@ private:
bool m_first_steps{true};
bool m_terrain_offer{true};
bool m_track_tools_more{false};
bool m_top_ballast{true};
int m_top_tracks{0}; // the railway in the top view: whole, without the ballast, the rails alone
std::uint32_t m_top_rails{0xffd246ff}; // colour of the rails alone, as ImGui keeps it: ABGR
track_norms m_norms{track_norms::ask};
};