Add feature registry dispatch

This commit is contained in:
2026-08-03 14:02:28 +08:00
parent dd50d3aae3
commit ff18217af5
12 changed files with 417 additions and 46 deletions

View File

@@ -0,0 +1,20 @@
"""Feature registry and dispatch helpers for scene assembly phases."""
from collections import namedtuple
FeatureHandler = namedtuple("FeatureHandler", ("name", "matches", "handle"))
def dispatch_ways(ways, projector, handlers):
"""Dispatch OSM ways to the first matching handler, preserving order."""
for way in ways:
coords = way["coords"]
if not any(projector.inside(c) for c in coords):
continue
ring = projector.ring(coords)
tag = way["tags"]
for handler in handlers:
if handler.matches(way, tag, ring):
handler.handle(way, tag, ring)
break