feat(viewer): unify spatial clipping, planning and observation surfaces

Share spatial clipping and height slices across live planning and recorded observations. Refine scene navigation, report serialization and viewer presentation.
This commit is contained in:
DCCONSTRUCTIONS
2026-10-29 09:10:01 +03:00
parent f48411f8fe
commit 7878937691
40 changed files with 464 additions and 138 deletions
+11 -1
View File
@@ -48,6 +48,11 @@ def build_planning_live_router(service):
except (ValueError, RuntimeError) as exc:
raise HTTPException(409, str(exc)) from exc
@router.get("/status")
async def status():
value = await call(service.get_status)
return JSONResponse(value, headers={"Cache-Control": "no-store"})
@router.get("/active")
async def active(request: Request):
accepts_gzip = "gzip" in request.headers.get("accept-encoding", "")
@@ -57,7 +62,8 @@ def build_planning_live_router(service):
# Returning its dict sends it through FastAPI's recursive encoder
# and gzip on the event loop, delaying unrelated control requests.
# Keep the exact JSON contract, but finish both operations here.
response = JSONResponse(service.get(), headers={"Cache-Control": "no-store"})
response = Response(service.get_json(), media_type="application/json",
headers={"Cache-Control": "no-store"})
if accepts_gzip and len(response.body) >= 1024:
return Response(
gzip.compress(response.body, compresslevel=5, mtime=0),
@@ -109,6 +115,7 @@ def build_planning_live_router(service):
grid: bool = True,
point_size: float = Query(1.8, ge=0.5, le=12),
ceiling_m: float | None = Query(default=None, allow_inf_nan=False),
floor_m: float | None = Query(default=None, allow_inf_nan=False),
):
options = dict(
mode=mode,
@@ -118,6 +125,7 @@ def build_planning_live_router(service):
grid=grid,
point_size=point_size,
ceiling_m=ceiling_m,
floor_m=floor_m,
)
return Response(
await call(service.scene, str(run_id), base, options),
@@ -138,6 +146,7 @@ def build_planning_live_router(service):
grid: bool = True,
point_size: float = Query(1.8, ge=0.5, le=12),
ceiling_m: float | None = Query(default=None, allow_inf_nan=False),
floor_m: float | None = Query(default=None, allow_inf_nan=False),
):
options = dict(
mode=mode,
@@ -148,6 +157,7 @@ def build_planning_live_router(service):
grid=grid,
point_size=point_size,
ceiling_m=ceiling_m,
floor_m=floor_m,
)
payload, next_cursor, info = await call(
service.scene_update, str(run_id), cursor, base, options
+2
View File
@@ -16,6 +16,7 @@ class OverviewSpatialRequest(BaseModel):
model_config = ConfigDict(extra="forbid")
generation: str = Field(pattern="^[a-f0-9]{64}$")
ceiling_m: float | None = Field(default=None, allow_inf_nan=False)
floor_m: float | None = Field(default=None, allow_inf_nan=False)
mode: Literal["3d", "top"] | None = None
comparison_generation: str | None = Field(default=None, pattern="^[a-f0-9]{64}$")
representation: Literal["original", "corrected"] = "original"
@@ -84,6 +85,7 @@ def build_session_overview_router(service: SessionOverviewService) -> APIRouter:
request.aspect,
comparison,
request.representation,
request.floor_m,
)
headers = {"Cache-Control": "no-store", "X-Overview-Visible-Points": str(visible)}
if eye is not None: