fix: align known-depth UDWHAZ EXPSOU semantics

This commit is contained in:
OpenAI Codex
2026-09-21 06:49:45 +08:00
parent 89653ea4dd
commit e1e3a9e00c
2 changed files with 3 additions and 2 deletions

View File

@@ -448,7 +448,8 @@ def resolve_udwhaz03_instruction(
associated_depth_ranges: list[dict[str, Any]] | None = None, associated_depth_ranges: list[dict[str, Any]] | None = None,
) -> tuple[str, dict[str, Any]]: ) -> tuple[str, dict[str, Any]]:
danger = False danger = False
expsou = _int_attr(attrs, "EXPSOU", 0) # Fixed OpenCPN reads EXPSOU only when the derived depth is UNKNOWN.
expsou = _int_attr(attrs, "EXPSOU", 0) if depth_value is None else 0
if depth_value is None and expsou != 1: if depth_value is None and expsou != 1:
danger = True danger = True
if not danger and ( if not danger and (

View File

@@ -44,7 +44,7 @@ class LightLabelState{
this.lastDescription=description;return {emit:Boolean(description),yoff:1}; this.lastDescription=description;return {emit:Boolean(description),yoff:1};
} }
} }
function hazardIsolated(props,settings){const depth=numberValue(props,"s52_hazard_depth_m",null),expsou=numberValue(props,"s52_expsou_code",0);let danger=depth===null&&expsou!==1;if(!danger&&(expsou===1||(depth!==null&&depth<=settings.safetyContourM))){const surrounding=numberValue(props,"s52_surrounding_max_drval1_m",null);if(surrounding!==null&&surrounding>=settings.safetyContourM&&expsou!==1)danger=true;}return danger;} function hazardIsolated(props,settings){const depth=numberValue(props,"s52_hazard_depth_m",null),expsou=depth===null?numberValue(props,"s52_expsou_code",0):0;let danger=depth===null&&expsou!==1;if(!danger&&(expsou===1||(depth!==null&&depth<=settings.safetyContourM))){const surrounding=numberValue(props,"s52_surrounding_max_drval1_m",null);if(surrounding!==null&&surrounding>=settings.safetyContourM&&expsou!==1)danger=true;}return danger;}
function hazardRules(props,settings){ function hazardRules(props,settings){
const csp=String(props.s52_runtime_csp||""),geom=String(props.s52_source_geometry||"POINT").toUpperCase(),objectClass=String(props.s52_source_object_class||""); const csp=String(props.s52_runtime_csp||""),geom=String(props.s52_source_geometry||"POINT").toUpperCase(),objectClass=String(props.s52_source_object_class||"");
const watlev=numberValue(props,"s52_watlev_code",-9),quapos=numberValue(props,"s52_quapos_code",0),valsouPresent=numberValue(props,"s52_valsou_present",0)===1,valsou=valsouPresent?numberValue(props,"s52_valsou_m",null):null,quasou7=listValue(props.s52_quasou_codes).includes(7); const watlev=numberValue(props,"s52_watlev_code",-9),quapos=numberValue(props,"s52_quapos_code",0),valsouPresent=numberValue(props,"s52_valsou_present",0)===1,valsou=valsouPresent?numberValue(props,"s52_valsou_m",null):null,quasou7=listValue(props.s52_quasou_codes).includes(7);