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

feat(editor): a track deleted cuts the design kept for its line down to the tracks left along it, in the same step of the undo history: a design keeps the stretch of its line it stands for (//$h kept <from> <to>), a track deleted in the middle parts it in two, one at an end shortens it, a design with no track left is forgotten. The geometry stays as designed, only its reach changes. A design cut down isn't taken whole by the route plan nor merged with a new one nor carried along by a switch slid, and gives no designed curve to the tracks left of a curve it cut, which are recognized as they lie: a track laid by hand into the gap is never pulled back to the old shape. The status tells of it. The //$h click lines are the editor's own now: read back with their design, and written once on save instead of staying behind and piling up. Selftests on a copy of wgr.scn: a track of a compound curve deleted in the middle, undone and redone, one at an end, all of a piece, saved and read back

This commit is contained in:
maj00r
2026-10-26 19:50:35 +01:00
parent eb3d3eb1e0
commit aed2cfad2c
10 changed files with 147 additions and 18 deletions

View File

@@ -536,12 +536,12 @@ bool editor_mode::digitize_chain(editor_track::chain const &Chain, std::string *
for (auto const index : covered)
{
auto const &old{records[index]};
auto const start{alignment_store::chainage_on(result, old.design.start)};
auto const end{alignment_store::chainage_on(result, old.design.end)};
auto const start{alignment_store::chainage_on(result, alignment_store::kept_start(old))};
auto const end{alignment_store::chainage_on(result, alignment_store::kept_end(old))};
if (false == start.has_value() || false == end.has_value())
return false;
if (index == *covered.begin() && *end > *start)
origin = old.origin - *start;
origin = old.origin + old.from - *start;
}
auto const layer{covered.empty() ? alignment_store::layer_of(*Chain.tracks.front()) : records[*covered.begin()].layer};
for (auto index{covered.rbegin()}; index != covered.rend(); ++index)