- A 일체 pair's inner sides face the other bearing, so they are not C4 or C5: they are null and shown as "—" in the 배치 규칙 table. - The table headings now describe the 교축 margins (bearing to the outer block edge). Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
69 lines
4.0 KiB
TypeScript
69 lines
4.0 KiB
TypeScript
import type { PierModel } from '../core/geometry';
|
||
import { bearingEdgeDistances, pairEccentricities } from '../core/bearing-layout';
|
||
|
||
/** Drawing values (A, B of the solplate, mm) of the front and back bearings, to overlay on the model (승인 2026-10-26). */
|
||
export interface BearingPlanOverlay {
|
||
front: { A: number; B: number };
|
||
back: { A: number; B: number };
|
||
}
|
||
|
||
/** Number of pairs the 상세 보기 chips can show (①–⑩ in the mockup). */
|
||
export const PAIR_CHIP_LABELS = ['①', '②', '③', '④', '⑤', '⑥', '⑦', '⑧', '⑨', '⑩'];
|
||
|
||
/**
|
||
* 교량받침 상세 · 평면 for one pair (승인 2026-10-26): the model's solplates and blocks, with the drawing values overlaid
|
||
* as dashed outlines when given. 일체 draws the pair's block as one outline (2500 across the 교축 × 1200 along the 교각축);
|
||
* 분리 draws two 1200 × 1200 outlines. x is the 교축 (n), y the 교각축 (s, downward); units mm.
|
||
*/
|
||
export function bearingPlanSvg(m: PierModel, pairIndex: number, overlay?: BearingPlanOverlay): string {
|
||
const pair = pairEccentricities(m.blocks)[pairIndex];
|
||
if (!pair) return '';
|
||
const f = m.blocks.find((b) => b.no === pair.frontNo && b.row === '전열')!;
|
||
const k = m.blocks.find((b) => b.no === pair.backNo && b.row === '후열')!;
|
||
const nc = (f.n + k.n) / 2;
|
||
const sc = (f.s + k.s) / 2;
|
||
const X = (n: number) => (n - nc) * 1000;
|
||
const Y = (s: number) => (s - sc) * 1000;
|
||
const parts: string[] = [];
|
||
|
||
// Block outline(s): 일체 = one 2500 × 1200 outline; 분리 = two 1200 × 1200 outlines.
|
||
const ib = m.integratedBlocks.find((x) => x.frontNo === pair.frontNo);
|
||
if (ib) {
|
||
parts.push(`<rect x="${X(ib.n - 1.25)}" y="${Y(ib.s - 0.6)}" width="2500" height="1200" fill="none" stroke="#6E8496" stroke-width="12"></rect>`);
|
||
parts.push(`<text x="${X(ib.n)}" y="${Y(ib.s - 0.6) - 60}" text-anchor="middle" font-size="90" fill="#55606E">C3 2500 (일체 블록 윤곽)</text>`);
|
||
} else {
|
||
for (const b of [f, k]) {
|
||
parts.push(`<rect x="${X(b.n) - 600}" y="${Y(b.s) - 600}" width="1200" height="1200" fill="none" stroke="#6E8496" stroke-width="12"></rect>`);
|
||
}
|
||
}
|
||
|
||
// Solplates: the model's plan (A across the 교축, B along the 교각축), centred on each bearing.
|
||
for (const b of [f, k]) {
|
||
if (b.plan) {
|
||
const { A, B } = b.plan;
|
||
parts.push(`<rect x="${X(b.n) - A / 2}" y="${Y(b.s) - B / 2}" width="${A}" height="${B}" fill="#EEF3F7" stroke="#2F6DB5" stroke-width="10"></rect>`);
|
||
}
|
||
}
|
||
// Drawing values overlaid (dashed red) on the same bearings (#1 겹쳐 보이게).
|
||
if (overlay) {
|
||
for (const [b, v] of [[f, overlay.front], [k, overlay.back]] as const) {
|
||
parts.push(`<rect x="${X(b.n) - v.A / 2}" y="${Y(b.s) - v.B / 2}" width="${v.A}" height="${v.B}" fill="none" stroke="#B4531F" stroke-width="10" stroke-dasharray="40 25"></rect>`);
|
||
}
|
||
}
|
||
|
||
// Bearing centres and labels.
|
||
for (const b of [f, k]) {
|
||
parts.push(`<circle cx="${X(b.n)}" cy="${Y(b.s)}" r="40" fill="#18212B"></circle>`);
|
||
parts.push(`<text x="${X(b.n) + 70}" y="${Y(b.s) - 60}" font-size="90" fill="#18212B">${b.no}</text>`);
|
||
}
|
||
|
||
// Dimensions: C2 between the bearing centres, C4 and C5 from the bearing to the block edges (교축).
|
||
const dist = bearingEdgeDistances(m);
|
||
const d = (no: number) => dist.find((x) => x.no === no)!;
|
||
parts.push(`<text x="${(X(f.n) + X(k.n)) / 2}" y="${Y(f.s) + 180}" text-anchor="middle" font-size="90" fill="#18212B">C2 ${Math.round(Math.abs(k.n - f.n) * 1000)}</text>`);
|
||
parts.push(`<text x="${X(f.n) - 760}" y="${Y(f.s)}" text-anchor="end" font-size="90" fill="#18212B">C4 ${Math.round(d(f.no).leftMm ?? 0)}</text>`);
|
||
parts.push(`<text x="${X(k.n) + 760}" y="${Y(k.s)}" font-size="90" fill="#18212B">C5 ${Math.round(d(k.no).rightMm ?? 0)}</text>`);
|
||
|
||
return `<svg viewBox="-1800 -1000 3600 2000" width="100%" style="max-width: 560px; height: auto" role="img" aria-label="교량받침 상세 평면: 쌍 ${pair.frontNo}·${pair.backNo}, 블록 윤곽, 솔플레이트, 도면값 겹쳐 보기">${parts.join('')}</svg>`;
|
||
}
|