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

feat(editor): Straight and Curve are one Plan tool (G, also C) right after Lay track, a straight opens with its grips, a curve or a line with its vertices; digits no longer type a length while extending from a free end; the scenery wizard chooses realistic or fictional, a realistic one gets //$g and //$o and opens with the orthophoto in the top view, a fictional one only the top view with the grid; the orthophoto settings are kept in the scenery as //$o (on, year, opacity, radius, height, drape, lift, hires, scene, origin) and survive the new formats; self-test command mapstate

This commit is contained in:
maj00r
2026-10-12 02:21:29 +02:00
parent 653d206a54
commit 16c90eb674
12 changed files with 209 additions and 85 deletions

View File

@@ -677,6 +677,57 @@ bool editor_orthophoto::owns(gfx::geometry_handle const &Geometry)
return Geometry.bank != 0 && std::find(scene_banks.begin(), scene_banks.end(), Geometry.bank) != scene_banks.end();
}
std::string editor_orthophoto::mark(config const &Config, bool const Enabled, bool const Origin)
{
char text[256];
std::snprintf(text, sizeof(text), "on %d year %d opacity %.2f radius %d height %.2f drape %d lift %.2f hires %d scene %d", Enabled ? 1 : 0, Config.year, Config.opacity, Config.radius, Config.height, Config.drape ? 1 : 0, Config.lift, Config.hires ? 1 : 0, Config.in_scene ? 1 : 0);
std::string result{text};
if (Origin)
{
std::snprintf(text, sizeof(text), " origin %.2f %.2f", Config.north, Config.east);
result += text;
}
return result;
}
bool editor_orthophoto::read_mark(std::string const &Text, config &Config, bool &Enabled)
{
std::istringstream words{Text};
std::string key;
auto found{false};
while (words >> key)
{
if (key == "on")
words >> Enabled;
else if (key == "year")
words >> Config.year;
else if (key == "opacity")
words >> Config.opacity;
else if (key == "radius")
words >> Config.radius;
else if (key == "height")
words >> Config.height;
else if (key == "drape")
words >> Config.drape;
else if (key == "lift")
words >> Config.lift;
else if (key == "hires")
words >> Config.hires;
else if (key == "scene")
words >> Config.in_scene;
else if (key == "origin")
words >> Config.north >> Config.east;
else
continue;
if (words.fail())
return found;
found = true;
}
Config.radius = std::clamp(Config.radius, 0, max_radius);
Config.opacity = std::clamp(Config.opacity, 0.0f, 1.0f);
return found;
}
void editor_orthophoto::enabled(bool State)
{
if (State == m_enabled)

View File

@@ -93,6 +93,8 @@ class editor_orthophoto
// disabling drops the queue and returns the gpu memory of the resident tiles
void enabled(bool State);
config const &settings() const { return m_config; }
static std::string mark(config const &Config, bool Enabled, bool Origin);
static bool read_mark(std::string const &Text, config &Config, bool &Enabled);
// changes of year / resolution invalidate resident tiles, the rest applies immediately
void settings(config const &Config);
void ground_source(ground_query Query) { m_ground = std::move(Query); }