44 lines
3.8 KiB
TypeScript
44 lines
3.8 KiB
TypeScript
import type { PierInput } from '../src/core/types';
|
|
import type { PierModel } from '../src/core/geometry';
|
|
|
|
export type Point = [number, number];
|
|
export type Layer = 'STRUCTURE' | 'HIDDEN' | 'CENTER' | 'DIMENSION' | 'TEXT' | 'ELEVATION' | 'BEARING' | 'SECTION' | 'HATCH' | 'FRAME';
|
|
export type ViewId = 'front' | 'side' | 'top' | 'footing' | 'section' | 'detail' | 'schedule' | 'iso' | 'keyplan' | 'heights';
|
|
export type Source = { member: string; index: number; pier: string };
|
|
type Base = { layer: Layer; source: Source;cad?:{layer:string;color:number;linetype:string;lineweight:number;textStyle?:string} };
|
|
export type Entity = Base & (
|
|
{ kind: 'line'; a: Point; b: Point } |
|
|
{ kind: 'polyline'; points: Point[]; closed: boolean } |
|
|
{ kind: 'circle'; center: Point; radius: number } |
|
|
{ kind: 'hatch'; points:Point[]; holes?:Point[][];pattern:'SOLID'|'ANSI31'; spacing:number; angle:number; color?:string } |
|
|
{ kind: 'text'; point: Point; text: string; height: number; align?: 'left' | 'center' | 'right'; rotation?: number } |
|
|
{ kind: 'dimension'; a: Point; b: Point; position: number; axis: 'x' | 'y'; height: number; value: number; label?: string }
|
|
);
|
|
export type Bounds = { minX: number; minY: number; maxX: number; maxY: number };
|
|
export type Rect = { x: number; y: number; width: number; height: number };
|
|
export type ViewBreak = { from:number; to:number; gap:number; member:'column'|'pile' };
|
|
export type DrawingView = { id: ViewId; title: string; entities: Entity[]; geometryBounds: Bounds; bounds: Bounds; scale: number; slot: Rect; breaks?:ViewBreak[];paperOrigin?:Point };
|
|
export type QualityIssue={view:string;kind:'text-text'|'text-structure'|'view-overlap'|'outside';first:number;second?:number;message:string};
|
|
export type DrawingQuality={before:number;after:number;issues:QualityIssue[];occupied:Record<string,Rect>;minimumTextMm:number;layout:string;geometryUnchanged:boolean};
|
|
export type FrameTemplate={version:1;name:string;source:string;sha256:string;width:number;height:number;entities:Entity[];fields:{tag:string;label:string;value:string;point:Point;height:number;rotation:number}[];notes:string};
|
|
export type SheetConfig={template?:FrameTemplate;fields:Record<string,string>;notes:string;references:string;noteHeight:number;showFrame:boolean;showLogo:boolean;startLabel:string;endLabel:string};
|
|
export type DrawingSettings = { paper: 'A3' | 'A2' | 'A1'; scale: number | 'auto'; dimensions: boolean; centers: boolean; elevations: boolean; shorten?:boolean; detailBearing?:string;hatches?:boolean;isoDirection?:number;sheet?:SheetConfig };
|
|
export type DrawingDocument = { project: string; bridge: string; pier: string; units: 'mm'; views: DrawingView[]; paper: { name: string; width: number; height: number }; warnings: string[]; notes: string[]; settings: DrawingSettings;quality?:DrawingQuality;dwgValidation?:Record<string,unknown> };
|
|
export type DrawingSnapshot = {
|
|
project: { name: string; bridge: string; crs: string };
|
|
selected: string | null;
|
|
piers: { input: PierInput; model: PierModel | null; dirty: boolean }[];
|
|
};
|
|
export const LAYERS: Record<Layer, { title: string; color: string; weight: number; dash?: string }> = {
|
|
FRAME: { title:'도곽·노트',color:'#26333d',weight:.18 },
|
|
HATCH: { title:'콘크리트 해치',color:'#aeb9c2',weight:.09 },
|
|
STRUCTURE: { title: '구조 외형', color: '#18212b', weight: .35 },
|
|
HIDDEN: { title: '숨은 형상선', color: '#7c8792', weight: .13, dash: '2,1' },
|
|
CENTER: { title: '중심선', color: '#456e9a', weight: .13, dash: '5,1,1,1' },
|
|
DIMENSION: { title: '치수', color: '#1b506d', weight: .15 },
|
|
TEXT: { title: '문자', color: '#233747', weight: .15 },
|
|
ELEVATION: { title: '표고 EL', color: '#286c65', weight: .15 },
|
|
BEARING: { title: '받침·블럭', color: '#2d546d', weight: .25 },
|
|
SECTION: { title: '단면 표시', color: '#8e4e52', weight: .18 },
|
|
};
|