18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 05:57:08 +01:00
Commit Graph

6 Commits

Author SHA1 Message Date
maj00r fffdbb9578 fix(editor): no diverging track is laid from a main track that isn't laid, a switch track with no pieces isn't written
- lay_diverging() didn't look at turnout_frame::valid: with the main track unsolved the diverging track was laid from the origin
  and settle moved its end node there. Edits were rolled back by the check, but nothing refused it at its source. It now
  returns an error, for every caller.
- whole_path() took Pieces.front() of a track the cutter gave no pieces of; the switch track is refused with the reason.
- Sonar: the turnout lookups of the node and network checks are guarded (S2259), the search of the free transition and the
  test loops count in integers (S2193; 2 m steps, the same values as their sum), the seeded generator of the turnout edits
  is marked (S2245).
2026-11-24 18:52:04 +01:00
maj00r e95ee2fc4c Merge ui/editor-first-steps into feat/editor-track-turnouts
# Conflicts:
#	editor/layout/layoutNetwork.cpp
2026-11-24 18:50:23 +01:00
maj00r 4ae90e99c6 fix(editor): the norms see a Bloss transition as it is, a line splits at the tangent point of an arc with no transitions
- A Bloss transition went to the norms as an even one: 60 m into R 600 m at 100 km/h showed 63 mm/s of deficiency change,
  where its middle reaches 109 mm/s, past the hard limit of 80 mm/s, so the edit wasn't blocked. norms::element::bloss makes the
  engine follow 3t^2 - 2t^3 of the curvature, look at the transition in eight pieces, and take the shift as L^2 / 40R instead
  of L^2 / 24R. Two Bloss halves no longer run on into one element of the chain.
