import {useEffect, useState} from 'react'; import {getFacts} from './api.ts'; import {boundaryRows, factRows} from './facts-view.ts'; import type {FactRow, SegmentFacts} from './facts-view.ts'; // 接入-9:证明器看到的(每路录像对主体、门洞、房间边界的可见量,过门、进出房间),审剧本时对照用 export function FactsPanel({segmentId, onSeek}: {segmentId: string; onSeek: (time: number) => void}) { const [view, setView] = useState(), [facts, setFacts] = useState(null), [error, setError] = useState(''); useEffect(() => { const c = new AbortController(); setError(''); getFacts(segmentId, view, c.signal).then(setFacts, e => {if (!c.signal.aborted) {setFacts(null); setError(String(e?.message || e));}}); return () => c.abort(); }, [segmentId, view]); if (error) return

读不到证明器事实:{error}

; if (!facts) return

正在读证明器事实…

; const th = facts.thresholds, at = (t: number | null) => t == null ? '没有' : `${t.toFixed(1)} s`; const strip = (cells: (boolean | number)[]) => {cells.map((x, i) => onSeek(facts.t_s[i])}/>)}; const table = (caption: string, rows: FactRow[]) => {rows.map(r => )}
{caption}
id过门槛约首次时间条
{r.id}{r.seconds.toFixed(1)} s{at(r.first_s)}{strip(r.cells)}
; return
{facts.videos.map(v => )}

录像 {facts.view.video} · {facts.view.frame_count} 帧 · 每格 {(1 / facts.hz).toFixed(1)} s。门槛(方法卡):投影高至少 {th.min_projected_height}、遮挡至多 {th.max_occlusion_fraction}

每格取格内最清楚的一刻,高和遮挡可能不在同一帧,所以过门槛的秒数是上界;判题以证明器为准。点时间条跳到那一刻。 {table('主体', factRows(facts.entities, facts))} {table('门洞', factRows(facts.doorways, facts))} {boundaryRows(facts.room_boundary_visible_m, facts).map(r => )}
房间边界(看见的米数)
房间最多首次时间条
{r.id}{r.max_m.toFixed(1)} m{at(r.first_s)}{strip(r.cells)}
过门 {facts.events.door.length} 次 · 进出房间 {facts.events.room.length} 次
    {[...facts.events.door.map(e => ({t: e.t_s, text: `${e.actor} 过 ${e.door}(到 ${e.side} 侧)`})), ...facts.events.room.map(e => ({t: e.t_s, text: `${e.actor} ${e.kind} ${e.room}`}))].sort((a, b) => a.t - b.t).map((e, i) =>
  • {e.text}
  • )}
; }