--track: Bahnzusammenhang aus der TrackIds-Spalte statt aus Nachbarn

build_track_graph baut die Fein-Adjazenz jetzt direkt aus der geordneten
TrackIds-Spalte je Container (Element.track_ids): Kreisel als zirkulaerer
Umlauf in Drehrichtung (Export-Sortierung), Strecke/Gefaelle als lineare
Kette AS -> SEP.. -> ES. Gemeinsame AS/ES-/Weiche-Knoten verketten die
Container automatisch - die Rueckmeldungs-/Rollen-Heuristik aus der
Nachbarn-Spalte (_transfer_kreisel_lane, _wire_weiche,
_orient_separator_links) entfaellt komplett.

_attach_track_symbols misst offene Bahnenden jetzt am feinen Graphen statt
am groben; das behebt die vereinzelten Falsch-Eingaenge an voll verketteten
Bahnen (HundM05: Bahn 0001-0004, 0006-R).

Doku in doc/Python_Scripts.md und doc/track.md nachgezogen.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Michael Stangl
2026-09-17 09:59:09 +02:00
co-authored by Claude Opus 4.8
parent db4e975adf
commit 516f30278b
3 changed files with 228 additions and 387 deletions
+28 -16
View File
@@ -153,23 +153,35 @@ bidirectional and reported as a warning. `--doc` additionally cross-checks
stated `Anzahl_Separator`/`Anzahl_Scanner` counts against what was actually
attached.
`--track` builds a second, finer-grained graph instead of (in addition to) the
one above: Separator, Ausschleus-/Einschleuselement and Weiche each become
their own node (they supply no node in the graph described above), showing
the actual branch/merge/crossing topology between Kreisel rather than just the
mechanical objects. See `doc/track.md` for the derivation rules and its
tested-against-`mubea_export.csv` findings; short version:
`--track` builds a second, finer-grained graph in addition to the one above:
Separator, Ausschleus-/Einschleuselement, Weiche and the entry/exit points
(BTMT Be-/Entladung, Eingang/Ausgang) each become their own node (they supply
no node in the graph described above), showing the actual branch/merge/crossing
topology between Kreisel rather than just the mechanical objects.
- **Ausschleuselement** → 1 incoming (Kreisel-side) → 2 outgoing (continues
on the Kreisel-Bahn *and* branches onto the Strecke) — a fork.
- **Einschleuselement** → 2 incoming (from the Strecke *and* continuing on
the Kreisel-Bahn) → 1 outgoing — a merge.
- **Weiche** → 4-way crossing between two Kreisel (in/out on each side, from
`Drehrichtung` via the existing `_weiche_lane_roles`).
- A Kreisel-Bahn with no separator resolvable to a specific position (or with
several that aren't chained to each other in the export) is drawn as a
dashed **placeholder** node rather than guessed — the intended hand-off
point for a later geometry-based ordering pass (not implemented yet).
The ordering comes **directly from the `TrackIds` CSV column** (`Element.track_ids`):
every container — Kreisel, Strecke, Gefällestrecke — carries the ordered list of
the track elements lying on it, computed by the dxfmakros export
(`dxfmakros/doc/csv-export.md`). `build_track_graph` draws one directed chain per
container from that list:
- **Kreisel** → the circular umlauf in `Drehrichtung` order (the list is already
angle-sorted); consecutive entries are linked and the last closes back onto the
first (a real, closed loop). Edges are drawn light-blue ("Umlauf").
- **Strecke / Gefällestrecke** → the linear chain `AS → SEP… → ES` in build
order, oriented by its ends (Ausschleuselement = start, Einschleuselement =
end). Edges are drawn blue ("Bahn").
- An element listed in **two** containers (an AS/ES sits in its Strecke *and* in
the docked Kreisel's umlauf; a Kreisel-Kreisel Weiche sits in both Kreisel) is
the **same node** and stitches the containers together automatically — no
`Nachbarn`-based role/feedback heuristic any more.
- A track element that appears in **no** `TrackIds` list (e.g. a free Separator
the export didn't chain) is hung off a dashed **placeholder** for its
`Zuordnung` with an "unbestimmt" edge and a warning — order on that Bahn left
open. If the CSV has no `TrackIds` column at all (older export), every track
element falls into this case.
See `doc/track.md` for the fuller derivation notes.
| Switch | Argument | Default | Meaning |
|---|---|---|---|