[FIX] Export: Schnittpunkte zwischen Kreiseln werden erkannt und Weichen entsprechend gezählt und als Teil mit Merkmalen im Export befüllt - nur Kreisel mit gleicher Höhe können einen Schnittpunkt für Weiche bilden - Funktion der Weichenzählung manuell aufrufbar; [FIX] Eckrad nun korrekt angelegt und exportiert
This commit is contained in:
+38
-3
@@ -63,6 +63,7 @@ from export_blockpatterns import (load_patterns, load_export_cfg, cfg_path_from_
|
||||
matches_any, csv_quote, safe_float, safe_int)
|
||||
from merkmalstamm import lade_merkmalstamm, bezeichnung_fuer
|
||||
import sivas_mapping
|
||||
from export_neighbors import load_lisp_kreisel_weichen
|
||||
|
||||
BLOCKPATTERNS = load_patterns()
|
||||
|
||||
@@ -297,6 +298,7 @@ def build_variofoerderer_details(block):
|
||||
SIVAS_MAPPING_KREISEL = sivas_mapping.load_section_mapping("kreisel")
|
||||
SIVAS_MAPPING_ECKRAD = sivas_mapping.load_section_mapping("eckrad")
|
||||
SIVAS_MAPPING_GERUEST = sivas_mapping.load_section_mapping("geruest")
|
||||
SIVAS_MAPPING_WEICHEN = sivas_mapping.load_section_mapping("weichen")
|
||||
|
||||
|
||||
def build_kreisel_details(block):
|
||||
@@ -414,7 +416,9 @@ ILS_SIVASNR = {
|
||||
}
|
||||
|
||||
|
||||
def process_blocks(blocks):
|
||||
def process_blocks(blocks, anzahl_weichen_ils=0):
|
||||
# anzahl_weichen_ils = Anzahl Kreisel-Beruehrpunkte aus dem LISP-Export
|
||||
# (kreisel_weichen.json, siehe main) -> Merkmal 4403 der Automation-Zeile.
|
||||
"""
|
||||
Verarbeitet alle Bloecke.
|
||||
|
||||
@@ -448,7 +452,7 @@ def process_blocks(blocks):
|
||||
"sep_kreisel_ohne_pin": 0,
|
||||
"anzahl_verbindungskreisel": 0,
|
||||
"laengen_kreisel": 0.0,
|
||||
"anzahl_weichen_ils": 0,
|
||||
"anzahl_weichen_ils": anzahl_weichen_ils,
|
||||
"anzahl_eckraeder": 0,
|
||||
"anzahl_gefaellestrecken": 0,
|
||||
"anzahl_variofoerderer": 0,
|
||||
@@ -826,6 +830,30 @@ def process_blocks(blocks):
|
||||
})
|
||||
nr += 1
|
||||
|
||||
# ILS 2.0 Weiche (6216): EINE Summenzeile fuer alle Kreisel-Beruehrpunkte
|
||||
# (kreisel_weichen.json des LISP-Exports, Anzahl = anzahl_weichen_ils).
|
||||
# Ein Beruehrpunkt = eine Weichenkombination aus 1x aktiv (3371) + 1x
|
||||
# passiv (3372); die Zuordnung Merkmal -> Wert steht in sivas.cfg
|
||||
# [weichen], beide lesen ANZAHL_WEICHEN. Anzahl-Spalte 1 wie bei der
|
||||
# Automation-Zeile - die Gesamtanzahlen stecken in den Merkmalen.
|
||||
if counters["anzahl_weichen_ils"] > 0:
|
||||
weiche_sivasnr, weiche_teileart = ILS_SIVASNR["ils_weiche"]
|
||||
items.append({
|
||||
"nr": nr,
|
||||
"teileart": weiche_teileart,
|
||||
"sivasnr": weiche_sivasnr,
|
||||
"sivasnr_quoted": True,
|
||||
"bezeichnung": "",
|
||||
"dispgruppe": 20,
|
||||
"anzahl": 1,
|
||||
"laenge_mm": "",
|
||||
"details": sivas_mapping.anwenden(
|
||||
SIVAS_MAPPING_WEICHEN,
|
||||
{"ANZAHL_WEICHEN": str(counters["anzahl_weichen_ils"])},
|
||||
TRANSFORMS),
|
||||
})
|
||||
nr += 1
|
||||
|
||||
# ILS Automation Summierungszeile (nur wenn ILS-Elemente vorhanden)
|
||||
has_ils = (counters["anzahl_kreisel"] > 0
|
||||
or counters["anzahl_eckraeder"] > 0
|
||||
@@ -986,7 +1014,14 @@ def main():
|
||||
blocks = load_json(raw_json_path)
|
||||
print(f"[export_sivas] {len(blocks)} Bloecke geladen.")
|
||||
|
||||
items, _ = process_blocks(blocks)
|
||||
# Kreisel-Beruehrpunkte (= ILS-Weichen) zaehlt der LISP-Export
|
||||
# (kreisel_weichen.json neben der Raw-Datei); fehlt sie, bleibt 4403 = 0.
|
||||
lisp_weichen = load_lisp_kreisel_weichen(raw_json_path)
|
||||
anzahl_weichen = len(lisp_weichen["beruehrungen"]) if lisp_weichen else 0
|
||||
if lisp_weichen is not None:
|
||||
print(f"[export_sivas] Kreisel-Weichen aus LISP: {anzahl_weichen}")
|
||||
|
||||
items, _ = process_blocks(blocks, anzahl_weichen_ils=anzahl_weichen)
|
||||
|
||||
header = "Nr;TeileArt;SivasNummer;Bezeichnung;Dispogruppe;Anzahl;Laenge[mm];IDs;details"
|
||||
with open(output_csv, "w", encoding="utf-8") as f:
|
||||
|
||||
Reference in New Issue
Block a user