From fbb068ec702338d609c1ca6eddbdb9f182d8f211 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 24 Aug 2026 11:37:16 +0800
Subject: [PATCH] feat: extend local GeoAI capability workflows

---
 apps/workbench-console/README.md |  105 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 105 insertions(+), 0 deletions(-)

diff --git a/apps/workbench-console/README.md b/apps/workbench-console/README.md
index d3e679c..97bd93d 100644
--- a/apps/workbench-console/README.md
+++ b/apps/workbench-console/README.md
@@ -74,6 +74,12 @@
 保留目录和边界状态,待其首个 Demo 产出可检查工件后再接入。
 ## 本地运行工作台
 
+### 空间规则与风险评分
+
+`07-risk-rule-engine` 已接入独立本地实验控制台。新建运行要求一份带投影 CRS 的观测对象 GeoJSON(唯一 `object_id` 和数值 `confidence`)、一份风险分区 GeoJSON(`zone_type`)和一份规则 JSON。服务端只调用固定的 `.venvs/07-risk-rule-engine/Scripts/python.exe` 及固定能力脚本,并为每次提交创建新的 raw、processed 和 output 目录。
+
+工作区展示风险 GeoTIFF 预览和评分 GeoJSON,并显示逐对象得分、等级、命中规则与建议;可下载 GeoTIFF、GeoJSON、CSV、汇总 JSON 和运行元数据。风险等级是规则计算出的人工复核优先级,不是事件事实、自动处置或产品能力。接口为 `GET/POST /api/risk-rule-engine/runs`,仅在本机 `6xxx` 端口提供服务。
+
 控制台现支持可操作的本地实验运行,并保持与无人机产品完全独立。能力页面提供新建运行入口和可搜索扩展的案例库,案例由本地服务从运行目录自动发现,不再依赖前端硬编码 Tabs。
 
 - 轨迹分析上传 `XLSX`、`KMZ`、禁飞区 `GeoJSON` 和可选适飞区 `Gzip`,原始、处理和输出分别归档在 `shared/data/raw`、`shared/data/processed`、`shared/outputs`。
@@ -84,3 +90,102 @@
 - 异常检测分别上传 1~6 张正常参考影像和 1~6 张待检测影像,支持 `JPG/JPEG/PNG/TIF/TIFF`。3 张以上固定机位且全部尺寸一致时自动启用同位置规则和通用局部外观/结构变化通道,否则回退为全局规则;局部通道不使用颜色或物品类别规则。结果页显示实际选择的模式。大文件使用二进制流,后台任务完成后进入案例库;结果展示参考输入、待检测原图、规则/Isolation Forest 对比、热力图、候选区字段与下载工件。案例列表右侧的“复用输入”会把该案例的原始参考图、待检测图和四项可编辑参数回填到新运行表单,不自动启动检测,也不修改历史案例。
 - 本地 API 还包括 `GET/POST /api/change-detection/runs` 和 `PUT /api/change-detection/uploads/<upload-id>`;变化检测前端使用二进制流上传,服务端按原字节暂存并复制到独立 raw、processed 和 output 目录,不修改原始 TIFF,也不覆盖既有运行。
 - 本地 API 为 `GET/POST /api/trajectory/runs`、`GET/POST /api/object-detection/runs`、`GET/POST /api/semantic-mapping/runs`、`GET/POST /api/spatial-measurement/runs`、`GET/POST /api/anomaly-detection/runs` 和只读的 `GET /api/semantic-mapping/tasks`;异常检测另有二进制上传和后台任务状态端点。服务仅监听回环地址,端口必须是 `6xxx`,只调用固定虚拟环境和能力脚本,不接受任意命令或任意路径。
