fix(view): find the table's header and No column by their place on the table row, not by the first label in the file

The drawing has other "EL.X" and "NO" labels. The header is now the EL.X label with the most table column names to its right
on the same row; the No header is the NO label on that row. The full 운곡교 교각도(2) DXF reads all ten bearings (EL.X, h1, h2)
without errors. Tests add the distractor labels.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
ypshimandClaude Haiku 5.5 committed 2026-10-23 14:36:50 +09:00
1 parent 4048c326e3
commit 55abc4be13
2 files changed
+24 -3

No files matched your search

+13
View File
@@ -22,6 +22,19 @@ describe('도면 받침 ELEVATION TABLE 읽기 (DXF 텍스트, 승인 2026-10-23
}
});
it('a leader-line "EL. X" label placed before the table does not replace the table header', () => {
const distractor = { x: 11102.8, y: 11521.7, text: 'EL. "X"' };
const r = parseBearingElevationTable([distractor, ...texts]);
expect(r.errors).toEqual([]);
expect(r.drawing.map((d) => d.no)).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
});
it('a stray "NO" label elsewhere on the drawing does not move the No column', () => {
const r = parseBearingElevationTable([{ x: 100, y: 100, text: 'NO.' }, ...texts]);
expect(r.errors).toEqual([]);
expect(r.drawing.map((d) => d.no)).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
});
it('reads TEXT entities from DXF text (x, y, string)', () => {
const dxf = ['0', 'SECTION', '2', 'ENTITIES', '0', 'TEXT', '10', '100.5', '20', '200.25', '1', 'EL. "X"', '0', 'ENDSEC'].join('\n');
expect(readDxfTexts(dxf)).toEqual([{ x: 100.5, y: 200.25, text: 'EL. "X"' }]);