- split_line right at the tangent point of an arc without transitions was refused ("the tangent there doesn't cross the
  tangents of the curve"): the curvature there is already the arc's, so it now takes the start or the end of the curve.
- Sonar: the chain walk, describe_chain and check_norms check the lines they look up (S2259), join_ends returns when an end
  isn't found rather than when a reason was given (S836), the test loops count in integers (S2193), the seeded generator
  of the random edits is marked (S2245).
2026-11-24 18:48:49 +01:00
maj00r 6f0b8be091 feat(editor): the edits E2a left: vertices, the grade line, the class and the profile of a line, a join from a curve, no new BLOCK
The rest of the list E2a left for E2b (editor-tracks-domain.md §8), commands of the domain model of the track geometry like the others:
kept whole or refused with the reasons, one step to undo.

- insert_vertex (after a vertex, or after the start, with its radius, transitions and cant, its id given) and remove_vertex.
- set_grades: the breaks of the grade line with their heights and vertical radii; checked by the solver (overlapping vertical curves)
  and the norms.
- set_line_class and set_line_profile: the class of a line (its speed, traffic, main or side track) and a profile of the norms of its
  own (the line's own wins over the areas, as norms::area_map has it); a chain of the norms doesn't run on into a line of another
  profile of its own. The tracks of a turnout take a class too, their speeds derived again.
- join_ends from a free end in a curve (a line cut inside one): one curve where the tangents meet, going on from the curve at the end,
  its arc of the radius there with no transition (or, where that doesn't fit, a radius the norms prefer and a transition from the
  curvature of the end), the transition at the straight end as long as makes the curve begin right at the curved end (bisected to the
  bit), refused where both ends lie in curves or the curve would turn the other way. The original join and this one lay the new line
  the same way (add_joined).
- edit_policy::no_new_block for old tracks (stage E6): an edit is refused by a BLOCK finding only where it adds one; one there before,
  of the same parameter on the same stretch (the elements within 1.5 m, the findings carry their element as points of the plan) and no
  worse, doesn't refuse; the same rule of the same turnout neither. The invariants refuse in any case. model(network) takes a network
  over as it is, the norms not asked.

Tests: U: a vertex put in and another after it, both taken out, the line as it was; a grade break and its vertical curve, two
overlapping and one of no radius refused; a class of 200 km/h refused on curves fine at 80, one of 60 kept; R 280 m at 80 km/h warned
by PLK, not by the TSI as the line's own profile; a line joined to a free end in an arc going on from it with the transition the part
taken away had, the track the same within a micrometre; both ends in curves refused; R 170 m laid by the TSI and judged by PLK: an
edit refused when any BLOCK refuses, kept with no_new_block, a sharper curve and a cant past (R - 50) / 1.5 refused, a wider curve
kept. P: 250 random edits of an old track breaking the norms (curves laid for 80 km/h judged at 120), seed 4242, with no_new_block: no
BLOCK finding over all the network which wasn't there before, a refusal changing nothing, an undo exact; the random edits with
turnouts put vertices into straight lines and take them out.
2026-11-23 12:41:49 +01:00
maj00r 4a3b36c204 feat(editor): the turnouts of the track geometry, laid into a line, moved, changed and taken out, their legs nodes
E2b (editor-tracks-domain.md §2, §4 "Rozjazd", §7, §8): a turnout is an aggregate of the domain model, laid from the catalogue the
editor lays its switches from, its rules invariants which refuse.

- layoutTurnout: the type of the catalogue (switch_design::catalogue(), Id-4) as the model lays it: R, 1:n, a, b, the main length,
  the lead and the parts of the diverging track, the movable nose, the blades; the ordinary switches whose diverging track leaves
  tangentially, the double, symmetric and secant ones refused with the reason (E5). The diverging track laid off the start along the
  turnout: on a straight the curve of the type; bent with the main track the curve of the basic switch of the radius of table 11.8
  (switch_curve::bent_radius), over the length which keeps its turn off the main track, so the angle of the frog stays 1:n, the lead
  and the straight through the frog bent along with the main track; the cant of the main track all along it, the grade of its start.
  The speeds: the diverging one by switch_curve::branch_speed (the rule the editor writes), the main one the line's, bent no faster
  than the deficiency of the frog lets it; the velocity written by the same rule as the editor's.
- The turnout: its type, hand, direction along the line, its start, the ends of its two tracks (nodes), its main and diverging track
  (lines it owns), derived: the kilometrage of its start, the bending, the cant, the speeds. The network keeps the turnouts with the
  lines and the nodes, in the snapshots of undo and in the transactions; settle() has a turnout whose main track or start changed
  lay its diverging track again, move the node at its end and lay again the lines going on from there.
- The nodes: three ends at the start of a turnout, its two tracks on one side of it; the start of a diverging track tells its node
  nothing (the node keeps the curvature of the main track) and runs on into no line, the end of one sets its node.
- check(): the turnouts whose tracks or legs are touched, their invariants (the legs, the tracks, the main track as long as the type)
  and the rules of Q2 and 11.4 through switch_curve::check (the curvature of each track of one sign, KZW II refused; the cant the same
  over it; the ends of the ramps at its ends or 6 m off it), a switch of 1:9.403 or steeper than 1:9 bent in a main track refused (the
  model knows a main track from a side one, where the editor only warns), table 11.9 and a transition under it as warnings. The norms
  of the E1 module with the switch context: the elements of a turnout track are a connection of tracks of their frog (fixed or movable
  nose: the deficiency of tab. 9.7), bent or not (the cant of tab. 9.6), at its speeds; the chain of the line runs through the main
  track, the element cut by a turnout open. BLOCK findings are kept apart from the broken invariants (verdict::blocks).
- The commands: insert a turnout at a chainage of a line (cut at its legs, the part between them its main track), move it along its
  line (the lines on both sides and its main track one line again, cut anew, the ids kept, a line going on from the end of its
  diverging track carried with it), change its type or hand, remove it (the line one again where it can be: the merge laid and kept
  only where it's the same track within a micrometre). The tracks of a turnout aren't split, deleted or edited as lines; a line is joined
  to the free side of a turnout's start, or to the end of its diverging track from a straight (the curvature stepping there).

Tests: U: the types laid and refused; the legs on a straight against the catalogue for four types both hands both ways (the main
track a + b, the tangent of the diverging end meeting the main track at R tan(a/2), Id-4's a within half a millimetre, the angle 1:n,
the speeds of table 11.2); Rz 60E1-500-1:12 bent outward and inward into R 1200 m with 60 mm (r" 857.8 m and 352.7 m, 60 km/h, the
angle of the frog kept, the cant over it); refusals: KZW II, a ramp under it and 3 m off it, a 1:7.5 bent in a main track (laid in a
side track), no type, no hand, no room; moved, changed, turned, taken out with the line laid again within a micrometre, each a step
to undo; a line from the diverging end carried along. P: 250 random edits with turnouts each, seeds 20261124, 31 and 977 (laid,
moved, changed, taken out, with vertices moved and set, splits, joins, deletions, undo, redo): the invariants after each (the legs
and the nodes whole, three ends only at a start, the velocity by the rule), no BLOCK, a refusal changing nothing, an undo exact.
2026-11-23 12:41:49 +01:00
maj00r 555b77b11d feat(editor): the nodes of the track geometry and the commands editing the lines, kept whole or refused, one step to undo
Continues E2 (editor-tracks-domain.md §4 "Edycja = polecenie", §8): the lines meet at nodes, and every edit is a command which
proposes a new state, has what depends on it laid again, is checked and kept, or refused with its reasons and nothing changed.

- layoutNetwork: the node, its place (the only coordinates of the ends of the lines), the heading, the curvature, the cant and the
  grade, and the ends of the lines meeting there, each with its sense along the heading; the network of the nodes and the lines
  with the profiles of the norms by place and the identifiers handed out once, never again (an undone line made again is a new one).
  A transaction keeps each line and node the first time it touches it, so a change is rolled back whole or recorded.
- settle(): the lines touched laid again; the nodes take the values of their ends (a free end follows its line, a node keeps the
  curvature and the cant a line going on from it reads), a line going on from a node whose curve changed is laid again.
- check(): the invariants of the touched lines and nodes: laid, at their nodes, two ends at most on the two sides of a node (more
  is a turnout, E5), the heading the same within 1e-9 rad, the cant within 0.5 mm, the grade within the 2 per mille that needs no
  rounding; and the norms along the chains through the touched lines (the lines running on through the nodes as one line, the
  elements running on alike across a node as one, a jump of the curvature at a node a step of the deficiency the profile judges):
  BLOCK refuses, WARN and PREFER are told as notices.
- layoutCommands: create a line between two new nodes; move a vertex; set its radius, transitions or cant; split a line at a
  chainage (the track kept as it was: on a straight, in an arc, in a clothoid with a straight ramp, the parts going on from the new
  node at its curvature and cant; refused inside a vertical curve and inside a Bloss or cubic parabola transition); join two free
  ends with a line solved between them (a straight, a curve where the tangents meet, or two curves, the largest radius which fits
  with the cant and the transitions the norms prefer, a grade line meeting the grades of the ends); delete a line (a node left with
  no end goes). The model keeps the network and the steps: undo and redo restore the snapshots of the lines and nodes a command
  touched, one step a command.

Tests: the cases of each command, a refusal (a radius under the least, a cant over the greatest, curves overlapping, transitions
too long) leaving the state as it was, a WARN radius kept with its notice, undo and redo, the track the same along a line split on a
straight, in an arc and in a clothoid, a middle part deleted and joined again both ways round, a straight joining two ends on one
straight. P: 300 random edits each with the seeds 20261123, 7 and 450 (moved vertices, new radii, transitions and cants, splits,
joins, deletions, undo, redo): after each the invariants checked on their own (each element running on from the last, the cant
running on, the ends of the lines at their nodes to the bit, the heading, the cant and the grade running on through the nodes) and
no BLOCK along any chain; a refused command leaves the state as it was, an undo gives the state before the command.
2026-11-23 11:30:24 +01:00