+
+## 3D Point-cloud Workspace
+
+The `05-3d-pointcloud` console adapter provides `GET/POST /api/3d-pointcloud/runs`.
+It accepts two PLY/PCD/XYZ/LAS/LAZ files at most, copies source bytes into a new
+raw run directory, records SHA-256, and invokes only the fixed CPU interpreter
+and point-cloud script. The workspace shows DSM/elevated-surface raster and
+GeoAI footprint vector side by side, plus counts, mesh summary, artifacts, and
+run metadata. It remains independent of all drone products and is local-only on
+`6xxx` loopback ports.
+
+The same case library also discovers completed photo-SfM and CPU-MVS result
+directories. Sparse SfM cases use an interactive `THREE.Points` vertex viewer
+with registration statistics, local poses and input manifest; vertices are never
+triangulated by the viewer. CPU-MVS cases offer reliable-texture, point-colour,
+and complete-geometry views. The reliable-texture atlas pixels are vertically
+corrected for browser sampling and faces that reach black atlas background or
+the OpenMVS orange no-coverage colour are omitted; visible holes therefore
+indicate rejected texture coverage rather than a placeholder colour. Complete
+geometry retains all reconstructed mesh faces in a neutral material. Point-colour
+uses nearest fused RGB point values on the complete mesh; it does not claim
+per-face photo-texture evidence. All views support orbit, zoom, an explicit
+local-`+Z` top-down view, reset and wireframe controls, plus dense PLY, mesh
+PLY and texture downloads. Both use local SfM coordinates and are not
+rendered as DSM or GeoJSON without valid georeferencing.
+
+The top-level `05-3d-pointcloud` workflow switch keeps incompatible inputs
+separate. `照片三维重建` accepts 3-30 JPG/JPEG files from one coherent camera
+sequence through bounded binary uploads, preserves the raw bytes, then runs a
+background CPU SfM/MVS job and polls `queued`, `sparse_sfm`, `dense_mvs`,
+`complete`, or `failed` status. Its GPS/RTK-prior option uses the verified
+spatial-neighbour configuration only when every photo has suitable position
+metadata; turn it off for ordinary cameras. `既有点云理解` accepts up to two
+PLY/PCD/XYZ/LAS/LAZ inputs and produces the DSM/elevated-surface raster and
+GeoAI footprint vector workflow. Creating a run or discovering a new case
+does not require rebuilding the frontend; `npm run build` is only required
+after changing the Vue/TypeScript console source.
+
+The same workspace also exposes point-cloud semantic classification:
+PLY/PCD/XYZ/LAS/LAZ files are sent through bounded binary streaming, retained
+byte-for-byte in a new run, and classified on CPU into ground, vegetation,
+building/structure, pole/tower candidates, power-line candidates and unknown.
+Its case view renders a capped colour point preview and provides semantic LAS,
+GeoTIFF, GeoJSON and CSV downloads. The labels are review candidates from
+RGB/local-geometry rules, not a trained semantic-model claim. Dense MVS cases
+also expose an action that classifies only their fixed local `dense.ply`; the
+server never accepts a browser-supplied path.
+
+Semantic cases with a generated RGB annotation source provide a separate manual
+annotation and supervised-training area. Brush and rectangle selections become
+separate annotation revisions rather than altering source clouds or rule results.
+The annotation point viewer uses sRGB-correct anti-aliased circular points.
+Browse mode keeps left-drag rotation; brush/rectangle mode reserves left-drag
+for labels, with right-drag rotation, middle-drag panning and wheel zoom.
+Middle-button auto-scroll is suppressed inside the point canvas. Its rotate-
+centre tool lets a user click a visible point to move the orbit target without
+changing annotations.
+The model-orientation control provides independent 0-360 degree local X/Y/Z
+display rotations about the model centre. It never changes the original point
+cloud or stored annotation indices; picking and rectangle selection follow the
+currently displayed orientation.
+An incorrect revision can be removed after confirmation, but the endpoint only
+removes that revision directory and cannot remove LAS/PLY sources, semantic
+results, or training outputs. A local CPU training job requires two classes with
+at least 500 confirmed points each, then writes a portable model, metrics, and
+predicted PLY asynchronously. Sources, point indices, class codes, Python
+interpreter and command are all server-fixed; the same model pipeline can later
+use CUDA without data or code changes.
+
+The supervised area also exposes **Apply trained model**. It discovers only
+complete local training directories containing both `model.pt` and `metrics.json`.
+Select a discovered model, upload one new RGB PLY/PCD/LAS/LAZ point cloud, and
+the server copies its bytes into new `raw` and `processed` inference directories
+before starting a background CPU job. The API accepts neither a browser path nor
+an arbitrary model path. Completion shows the classified PLY preview directly in
+the workspace and provides downloads for classified LAS, class-count CSV,
+prediction JSON, metadata, and model weight. XYZ-only input fails explicitly:
+the supervised model requires observed RGB features. Output remains a review
+candidate, especially for the current pole/tower class, not asset inventory or
+an inspection conclusion.
+
+The 3D point-cloud capability is presented as four focused workspaces rather
+than one long mixed result page:
+
+1. **Photo 3D reconstruction**: JPG/JPEG input, sparse/dense reconstruction,
+   mesh, texture, and photo-reconstruction cases only.
+2. **Point-cloud geometry processing**: PLY/PCD/XYZ/LAS/LAZ input, DSM,
+   elevated-surface raster/vector, approximate mesh, and geometry downloads.
+3. **Point-cloud semantic classification**: classification cases, coloured
+   point preview, semantic LAS/CSV/GeoJSON and review-only rule outputs.
+4. **Annotation, training, and model application**: RGB annotation source,
+   annotation revisions, CPU training, training metrics, and applying a trained
+   model to a new RGB cloud.
+
+Each workspace filters the case library to its own purpose. A point-cloud run
+may appear in both geometry and semantic workspaces because it has both output
+families, but the pages never render the unrelated result bands together. The
+model workspace deliberately uses its generated annotation sources and trained
+models rather than a general case library.

--
Gitblit v1.9.3