mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-23 03:01:10 +02:00
feat(editor): connections of tracks laid whole from the switch tool: a crossover with a straight insert or an aligning curve between switches of different angles or tracks that aren't parallel, a double crossover meeting on either track, a scissors crossover with the crossing of its inserts, and a switch ladder onto the parallel tracks of a fan or onto new ones at given spacings; press on a straight and drag onto the other track, Shift+wheel the kind, Ctrl+wheel the R of the aligning curve, Alt+wheel where a double crossover meets; the ghost shows the whole set with the spacing, the inserts and the distance of the mathematical points; switches get their drives and a //$r connection record; the crossover drawn from a diverging end uses the same solver; self-test connection
This commit is contained in:
@@ -278,6 +278,26 @@ void editor_mode::record_double(TTrack &First, TTrack &Second, editor_track::swi
|
||||
switch_store::put(entry, alignment_store::layer_of(First));
|
||||
}
|
||||
|
||||
void editor_mode::record_connection(connection::kind const Kind, std::vector<TTrack *> const &Switches, connection::result const &Plan, editor_track::switch_template const &Shape)
|
||||
{
|
||||
if (Switches.empty() || Switches.front()->eType != tt_Switch || Switches.front()->m_paths.size() < 2 || scene::Layers.empty())
|
||||
return;
|
||||
auto entry{switch_entry(Shape)};
|
||||
entry.kind = "connection";
|
||||
entry.name = Switches.front()->name();
|
||||
for (auto const *track : Switches)
|
||||
if (track->name().empty())
|
||||
return;
|
||||
else
|
||||
entry.parts.push_back(track->name());
|
||||
switch_store::place(entry, *Switches.front());
|
||||
switch_store::classify(entry, *Switches.front());
|
||||
entry.type = connection::word(Kind);
|
||||
entry.a = Plan.spacing;
|
||||
entry.b = Plan.straights.empty() ? 0.0 : Plan.straights.front();
|
||||
switch_store::put(entry, alignment_store::layer_of(*Switches.front()));
|
||||
}
|
||||
|
||||
std::optional<editor_mode::double_switch> editor_mode::double_of(TTrack const &Track) const
|
||||
{
|
||||
auto const of_switch = [](TTrack const &Switch) -> std::optional<double_switch> {
|
||||
|
||||
Reference in New Issue
Block a user