Merge gemacht. Versuch eines Tests der lisp Routinen erstellt
This commit is contained in:
+36
-15
@@ -104,21 +104,33 @@ def build_gerade_merkmale(block):
|
||||
|
||||
|
||||
def build_kreisel_merkmale(block):
|
||||
"""Merkmale-JSON fuer einen ILS Kreisel."""
|
||||
"""Merkmale-JSON fuer einen ILS Kreisel (liest Attribute aus Block)."""
|
||||
attribs = block.get("attribs", {})
|
||||
abstand_mm = attribs.get("ABSTAND", "2300")
|
||||
try:
|
||||
abstand_m = str(round(float(abstand_mm) / 1000.0, 2))
|
||||
except (ValueError, TypeError):
|
||||
abstand_m = "2.3"
|
||||
hoehe_mm = attribs.get("HOEHE", "0")
|
||||
try:
|
||||
hoehe_m = str(round(float(hoehe_mm) / 1000.0, 2))
|
||||
except (ValueError, TypeError):
|
||||
hoehe_m = "0"
|
||||
return {
|
||||
"Abstand (Kreiselachse A - Kreiselachse) in Meter": "3",
|
||||
"Anzahl der Separatoren": "2",
|
||||
"Kreiselart": "Standard",
|
||||
"Anzahl der Scanner": "0",
|
||||
"Anzahl der Rampen": "0",
|
||||
"Höhe in m": "2",
|
||||
"Drehrichtung": "UZS",
|
||||
"Drehung": block.get("rotation", 0.0)
|
||||
"Abstand (Kreiselachse A - Kreiselachse) in Meter": abstand_m,
|
||||
"Anzahl der Separatoren": attribs.get("N_SEPARATOREN", "2"),
|
||||
"Kreiselart": attribs.get("KREISELART", "STANDARD"),
|
||||
"Anzahl der Scanner": attribs.get("N_SCANNER", "0"),
|
||||
"Anzahl der Rampen": attribs.get("N_RAMPEN", "0"),
|
||||
"Höhe in m": hoehe_m,
|
||||
"Drehrichtung": attribs.get("DREHRICHTUNG", "UZS"),
|
||||
"Drehung": block.get("rotation", 0.0),
|
||||
"Name": attribs.get("NAME", ""),
|
||||
}
|
||||
|
||||
|
||||
# --- Bekannte Blocknamen fuer nicht-Omniflo Elemente ---
|
||||
KREISEL_BLOCKS = {"AN8", "SP8"}
|
||||
## Kreisel-Bloecke werden ueber Praefix "KR_" erkannt (siehe process_blocks)
|
||||
|
||||
VARIO_BLOCKS = {
|
||||
"AUS_Element_links", "EIN_Element_links",
|
||||
@@ -243,8 +255,8 @@ def process_blocks(blocks, lookup):
|
||||
counters["gesamtlaenge_ap110"] += 2000.0
|
||||
continue
|
||||
|
||||
# ILS Kreisel
|
||||
if bname in KREISEL_BLOCKS:
|
||||
# ILS Kreisel (Compound-Bloecke mit Praefix KR_)
|
||||
if bname.startswith("KR_"):
|
||||
elem_nr += 1
|
||||
kreisel_count += 1
|
||||
items.append({
|
||||
@@ -255,10 +267,19 @@ def process_blocks(blocks, lookup):
|
||||
"anzahl": 1,
|
||||
"merkmale": build_kreisel_merkmale(block)
|
||||
})
|
||||
attribs = block.get("attribs", {})
|
||||
counters["anzahl_kreisel"] += 1
|
||||
counters["sep_kreisel_ohne_pin"] += 2
|
||||
counters["laengen_kreisel"] += 3.0
|
||||
counters["anzahl_separatoren"] += 2
|
||||
n_sep = int(attribs.get("N_SEPARATOREN", "2") or "2")
|
||||
kreiselart = attribs.get("KREISELART", "STANDARD")
|
||||
if kreiselart == "PIN":
|
||||
counters["anzahl_kreisel_pinband"] += 1
|
||||
counters["sep_kreisel_pin"] += n_sep
|
||||
else:
|
||||
counters["sep_kreisel_ohne_pin"] += n_sep
|
||||
abstand_mm = float(attribs.get("ABSTAND", "2300") or "2300")
|
||||
counters["laengen_kreisel"] += abstand_mm / 1000.0
|
||||
counters["anzahl_separatoren"] += n_sep
|
||||
counters["anzahl_scanner"] += int(attribs.get("N_SCANNER", "0") or "0")
|
||||
if counters["anzahl_streckengruppen"] == 0:
|
||||
counters["anzahl_streckengruppen"] = 1
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user