diff --git a/installer/build_installer.ps1 b/installer/build_installer.ps1 index 56d2256..55ff2d0 100644 --- a/installer/build_installer.ps1 +++ b/installer/build_installer.ps1 @@ -126,6 +126,22 @@ if (-not $SkipDeploy) { } } +# --- 5.5 随包数据:本地样本演示数据 + PROJ 数据(exe 旁布局,运行时相对定位)------- +# 客户端启动会同步加载本地样本数据构建工作台;PROJ 数据供 3D 体素 CRS 配准。 +# 二者缺失会导致登录后无界面/3D 退化,故随包到 exe 旁(sampledata\ 与 proj\)。 +Info '随包数据:复制样本演示数据 + PROJ 数据到 staging...' +# 用目录内 ASCII 标志文件 dem.tif 定位样本目录,避免在脚本里写中文路径(编码风险)。 +$sampleSrc = Get-ChildItem (Join-Path $RepoRoot 'docs') -Directory -ErrorAction SilentlyContinue | + Where-Object { Test-Path (Join-Path $_.FullName 'dem.tif') } | Select-Object -First 1 +if (-not $sampleSrc) { Die '未找到本地样本数据目录(docs 下含 dem.tif 的目录)' } +robocopy $sampleSrc.FullName (Join-Path $StageDir 'sampledata') /E /NFL /NDL /NJH /NJS /MT:8 | Out-Null +if ($LASTEXITCODE -ge 8) { Die "robocopy 样本数据失败 (exit $LASTEXITCODE)" } + +$projSrc = Join-Path $RepoRoot 'build\release\vcpkg_installed\x64-windows\share\proj' +if (-not (Test-Path (Join-Path $projSrc 'proj.db'))) { Die "未找到 PROJ 数据: $projSrc\proj.db" } +robocopy $projSrc (Join-Path $StageDir 'proj') /E /NFL /NDL /NJH /NJS /MT:8 | Out-Null +if ($LASTEXITCODE -ge 8) { Die "robocopy PROJ 数据失败 (exit $LASTEXITCODE)" } + # --- 6. VC++ 运行时安装器就位 ----------------------------------------------- New-Item -ItemType Directory -Force $RedistDir | Out-Null $VcRedist = Join-Path $RedistDir 'vc_redist.x64.exe' diff --git a/src/app/main.cpp b/src/app/main.cpp index 2a3fef8..91135fa 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -97,6 +97,7 @@ #include "Theme.hpp" #include "AnomalySaveDialog.hpp" #include "AnomalyPropertiesDialog.hpp" +#include "ColorScaleConfigDialog.hpp" #include "SettingsDialog.hpp" #include "SlicePropertiesDialog.hpp" #include "SliceExport.hpp" @@ -769,11 +770,22 @@ void buildWorkbench(QMainWindow& window, geopro::data::LocalSampleRepository& re QMessageBox::warning(&window, QStringLiteral("导出"), QStringLiteral("导出失败。")); }); - // 色阶(三维体/切片):本期占位。 + // 色阶(三维体/切片):复刻原版「色阶配置」对话框,确定后体素 + 其切片随新色阶重渲染。 + // 仅对当前已渲染的三维体生效(切片色阶继承体色阶,经 InteractionManager 重建)。 QObject::connect(ca, &geopro::app::Column3DAnalysis::colorScaleRequested, &window, - [&window](const QString&) { - QMessageBox::information(&window, QStringLiteral("色阶"), - QStringLiteral("色阶设置开发中。")); + [&window, sceneCtrl, sceneView](const QString& qid) { + const std::string dsId = qid.toStdString(); + if (sceneView->currentVolumeDsId() != dsId || !sceneView->hasVolume()) { + QMessageBox::information( + &window, QStringLiteral("色阶"), + QStringLiteral("请先勾选该三维体使其渲染后再编辑色阶。")); + return; + } + geopro::app::ColorScaleConfigDialog dlg( + sceneView->currentColorScale(), sceneView->currentVmin(), + sceneView->currentVmax(), &window); + if (dlg.exec() == QDialog::Accepted) + sceneCtrl->setVolumeColorScale(dsId, dlg.colorScale()); }); // ── 3D 异常控制(#4c):显示过滤 / 单条显隐 / 删除 → 驱动 VTK 异常渲染 ────────── @@ -1772,9 +1784,27 @@ int main(int argc, char* argv[]) api.setToken(token); // 注入 token 供后续 API 使用 + // 本地样本演示数据目录:优先随安装包目录(exe 旁 sampledata/),回退源码树开发路径。 + // 不依赖写死的开发机绝对路径——部署到任意机器均可用。 + const std::string sampleDir = []() -> std::string { + const QString appDir = QCoreApplication::applicationDirPath(); + const QStringList candidates = { + appDir + QStringLiteral("/sampledata"), + QStringLiteral("D:/Git/lanbingtech/geopro/docs/剖面网格数据的色阶数据2等文件"), + }; + for (const auto& c : candidates) { + if (QDir(c).exists()) { + const QByteArray u8 = (c + QStringLiteral("/")).toUtf8(); + return std::string(u8.constData(), static_cast(u8.size())); + } + } + // 都不存在:返回首选路径,交由下游报错并被启动防护捕获(提示安装不完整)。 + const QByteArray u8 = (candidates.front() + QStringLiteral("/")).toUtf8(); + return std::string(u8.constData(), static_cast(u8.size())); + }(); + // 登录成功 → 构建并显示工作台。 - geopro::data::LocalSampleRepository repo( - "D:/Git/lanbingtech/geopro/docs/剖面网格数据的色阶数据2等文件/"); + geopro::data::LocalSampleRepository repo(sampleDir); // 导航仓储 + 控制器(接口/逻辑层):用同一共享会话 ApiClient。 geopro::data::ApiProjectRepository projectRepo(api); @@ -1798,7 +1828,17 @@ int main(int argc, char* argv[]) window->setWindowTitle(kTitle); window->resize(1280, 800); window->setMinimumSize(1024, 680); - buildWorkbench(*window, repo, projectRepo, datasetRepo, nav, detailCtrl); + // 启动防护:工作台构建期间任何同步加载失败(如样本数据缺失)都不应让进程静默退出, + // 而是给出可见错误提示。否则登录后窗口未显示、进程消失,用户无从排查。 + try { + buildWorkbench(*window, repo, projectRepo, datasetRepo, nav, detailCtrl); + } catch (const std::exception& e) { + QMessageBox::critical( + nullptr, QStringLiteral("启动失败"), + QStringLiteral("工作台初始化失败:\n%1\n\n请确认安装完整(样本数据 / 运行库未缺失)。") + .arg(QString::fromUtf8(e.what()))); + return 1; + } // 主题桥:ThemeManager 明/暗切换 → 重应用全局 QSS+调色板(标准控件 + ADS;内联 chrome 经各自连接)。 QObject::connect(&geopro::app::ThemeManager::instance(), &geopro::app::ThemeManager::changed,