auto: 2026-09-01 16:56 (ESD_LAPTOP)

This commit is contained in:
2026-09-01 16:56:32 +09:00
parent f82e60492e
commit e6b4d960bc
5 changed files with 242 additions and 96 deletions
@@ -277,3 +277,75 @@ async def get_planned_route(project_id: UUID) -> dict[str, Any] | JSONResponse:
except Exception as exc:
logger.warning("계획노선 조회 실패: %s", exc)
return JSONResponse(status_code=500, content={"status": "error", "message": str(exc)})
# ── 도엽등고 서피스 보간 방식 (2026-09-01) ────────────────────────────────
# 자동 전처리는 기본 방식 하나만 만든다. 나머지는 관리자가 화면에서 그 방식을
# 고를 때 여기로 요청해 만든다. 파일명이 방식마다 갈려 있어(`dtm_sheet_{방식}.npz`)
# 한 번 만든 방식은 다시 골라도 그대로 쓰인다.
@router.get("/{project_id}/surface/sheet-methods", response_model=None)
async def list_sheet_methods(project_id: UUID) -> dict[str, Any]:
"""고를 수 있는 도엽 보간 방식과, 이미 만들어 둔 방식을 알려준다."""
from B04_PreProcess.B04_PreProcess_Engine_SheetMethods import SHEET_METHOD_LABELS
from config.config_system import SHEET_SURFACE_METHODS
pool = get_db_pool()
async with pool.acquire() as connection:
stored_path = await get_project_storage_relative_path(connection, project_id)
models_dir = Path(resolve_stored_project_path(stored_path)) / "B04_PreProcess" / "models"
return {
"status": "success",
"methods": [
{
"key": key,
"label": SHEET_METHOD_LABELS.get(key, key),
"built": (models_dir / f"dtm_sheet_{key}.npz").is_file(),
}
for key in SHEET_SURFACE_METHODS
],
}
@router.post("/{project_id}/surface/sheet-surface", response_model=None)
async def build_sheet_surface(project_id: UUID, request: Request) -> dict[str, Any] | JSONResponse:
"""도엽 서피스 한 방식을 만들어 DB에 등록한다. 이미 있으면 그대로 둔다."""
from B04_PreProcess.B04_PreProcess_Engine_SheetMethods import SHEET_METHOD_BUILDERS
from B04_PreProcess.B04_PreProcess_Engine_SheetSurface import build_sheet_surface_from_route
from B04_PreProcess.B04_PreProcess_Repository import save_sheet_surface_models
body = await request.json()
method = str(body.get("method") or "")
if method not in SHEET_METHOD_BUILDERS:
return JSONResponse(
status_code=400,
content={"status": "error", "message": f"지원하지 않는 보간 방식입니다: {method}"},
)
pool = get_db_pool()
async with pool.acquire() as connection:
stored_path = await get_project_storage_relative_path(connection, project_id)
project_root = Path(resolve_stored_project_path(stored_path))
stage_root = project_root / "B04_PreProcess"
models = await asyncio.to_thread(
build_sheet_surface_from_route,
project_root,
stage_root / "processed",
stage_root / "models",
[method],
)
if not models:
return JSONResponse(
status_code=400,
content={"status": "error", "message": "도엽 서피스를 만들지 못했습니다."},
)
async with pool.acquire() as connection:
await connection.begin()
try:
model_ids = await save_sheet_surface_models(connection, project_id, models)
await connection.commit()
except Exception:
await connection.rollback()
raise
return {"status": "success", "method": method, "surface_model_ids": model_ids}