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

5 Commits

Author SHA1 Message Date
maj00r 8b48cfddae Merge feat/editor-legacy-takeover into feat/editor-model-turnouts-ui
# Conflicts:
#	editor/project/projectSession.cpp
2026-11-24 19:15:20 +01:00
maj00r 0301c6e9cc fix(editor): the pieces of a cut old track get its events as the simulator fires them, its joints follow a line laid anew
- keep_old_tracks() kept all the events on the first piece of an old track. The simulator fires event1 as a vehicle enters a
  track at its Point2, event2 at its Point1 and event0 while it stands on it (TrkFoll.cpp), so with a 120 m track cut into 40
  and 80 m a train running towards Point1 got event1 about 80 m late, and one standing on the second piece no event0. Now each
  piece gets event0/eventall0, the piece at Point1 event2/eventall2 and the piece at Point2 event1/eventall1. The keywords are
  compared in any case, as the simulator lowers its tokens.
- The joints of the old tracks kept their chainages through move_vertex, set_vertex, insert_vertex and remove_vertex: widening
  a 90° curve by 20 m shortens the line by about 8.6 m, and a joint past the new end was dropped, a short buffer-stop or signal
  track there with its name, events and circuit. Each joint now goes to the point of the new line nearest to where it was.
  solved_line::nearest() is shared with the crossover planner.
- Sonar: the seeded generators of the takeover tests are marked (S2245), two dereferences after a REQUIRE too (S2259).
2026-11-24 19:15:18 +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 6c2d467c5a feat(editor): the switches of the switch tool on the lines of the model its turnouts, inserted, moved, changed and taken out by its commands
Continues E4a (editor-tracks-domain.md §7, §8; stage E4b): with the editing on the model on, a switch dragged on a track of a line of
the model is a turnout of the catalogue of the model, and so on, each a command, refused with the reasons or one step of the history.
The switches of the old tracks are laid the old way.

- The drag of the switch tool, let go on a line of the model (on a straight or along a curve), is insert_turnout: the type of the
  catalogue the template is of (a template of the user's own isn't), its start where it was pressed, its chainage on the line
  (layout::chainage_of), the side of the drag its hand, the way it was dragged its direction. While it's dragged the panel tells in its
  red line why the model would refuse it, tried on a copy; let go, a refusal is told there with the value, the limit and the paragraph
  ("(9.6 pkt 16)"), nothing changed. Laid: its switch track made by the generator (t<n>), selected, the panel placed, its speed told.
- A turnout of the model selected: the inspector shows its type, side, speeds and bending, the templates of its kind of the catalogue
  (change_turnout), the other side (change_turnout of the hand), moved by a distance (move_turnout), taken out (remove_turnout). The
  slide of the switch tool moves it, another template changes it, Del takes it out (after the scenarios are looked through), each a
  command. Plan on a track of a turnout doesn't open: the turnout is edited through itself.
- A crossover dragged between two lines of the model is connect_tracks of the solver of the connections; refused, the solver's best
  proposal is told with the reasons ("Proposal: Rz 60E1-300-1:9 needs them 4.498 m apart").
- The tracks after a command: of a turnout one of whose tracks changed, its tracks of the simulator made again whole, kept by its main
  track (kind switch, the plain tracks of a double switch, a slip or a crossing with them); written with the scenery as the generator
  made them, recorded in the project with their kind and the file each went into (session::record_written of pieces of several files),
  found again when the map is opened, nothing taken for changed by hand. project::session::generate(turnout_id).

Self-test: modelturnoutside <track>; expect modelproposal <holds|lacks> <text>, expect handlines <count>; expect modelends checks the
paths of the switch tracks at the numbers of the nodes; a crossover of the connection command between two lines of the model goes to
the solver of the model. The cases m_8_turnout (a turnout dragged on, taken back and brought again, moved, given another type and side,
taken out by Del; one 2 m off the end of a cant ramp refused, nothing changed; saved and found after a reopen) and m_9_crossover (a
crossover between lines 4.75 m apart, one between lines 4 m apart refused with the proposal).

Tests: U: the chainage of a point on a line and its distance; the switch track of a turnout made by the session, the tracks of a line
written into two files recorded.

lang/editor_pl.po: the Polish of the new texts.
2026-11-23 18:48:19 +01:00
maj00r f83afa8a96 feat(editor): the elements and the line of the track geometry, a module of their own
The first part of E2 (editor-tracks-domain.md §2 - §4): the geometry of a line computed in one place, editor/layout, standing on its
own with no scene, no tracks and no user interface. Nothing of the editor uses it yet; the route design keeps its own solver.

- layoutElements: the elements of a line, the straight, the arc, the clothoid (the curvature changing evenly, from any curvature to
  any other), the Bloss curve (3t^2 - 2t^3) and the cubic parabola (y = x^3 / 6RL by the abscissa, the length along it its own):
  the length, the curvature along, the point and the heading at a distance, a point offset from the axis, the shift of the arc. The
  local forms of the clothoid and the cubic parabola and the blossom of a Bezier curve are the ones of editorAlignment.cpp, moved
  here word for word; the alignment calls them, so the two agree to the bit and its tests run as before.
- layoutLine: the line as a tangent polygon between the points of its two end nodes (it has no coordinates of its own there), its
  vertices with the radius, the transitions in and out and the cant, a grade line of breaks with their vertical curves, the shape of
  the transitions and of the cant ramps (linear or Bloss). solve() lays it: each curve fitted in the frame of its tangent point
  from its deflection (the arc what the transitions leave of it), the straights what the tangents leave of the sides, every element
  placed from the polygon so nothing drifts; the cant held along the arcs, ramped along the transitions, a step refused; the heights
  and the grades by the breaks. An end can go on from the curvature and the cant its node holds (a line split inside a curve):
  its curve begins right at the node. What can't be laid is an error with the vertex and the metres: curves overlapping, a curve
  starting before the start, transitions turning more than the tangents, a cant step, a vertical curve past the end.
- described(): the line as the norms module reads it (elements, cant points, grade elements), a Bloss ramp seen by eight points
  so its steeper middle counts. preferred_curve(): the cant and the transition length the profile prefers for a radius at the line
  class, the deficiency, the excess and the greatest cant of PREFER, else of WARN, the transitions long enough for dD/ds, dD/dt
  and dI/dt.
- norms::line_class compares by its values (operator==), the line keeping it compares whole.

Tests (U): the clothoid, the cubic parabola, the Bloss curve and the arc against the series of the textbooks (the end point, the
length of the parabola, the shift: L^2/24R and L^2/40R), the point as the integral of the heading, the circles alongside an arc, the
curve of a vertex by its tangent length (R + p) tan(a/2) + x_m.
2026-11-23 11:30:12 +01:00