fix: align raster LIGHTS05 rendering

This commit is contained in:
OpenAI Codex
2026-09-17 21:49:33 +08:00
parent 690beeb561
commit f238f1c471

View File

@@ -238,6 +238,11 @@ def _scan_pbf_usage(path: Path) -> dict[str, Any]:
if "s52_symbol_code" in props: if "s52_symbol_code" in props:
if props.get("s52_sounding_symbol_sequence"): if props.get("s52_sounding_symbol_sequence"):
render_kind_counts["RUNTIME_SOUNDG"][placement] += 1 render_kind_counts["RUNTIME_SOUNDG"][placement] += 1
elif props.get("s52_light_symbol_code") == props.get("s52_symbol_code"):
# LIGHTS05 materialization may intentionally mirror the flare into
# s52_symbol_code. Count/render that pure LIGHTS symbol only once
# through LIGHT_SY; beacon/tower body symbols remain separate.
pass
else: else:
render_kind_counts["SY"][placement] += 1 render_kind_counts["SY"][placement] += 1
if "s52_light_symbol_code" in props: if "s52_light_symbol_code" in props:
@@ -573,13 +578,28 @@ def _compile_style(
"type": "symbol", "type": "symbol",
"source": source_id, "source": source_id,
"source-layer": layer_name, "source-layer": layer_name,
"filter": _base_filter( "filter": [
priority=priority, "all",
categories=categories, *_base_filter(
required_field="s52_symbol_code", priority=priority,
supported_values=symbol_names, categories=categories,
forbidden_field="s52_sounding_symbol_sequence", required_field="s52_symbol_code",
), supported_values=symbol_names,
forbidden_field="s52_sounding_symbol_sequence",
)[1:],
[
"!",
[
"all",
["has", "s52_light_symbol_code"],
[
"==",
["get", "s52_symbol_code"],
["get", "s52_light_symbol_code"],
],
],
],
],
"layout": { "layout": {
"icon-image": ["get", "s52_symbol_code"], "icon-image": ["get", "s52_symbol_code"],
"icon-anchor": "center", "icon-anchor": "center",
@@ -619,10 +639,10 @@ def _compile_style(
"s52_light_symbol_code", light_symbol_offsets "s52_light_symbol_code", light_symbol_offsets
), ),
"icon-size": 1, "icon-size": 1,
"icon-rotate": [ # OpenCPN's raster sprite already contains the final flare
"to-number", ["get", "s52_light_rotation_deg"], 0 # orientation. s52_light_rotation_deg is retained in the
], # PBF contract for vector/runtime backends, but applying it
"icon-rotation-alignment": "map", # again here rotates the raster flare a second time.
"icon-allow-overlap": True, "icon-allow-overlap": True,
"icon-ignore-placement": True, "icon-ignore-placement": True,
}, },