Files
Aislo/B07_DesignDetail/openwebcad/src/commands/commands.annotate.ts
T
eomsangdonandClaude Opus 5 ea5ce92725 feat(B07): 표를 객체로 만들어 도면의 표가 진짜 표가 되게 한다
표가 DXF의 표로 나가야 한다(사용자 확정). 지금까지 도면의 표는 선과 문자 뭉치라
내보낼 때 고를 수 있는 길이 하나뿐이었다.

- TableEntity: 열별 폭·행별 높이·칸 문자·병합을 한 객체가 들고 있다. 격자선은 담지
  않고 병합 자리에서 선을 끊는 규칙을 표가 스스로 안다(helpers/table-geometry.ts).
  회전·대칭은 지원하지 않는다 — 표는 축에 붙어 있다.
- 명령: TABLE을 표 객체 생성으로 다시 쓰고 TABLEEDIT(칸 문자)·TABLEROW·TABLECOL·
  TABLEMERGE·TABLEUNMERGE를 더했다. EXPLODE는 표를 선과 문자로 흩는다.
- 그립: 좌측 상단으로 표를 옮기고, 열·행 경계로 폭·높이를 바꾼다.
- 백엔드: 유역 정보표와 횡단 수량 산출표를 표 객체로 낸다. 횡단표는 머리행이 폭
  8등분, 본문이 11열 가중치로 격자가 서로 달라 두 경계를 합친 18열로 만들고 병합으로
  원래 칸을 되살렸다 — 손으로 하던 가로선 끊기가 사라졌다.
- 수량 역추출: 값 Text의 결정적 id로 읽던 것을 칸에 실은 key로 읽도록 옮겼다. 이미
  저장된 도면을 위해 옛 방식을 폴백으로 남겼다.

토적도·종단표는 값이 칸이 아니라 측점 위치에 놓이는 성격이라 이관하지 않았다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-30 15:12:19 +09:00

347 lines
8.1 KiB
TypeScript

