공용 파일(main.ts·index.html·style.css)에서 서로 얽혀 있어 한 커밋으로 묶음. - 지반: ① 형상 프로젝트 지반모델 관리창(생성·JSON 불러오기·교각별 비교·선택 적용), 프로젝트 JSON 내장 groundModel 추출, 교대 8행 통합 적용·공통지형 중복격자 제외 - 재료표·수량: 상단 ⑤ 메뉴·배근 바로가기, 결과 교각/탭 기억, 수량 워크북·정합 보정 - 랜딩: 옥성교 6교각 히어로 이미지·투영 강조점·좌→우 광선·지형 라운드/도로 연결 - 검증 스크립트(verify-project-ground/ground-abutments/okseong-user-files/quantity-*/landing-hero 등) 정본: DOC/04_실행/실행_*_2026-11-09_v0.1.00.md Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
56 lines
3.4 KiB
Python
56 lines
3.4 KiB
Python
"""Apply the project ground manager integration to the existing application."""
|
|
from pathlib import Path
|
|
|
|
root = Path(__file__).resolve().parents[1]
|
|
p = root / 'src/main.ts'
|
|
s = p.read_text()
|
|
s = "import { createProjectGroundManager } from './view/project-ground';\nimport { applyProjectGround, groundInputChanged } from './core/project-ground';\nimport { registerGroundImporter } from '../pierzainer_ground/ground-link';\n" + s
|
|
s = s.replace('let groundModel: GroundModelFile | null = null;', 'let groundModel: GroundModelFile | null = null;\nlet groundProjectVersion = 0;\nlet groundImportSerial = 0;')
|
|
marker = 'function el<K extends keyof HTMLElementTagNameMap>'
|
|
insert = '''async function importProjectGround(text: string, name: string): Promise<void> {
|
|
const version = groundProjectVersion, serial = ++groundImportSerial;
|
|
const imported = parseGroundModel(text);
|
|
await Promise.all((imported.mapLayers ?? []).map(decodeGroundMapImage));
|
|
if (version !== groundProjectVersion || serial !== groundImportSerial) throw new Error('프로젝트 또는 불러올 모델이 변경되어 이전 결과를 적용하지 않았습니다.');
|
|
groundModel = imported;
|
|
groundMapMode = imported.mapLayers?.length ? 'satellite' : 'none';
|
|
setGroundMapMode(groundMapMode);
|
|
state.visible.ground = true;
|
|
setupScene(); renderAll();
|
|
setStatus(`${name} 지반모델을 프로젝트 공통으로 불러왔습니다. 설계 입력은 비교 후 적용하세요.`);
|
|
}
|
|
registerGroundImporter(importProjectGround);
|
|
const projectGround = createProjectGroundManager({
|
|
snapshot: () => ({ model: groundModel, piers: state.piers }),
|
|
importModel: importProjectGround,
|
|
apply: (names, fields) => {
|
|
if (!groundModel) return;
|
|
for (const p of state.piers) if (names.has(p.input.name)) p.draft = applyProjectGround(p.draft, groundModel, fields);
|
|
renderAll();
|
|
},
|
|
regenerate: () => {
|
|
state.piers = state.piers.map(p => groundInputChanged(p.input, p.draft) ? regenerateEntry(p) : p);
|
|
setupScene(); renderAll();
|
|
setStatus('지반 입력이 변경된 교각을 다시 생성했습니다. 생성 상태와 알림을 확인하세요.');
|
|
},
|
|
});
|
|
function resetProjectGround(): void {
|
|
groundProjectVersion++; groundImportSerial++;
|
|
projectGround.reset();
|
|
window.dispatchEvent(new Event('pierzainer:project-changed'));
|
|
}
|
|
|
|
'''
|
|
assert marker in s
|
|
s = s.replace(marker, insert + marker, 1)
|
|
s = s.replace(' updatePartToggles();\n $<HTMLButtonElement>', ' updatePartToggles();\n projectGround.refresh();\n $<HTMLButtonElement>', 1)
|
|
start = s.index(' // ② 지반 모델 (승인 2026-10-23):')
|
|
end = s.index(' if (!groundModel) {', start)
|
|
s = s[:start] + " wrap.appendChild(el('p', '프로젝트 공통 지반모델은 ① 형상의 [프로젝트 지반모델]에서 생성·불러오기·선택 적용합니다.', 'muted small'));\n\n" + s[end:]
|
|
s = s.replace(' * The ground model import and the 지반고 apply stay at the bottom, as before.', ' * Project model generation/import is managed from ①; this card retains local inputs.')
|
|
s = s.replace(' state.project = { ...parsed.project };', ' resetProjectGround();\n state.project = { ...parsed.project };', 1)
|
|
marker = " state.project = { ...state.project, name, bridge: $<HTMLInputElement>('bridge-name').value.trim() };"
|
|
assert marker in s
|
|
s = s.replace(marker, " resetProjectGround();\n groundModel = null;\n groundMapMode = 'none';\n setGroundMapMode(groundMapMode);\n" + marker, 1)
|
|
p.write_text(s)
|