70 lines
3.3 KiB
C++
70 lines
3.3 KiB
C++
#include "VolumePropertiesDialog.hpp"
|
||
|
||
#include <QStringList>
|
||
|
||
#include "FormKit.hpp"
|
||
|
||
namespace geopro::app {
|
||
|
||
namespace {
|
||
using VolumeInfo = geopro::data::Api3dRepository::VolumeInfo;
|
||
using Model = geopro::data::VolumeBuildParams::Model;
|
||
|
||
constexpr const char* kPending = "—(生成/渲染后可见)";
|
||
|
||
QString joinSources(const std::vector<std::string>& ids) {
|
||
if (ids.empty()) return QStringLiteral("—");
|
||
QStringList list;
|
||
for (const auto& s : ids) list << QString::fromStdString(s);
|
||
return list.join(QStringLiteral(", "));
|
||
}
|
||
|
||
QString modelLabel(const geopro::data::VolumeBuildParams& p) {
|
||
if (p.interpModel == Model::Idw)
|
||
return QStringLiteral("IDW(幂=%1)").arg(p.power, 0, 'f', 1);
|
||
return QStringLiteral("Kriging");
|
||
}
|
||
} // namespace
|
||
|
||
VolumePropertiesDialog::VolumePropertiesDialog(const QString& name, const VolumeInfo& info,
|
||
QWidget* parent)
|
||
: QDialog(parent) {
|
||
setWindowTitle(QStringLiteral("三维体属性"));
|
||
|
||
formkit::DetailForm form;
|
||
// ── 参数(随时可取)─────────────────────────────────────────────
|
||
form.group(QStringLiteral("参数"))
|
||
.row(QStringLiteral("名称"), name.isEmpty() ? QStringLiteral("—") : name)
|
||
.row(QStringLiteral("源数据集"), joinSources(info.params.sourceDatasetIds))
|
||
.row(QStringLiteral("插值模型"), modelLabel(info.params))
|
||
.row(QStringLiteral("网格间距"), QStringLiteral("XY=%1 m Z=%2 m")
|
||
.arg(info.params.cellXY, 0, 'f', 2)
|
||
.arg(info.params.cellZ, 0, 'f', 2))
|
||
.row(QStringLiteral("超距"), info.params.maxDist > 0.0
|
||
? QStringLiteral("%1 m").arg(info.params.maxDist, 0, 'f', 2)
|
||
: QStringLiteral("自动 (覆盖测区)"))
|
||
.row(QStringLiteral("色阶来源"),
|
||
info.params.colorScaleId.empty() ? QStringLiteral("首个源数据集")
|
||
: QString::fromStdString(info.params.colorScaleId));
|
||
|
||
// ── 统计(仅 loaded 时有效)──────────────────────────────────────
|
||
if (info.loaded) {
|
||
form.group(QStringLiteral("统计"))
|
||
.row(QStringLiteral("值域"),
|
||
QStringLiteral("%1 ~ %2").arg(info.vmin, 0, 'f', 2).arg(info.vmax, 0, 'f', 2))
|
||
.row(QStringLiteral("网格"),
|
||
QStringLiteral("%1 × %2 × %3").arg(info.nx).arg(info.ny).arg(info.nz))
|
||
.row(QStringLiteral("测点数"), QString::number(static_cast<qulonglong>(info.pointCount)))
|
||
.row(QStringLiteral("范围"), QStringLiteral("%1 × %2 × %3 m")
|
||
.arg(info.nx * info.dx, 0, 'f', 1)
|
||
.arg(info.ny * info.dy, 0, 'f', 1)
|
||
.arg(info.nz * info.dz, 0, 'f', 1));
|
||
} else {
|
||
form.group(QStringLiteral("统计")).row(QStringLiteral("统计"), QString::fromUtf8(kPending));
|
||
}
|
||
|
||
formkit::buildDetailDialog(this, form.build());
|
||
}
|
||
|
||
} // namespace geopro::app
|