Ebenen Regio und S-Bahn getrennt; Lade-Symbol pulsiert bei reduzierter Bewegung

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X48pE4bzjHej8w9HyZXCjb
This commit is contained in:
Claude
2026-10-22 13:35:39 +02:00
parent a7daa76535
commit b5350ae22e
5 changed files with 25 additions and 9 deletions
+11 -1
View File
@@ -84,6 +84,15 @@ def route_mode(route_type: str) -> str | None:
return None
SBAHN = re.compile(r"^(SN? ?\d+[A-Z]?|S)$") # S1, S 5, S41, SN7 (Nacht-S-Bahn), nur "S"
def sbahn(cat: str, line: str) -> bool:
"""S-Bahn: Schweiz über die Kategorie, Deutschland/Belgien über den Liniennamen. Niederländische
Sprinter und französische TER zählen als Regionalzug."""
return cat in ("S", "SN") or bool(SBAHN.match(line))
def long_distance(cat: str, line: str) -> bool:
# Schweiz: Gattung in route_desc; gtfs.de: nur in der Linie ("ICE 75", "IC 3")
m = re.match(r"[A-Za-z]+", cat or line or "")
@@ -180,6 +189,7 @@ class Feed:
for route in self.routes.values():
route["line"] = route["line"] or route["cat"]
route["fv"] = route["mode"] == "rail" and long_distance(route["cat"], route["line"])
route["sb"] = route["mode"] == "rail" and not route["fv"] and sbahn(route["cat"], route["line"])
# Haltezeiten flach in Arrays; off[i]..off[i+1] sind die Halte von Fahrt i
n = len(self.trip_route)
@@ -407,7 +417,7 @@ class Feed:
"type": "Feature",
"geometry": {"type": "Point", "coordinates": [lon, lat]},
"properties": {
"id": f"{dstr}/{ti}", "line": route["line"], "cat": route["cat"], "fv": route["fv"], "mode": route["mode"],
"id": f"{dstr}/{ti}", "line": route["line"], "cat": route["cat"], "fv": route["fv"], "sb": route["sb"], "mode": route["mode"],
"nr": self.trip_number[ti], "from": self.stop_name[self.st_stop[o]], "to": self.trip_headsign[ti],
"delay": delay if r else None, "next": self.stop_name[self.st_stop[o + i]],
"heading": heading,