/** 주석 탭 명령 (조사표 5절 전 항목) */
import { toast } from 'react-toastify';
import { setActiveRibbonTab } from '../components/ui-state';
import { Tool } from '../tools';
import {
centerLineToolStateMachine,
centerMarkToolStateMachine,
dimAngularToolStateMachine,
dimArcToolStateMachine,
dimDiameterToolStateMachine,
dimOrdinateToolStateMachine,
dimRadiusToolStateMachine,
dimSpaceToolStateMachine,
} from '../tools/annotate/dimension-radial-tools';
import {
dimAlignedToolStateMachine,
dimAutoToolStateMachine,
dimBaselineToolStateMachine,
dimContinueToolStateMachine,
dimLinearToolStateMachine,
qDimToolStateMachine,
} from '../tools/annotate/dimension-tools';
import {
annotationScaleToolStateMachine,
dimStyleToolStateMachine,
mleaderAlignToolStateMachine,
mleaderStyleToolStateMachine,
mleaderToolStateMachine,
revCloudToolStateMachine,
updateDimensions,
} from '../tools/annotate/leader-table-tools';
import {
tableColumnToolStateMachine,
tableEditToolStateMachine,
tableMergeToolStateMachine,
tableRowToolStateMachine,
tableStyleToolStateMachine,
tableToolStateMachine,
tableUnmergeToolStateMachine,
} from '../tools/annotate/table-tools';
import {
findToolStateMachine,
mtextToolStateMachine,
textEditToolStateMachine,
textToolStateMachine,
} from '../tools/annotate/text-tools';
import type { CadCommand } from './command.types';
export const TEXT_COMMANDS: CadCommand[] = [
{
id: 'MTEXT',
label: '여러 줄 문자',
aliases: ['T', 'MT'],
glyph: '¶',
hint: '여러 줄 문자를 작성한다 (줄바꿈은 \\P)',
tool: Tool.MTEXT,
machine: mtextToolStateMachine,
},
{
id: 'TEXT',
label: '단일 행 문자',
aliases: ['DT'],
glyph: 'A',
hint: '한 줄짜리 문자를 작성한다',
tool: Tool.TEXT,
machine: textToolStateMachine,
},
{
id: 'STYLE',
label: '문자 스타일',
aliases: ['ST'],
glyph: '🅰',
hint: '리본 문자 패널에서 글꼴·크기·색을 지정한다',
run: () => {
setActiveRibbonTab('annotate');
toast.info('주석 탭 문자 패널에서 글꼴과 크기를 지정하십시오.');
return '문자 스타일';
},
},
{
id: 'TEXTEDIT',
label: '문자 편집',
aliases: ['TEDIT'],
glyph: '✎',
hint: '기존 문자의 내용을 고친다',
tool: Tool.TEXTEDIT,
machine: textEditToolStateMachine,
},
{
id: 'FIND',
label: '찾기·대치',
glyph: '🔍',
hint: '도면 문자를 찾고 바꾼다',
tool: Tool.FIND,
machine: findToolStateMachine,
},
];
export const DIMENSION_COMMANDS: CadCommand[] = [
{
id: 'DIM',
label: '치수',
glyph: '⟺',
hint: '선택 객체에 맞는 치수를 자동으로 넣는다',
tool: Tool.DIM,
machine: dimAutoToolStateMachine,
},
{
id: 'DIMLINEAR',
label: '선형 치수',
aliases: ['DLI'],
glyph: '↔',
hint: '수평 또는 수직 거리를 기입한다',
tool: Tool.DIMLINEAR,
machine: dimLinearToolStateMachine,
},
{
id: 'DIMALIGNED',
label: '정렬 치수',
aliases: ['DAL'],
glyph: '⤢',
hint: '두 점과 평행한 실제 길이를 기입한다',
tool: Tool.DIMALIGNED,
machine: dimAlignedToolStateMachine,
},
{
id: 'DIMANGULAR',
label: '각도 치수',
aliases: ['DAN'],
glyph: '∠',
hint: '세 점이 이루는 각도를 기입한다',
tool: Tool.DIMANGULAR,
machine: dimAngularToolStateMachine,
},
{
id: 'DIMARC',
label: '호 길이 치수',
aliases: ['DAR'],
glyph: '⌒',
hint: '호의 곡선 길이를 기입한다',
tool: Tool.DIMARC,
machine: dimArcToolStateMachine,
},
{
id: 'DIMRADIUS',
label: '반지름 치수',
aliases: ['DRA'],
glyph: 'R',
hint: '원·호의 반지름을 기입한다',
tool: Tool.DIMRADIUS,
machine: dimRadiusToolStateMachine,
},
{
id: 'DIMDIAMETER',
label: '지름 치수',
aliases: ['DDI'],
glyph: 'Ø',
hint: '원·호의 지름을 기입한다',
tool: Tool.DIMDIAMETER,
machine: dimDiameterToolStateMachine,
},
{
id: 'DIMORDINATE',
label: '세로좌표 치수',
aliases: ['DOR'],
glyph: '⌐',
hint: '기준 원점에 대한 X 또는 Y 좌표를 기입한다',
tool: Tool.DIMORDINATE,
machine: dimOrdinateToolStateMachine,
},
{
id: 'DIMBASELINE',
label: '기준선 치수',
aliases: ['DBA'],
glyph: '⊞',
hint: '직전 치수의 시작점을 기준으로 이어 기입한다',
tool: Tool.DIMBASELINE,
machine: dimBaselineToolStateMachine,
},
{
id: 'DIMCONTINUE',
label: '연속 치수',
aliases: ['DCO'],
glyph: '⋯',
hint: '직전 치수의 끝점에서 이어 기입한다',
tool: Tool.DIMCONTINUE,
machine: dimContinueToolStateMachine,
},
{
id: 'QDIM',
label: '빠른 치수',
glyph: '⚡',
hint: '선택 객체에 치수를 한 번에 넣는다',
tool: Tool.QDIM,
machine: qDimToolStateMachine,
},
{
id: 'CENTERMARK',
label: '중심 표식',
glyph: '✛',
hint: '원·호 중심에 표식을 넣는다',
tool: Tool.CENTERMARK,
machine: centerMarkToolStateMachine,
},
{
id: 'CENTERLINE',
label: '중심선',
glyph: '┈',
hint: '두 선 사이에 중심선을 넣는다',
tool: Tool.CENTERLINE,
machine: centerLineToolStateMachine,
},
{
id: 'DIMSTYLE',
label: '치수 스타일',
aliases: ['D'],
glyph: '⚙',
hint: '치수 문자 높이·화살표 크기·소수 자릿수를 정한다',
tool: Tool.DIMSTYLE,
machine: dimStyleToolStateMachine,
},
{
id: 'DIMUPDATE',
label: '치수 업데이트',
glyph: '⟳',
hint: '바꾼 치수 스타일을 기존 치수에 반영한다',
run: updateDimensions,
},
{
id: 'DIMSPACE',
label: '치수 간격',
glyph: '⇕',
hint: '평행한 치수선의 간격을 고르게 맞춘다',
tool: Tool.DIMSPACE,
machine: dimSpaceToolStateMachine,
},
];
export const LEADER_COMMANDS: CadCommand[] = [
{
id: 'MLEADER',
label: '다중 지시선',
aliases: ['MLD'],
glyph: '➤',
hint: '화살표와 문자를 잇는 지시선을 작성한다',
tool: Tool.MLEADER,
machine: mleaderToolStateMachine,
},
{
id: 'MLEADERSTYLE',
label: '지시선 스타일',
aliases: ['MLS'],
glyph: '⚙',
hint: '지시선 문자 높이와 화살표 크기를 정한다',
tool: Tool.MLEADERSTYLE,
machine: mleaderStyleToolStateMachine,
},
{
id: 'MLEADERALIGN',
label: '지시선 정렬',
glyph: '≡',
hint: '선택한 지시선 문자의 위치를 맞춘다',
tool: Tool.MLEADERALIGN,
machine: mleaderAlignToolStateMachine,
},
];
export const TABLE_COMMANDS: CadCommand[] = [
{
id: 'TABLE',
label: '테이블',
aliases: ['TB'],
glyph: '▦',
hint: '행·열 격자를 도면에 배치한다',
tool: Tool.TABLE,
machine: tableToolStateMachine,
},
{
id: 'TABLESTYLE',
label: '테이블 스타일',
aliases: ['TS'],
glyph: '⚙',
hint: '새 표의 기본 열 너비와 행 높이를 정한다',
tool: Tool.TABLESTYLE,
machine: tableStyleToolStateMachine,
},
{
id: 'TABLEEDIT',
label: '칸 편집',
glyph: '✎',
hint: '표의 칸에 문자를 넣는다',
tool: Tool.TABLEEDIT,
machine: tableEditToolStateMachine,
},
{
id: 'TABLEROW',
label: '행 넣기·지우기',
glyph: '⬒',
hint: '표의 행을 넣거나 지운다',
tool: Tool.TABLEROW,
machine: tableRowToolStateMachine,
},
{
id: 'TABLECOL',
label: '열 넣기·지우기',
glyph: '◫',
hint: '표의 열을 넣거나 지운다',
tool: Tool.TABLECOL,
machine: tableColumnToolStateMachine,
},
{
id: 'TABLEMERGE',
label: '칸 병합',
glyph: '⧉',
hint: '표의 여러 칸을 하나로 합친다',
tool: Tool.TABLEMERGE,
machine: tableMergeToolStateMachine,
},
{
id: 'TABLEUNMERGE',
label: '병합 해제',
glyph: '⧅',
hint: '합친 칸을 원래대로 되돌린다',
tool: Tool.TABLEUNMERGE,
machine: tableUnmergeToolStateMachine,
},
];
export const MARKUP_COMMANDS: CadCommand[] = [
{
id: 'REVCLOUD',
label: '구름형 리비전',
glyph: '☁',
hint: '검토 범위를 구름형 선으로 표시한다',
tool: Tool.REVCLOUD,
machine: revCloudToolStateMachine,
},
{
id: 'ANNOSCALE',
label: '주석 축척',
glyph: '⚖',
hint: '치수·문자·화살표 크기에 곱할 축척을 정한다',
tool: Tool.ANNOSCALE,
machine: annotationScaleToolStateMachine,
},
];