17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-29 03:27:30 +01:00

feat(editor): the signals and the signs by a track go with it as the Plan lays it anew, square to the line, not along it

A curve laid anew, its radius changed or made compound, or a straight moved: the paths of the chain are cut again where their joints stood, set square onto the new line, each keeping its stretch of the ground, so their events, their track circuits and the cuts of the block sections stay where they were instead of being handed on along the line; the parts between the switches alike, the old even sharing kept where the joints don't follow one another along the new line.

The objects by a track taken for a change go with it by themselves: the signals and the warning discs it or its run reads, the SHP resonators by their events, and the controls of the block sections, the hectometre posts, the W17 markers and the other signs by the track nearest to them, within 12 m. They move square to the new axis keeping their offset and their turn, an object moved by hand meanwhile staying where it was put. Such a binding isn't kept in the scenery nor shown among the bound objects of the infra tool, which can still bind the object for good, and the undo and the redo take the objects back and forth with the tracks. The status of the Plan tells how many objects moved with the tracks. A path taking an object over the other way round keeps it on its side, turned as it was.
This commit is contained in:
maj00r
2026-10-22 21:32:34 +02:00
parent 4c55951d8a
commit c024d7c262
11 changed files with 336 additions and 30 deletions

View File

@@ -2372,6 +2372,23 @@ class editor_mode : public application_mode, private editor_track::observer, pri
std::vector<infra::object_state> m_infra_buffer; // states of the objects before the change in progress
std::vector<std::pair<scene::instance_handle, std::string>> m_drive_buffer;
bool m_infra_suspended{false};
// the point objects which go with a path: the signals and the warning discs it reads, the SHP resonators, and the controls of the
// block sections, the signs and the posts by the path nearest to them
struct point_object
{
scene::instance_handle include{0};
glm::dvec3 location{0.0};
TTrack *reader{nullptr};
TTrack *nearest{nullptr}; // of one no path reads
infra::category group{infra::category::other};
};
std::vector<point_object> m_point_objects;
std::size_t m_point_objects_revision{static_cast<std::size_t>(-1)};
std::size_t m_point_objects_count{0};
void infra_adopt(TTrack &Track);
int infra_bound_count() const; // by the infra tool, not the ones a change of their track took along
std::set<std::pair<scene::basic_node const *, scene::instance_handle>> m_infra_carried; // the objects their tracks moved since the tool cleared it
std::string infra_carried_note(); // a line of the status telling how many, empty for none; clears them
void infra_load();
void infra_store();
void infra_forget(scene::basic_node const *Node);