- 그림 신원표 = 새 common_util_pick_tag(tagShape · pipeTagId) — 관 id 는 화면이 열 때(usePipeIds) 세션 장부를 꽂음 · 안 꽂으면 옛 자리 이름(장부가 프로젝트 모를 때와 같은 값) - 구조물 그림 다섯(Box · Culvert · Ford · Ford_Pavement · Revetment)이 design_pipe_ids · design_pick_match 대신 이것을 씀 - Culvert_Wire 한계 토스트 = 알림 창구(setCulvertNotice) — 화면 Cross_View 가 토스트를 꽂음 · Wire 가 ui_template · Section_Common 안 끔 - 472-3 알려진 끌림 다섯 걷음(b_page_state · pick_match · pipe_ids · selection · Section_Common) · 남은 줄 = 헬퍼 정규식 헛잡음 - 헬퍼 286_1 흉내 → 진짜 pick_tag · 폴더 지침 끌림 줄 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
48 lines
2.6 KiB
TypeScript
48 lines
2.6 KiB
TypeScript
/* =============================================================================
|
|
* A00_Common/design/design_pick_match.ts
|
|
* 고름 강조 한 규칙(323-5) — 그린 것(카드 형상 · 3D 부재 · 알약 · 측점선)마다 신원표 `{구조물 id · 부분 · 자리}`
|
|
* 를 달고, 고름 한 칸(`structure-pick`)과 이 함수 하나로 켜짐을 가름.
|
|
*
|
|
* ① 고름 · 그림 둘 다 구조물 id 가 있으면 id 가 같아야(관 = 세션 id `design_pipe_ids` · 옮겨도 그대로)
|
|
* ② 아니면 같은 자리(`PIPE_MATCH_M` — 같은 자리 거리는 이 한 값)
|
|
* ③ 고른 부분(부재키)이 있으면 그 부분만 · 부분을 안 골랐으면 그 구조물 그림 모두
|
|
* DOM 은 `data-structure-id` · `data-part`(`common_util_pick_tag.tagShape`) — 부분 그림(관 · 벽 · 날개벽 · 물넘이 콘크리트)은
|
|
* 조정창 손잡이가 같은 고름으로 칠함(`paintPicked` 는 부분 없는 형상만 · 307 「측점 길은 부분 안 켬」).
|
|
* ========================================================================== */
|
|
|
|
import { isNear, type DesignSelection } from "./design_selection";
|
|
|
|
export interface PickTag {
|
|
structureId?: string | null;
|
|
part?: string | null;
|
|
chainageM?: number | null;
|
|
}
|
|
|
|
export type PickSelection =
|
|
(Partial<DesignSelection> & { partKey?: string | null }) | null | undefined;
|
|
|
|
/** 이 그림이 고름에 켜지나 — 위 ① ② ③. */
|
|
export function pickLights(selection: PickSelection, tag: PickTag): boolean {
|
|
if (!selection) return false;
|
|
let here: boolean;
|
|
if (selection.structureId && tag.structureId) here = selection.structureId === tag.structureId;
|
|
else if (selection.chainageM == null || tag.chainageM == null) return false;
|
|
else here = isNear(tag.chainageM, selection.chainageM);
|
|
if (!here) return false;
|
|
return !selection.partKey || tag.part === selection.partKey;
|
|
}
|
|
|
|
/** 카드 안 통째 형상 칠하기 — 고른 구조물 id 와 같은 형상만. 부분 그림(`data-part`) · 관 계열(`pipe-`) ·
|
|
* 노면공 포장층은 제 손잡이(조정창 · 포장층 고름)가 칠함 — 측점 길(알약 · 목록 · 측점선)은 부분을 안 켬(307). */
|
|
export function paintPicked(root: ParentNode, selection: PickSelection): void {
|
|
for (const shape of root.querySelectorAll<SVGElement>("[data-structure-id]")) {
|
|
const id = shape.getAttribute("data-structure-id") ?? "";
|
|
if (id.startsWith("pipe-") || shape.getAttribute("data-part") !== null) continue;
|
|
if (shape.getAttribute("data-pave-type") !== null) continue;
|
|
shape.classList.toggle(
|
|
"is-active",
|
|
!!selection?.structureId && pickLights(selection, { structureId: id }),
|
|
);
|
|
}
|
|
}
|