diff --git a/src/app/main.cpp b/src/app/main.cpp index ac871f8..9b31f00 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -85,6 +85,7 @@ #include "ApiClient.hpp" #include "AuthService.hpp" +#include "DatasetDimension.hpp" #include "Credential.hpp" #include "Glyphs.hpp" #include "Logging.hpp" @@ -590,15 +591,42 @@ void buildWorkbench(QMainWindow& window, geopro::data::LocalSampleRepository& re } }); - // ── 左上对象树勾选 → 渲染勾选数据集(本期样本驱动:任意勾选 → 样本 ds "grid1",空 → 清场)── - // 真实接 Api 时改为把勾选 TM 映射到其 ds 维度过滤后的真实 dsId 列表(spec §6.1/§8)。 - QObject::connect(objectTree, &geopro::app::ObjectTreePanel::checkedTmsChanged, sceneCtrl, - [sceneCtrl, emptyState](const QStringList& tmIds) { - const bool hasData = !tmIds.isEmpty(); - emptyState->setVisible(!hasData); // 有勾选→隐藏引导层,露出中央渲染 - sceneCtrl->setCheckedDatasets( - hasData ? QStringList{QStringLiteral("grid1")} : QStringList{}); - }); + // ── 左上对象树勾选 → 拉取各 TM 的 ds 子树,按维度分发到三栏列表(spec §6.1/§8)── + // 渲染由三栏勾选框驱动(Task 7:Column3DDataset::checkedDatasetsChanged → setCheckedDatasets)。 + QObject::connect( + objectTree, &geopro::app::ObjectTreePanel::checkedTmsChanged, &window, + [&projectRepo, &nav, drawer, emptyState](const QStringList& tmIds) { + emptyState->setVisible(tmIds.isEmpty()); // 有勾选→隐藏引导层,露出中央渲染 + if (tmIds.isEmpty()) { + drawer->col3D()->setDatasets({}); + drawer->col2D()->setDatasets({}); + drawer->colAnalysis()->setDatasets({}); + return; + } + // 多 TM 异步汇总:每个 TM 取整棵 ds 子树,全部回来后按维度分发到三栏。 + auto acc = std::make_shared>(); + auto remaining = std::make_shared(tmIds.size()); + auto finish = [acc, drawer]() { + geopro::app::DimBuckets b = geopro::app::splitByDimension(*acc); + drawer->col3D()->setDatasets(b.dim3D); + drawer->col2D()->setDatasets(b.dim2D); + drawer->colAnalysis()->setDatasets(b.analysis); + }; + for (const QString& tm : tmIds) { + geopro::data::NavRequest* req = projectRepo.loadRowsAsync( + nav.currentProjectId().toStdString(), tm.toStdString(), 2, 3, 1, 100000); + QObject::connect(req, &geopro::data::NavRequest::done, drawer, + [acc, remaining, finish](const QVariant& v) { + auto page = qvariant_cast(v); + acc->insert(acc->end(), page.rows.begin(), page.rows.end()); + if (--(*remaining) == 0) finish(); + }); + QObject::connect(req, &geopro::data::NavRequest::failed, drawer, + [remaining, finish](const QString&) { + if (--(*remaining) == 0) finish(); // 单个失败不卡死,其余照常分发 + }); + } + }); // ── 启动:建立一次中央视图。三栏重构后删除了 2D/3D 切换,统一固定为三维视图 // (帘面默认开启 showCurtain_=true,勾选 dd_section → 帘面)。无勾选 → 空场景 + 背景。