#pragma once #include #include #include #include "model/Field.hpp" #include "repo/RepoTypes.hpp" namespace geopro::data { // ds 维度属性(由 ds 类型/ddCode 决定,spec §6.1)。三栏列表筛选用。 enum class DsDimension { Dim2D, Dim3D, Analysis3D, Other }; // 三维体模型数据:规则标量体 + 世界系原点/间距 + 值域(去裸 double[],用 std::array,spec §6.2)。 struct VolumeGrid { geopro::core::ScalarVolume vol{0, 0, 0}; std::array origin{{0.0, 0.0, 0.0}}; // ox, oy, oz(世界米) std::array spacing{{0.0, 0.0, 0.0}}; // dx, dy, dz double vmin = 0.0, vmax = 0.0; bool valid() const { return vol.nx() > 0 && vol.ny() > 0 && vol.nz() > 0 && vmax > vmin; } }; // DEM/影像 GeoTIFF 绝对路径(供 render::buildTerrain 经 GDAL 读,spec §6.2)。 struct TerrainPaths { std::string demPath, imagePath; }; // 三维场景仓储抽象(异步,spec §6 评审 HIGH)。 // 取数方法走回调 std::function(LocalSample 本地数据同步算好后直接回调; // 将来 Api3dRepository 在网络完成时回调,上层不变)。 // **契约:onOk/onErr 必须在主(GUI)线程调用**——上层(VtkSceneController)回调内直接操作 // 场景/发 Qt 信号,依赖主线程亲和;Api 实现若在工作线程完成须 post 回主线程再回调。 // dimensionOf 是同步纯函数(无 I/O,只做类型→维度映射)。 // 切片/异常/任务等签名本期不在接口内(留 P3/P4)。 class I3dSceneRepository { public: using OnError = std::function; virtual ~I3dSceneRepository() = default; // 同步纯函数:ds 类型 → 维度(spec §6.1 映射表)。 virtual DsDimension dimensionOf(const DsRow& ds) const = 0; // 异步:加载三维体模型(成功回调 VolumeGrid,失败回调消息)。 virtual void loadVolume(const std::string& dsId, std::function onOk, OnError onErr) = 0; // 异步:加载地形 DEM/影像路径。 virtual void loadTerrainPaths(std::function onOk, OnError onErr) = 0; }; } // namespace geopro::data