fix(view): pick the solplate table's header by its row (L, W, T, T1, T2), not by the first "S(%)" label

The drawing has two "S(%)" labels; the first one in the file belonged to another table, so the solplate header was missing.
The header is now the S(%) label with the most solplate column names on its row. The full 운곡교 교각도(2) DXF reads all ten
solplate rows; a test adds a stray label.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
ypshimandClaude Haiku 5.5 committed 2026-10-23 14:58:12 +09:00
1 parent 22fd1dc5f4
commit a6b92ae341
2 files changed
+13 -2

No files matched your search

+7 -2
View File
@@ -118,8 +118,13 @@ export interface SolplateTableRow {
* their headers, as in the bearing ELEVATION table.
*/
export function parseSolplateTable(texts: DxfText[]): { rows: SolplateTableRow[]; errors: string[] } {
const sHeader = texts.find((t) => norm(t.text) === 's(%)' || norm(t.text) === 's%');
if (!sHeader) return { rows: [], errors: ['솔플레이트 TABLE의 S(%) 머리글을 찾지 못했습니다.'] };
// The drawing has more than one "S(%)" label: the header is the one with L, W, T, T1 and T2 on its row.
const SOL_NAMES = ['l', 'w', 't', 't1', 't2'];
const solScore = (t: DxfText) => texts.filter((u) => Math.abs(u.y - t.y) <= 60 && SOL_NAMES.includes(norm(u.text))).length;
const sCandidates = texts.filter((t) => norm(t.text) === 's(%)' || norm(t.text) === 's%');
const sBest = sCandidates.map((t) => ({ t, score: solScore(t) })).sort((a, b) => b.score - a.score)[0];
if (!sBest || sBest.score < 5) return { rows: [], errors: ['솔플레이트 TABLE의 머리글(NO, L, W, T, T1, T2)이 모두 있어야 합니다.'] };
const sHeader = sBest.t;
const headerY = sHeader.y;
const headerRow = texts.filter((t) => Math.abs(t.y - headerY) <= 60);
const key = (name: string) => headerRow.find((t) => norm(t.text) === name);