120 lines
4.8 KiB
C++
120 lines
4.8 KiB
C++
#pragma once
|
||
#include <vector>
|
||
#include <QMetaType>
|
||
#include <QString>
|
||
#include "model/Field.hpp"
|
||
#include "model/ColorScale.hpp"
|
||
#include "model/Anomaly.hpp"
|
||
|
||
// 详情渲染载荷(纯数据,跨 QVariant 类型擦除传递)。无 Qt-widget 依赖。
|
||
// 命名空间 geopro::core(与同目录 Field.hpp/ColorScale.hpp 一致)。
|
||
namespace geopro::core {
|
||
|
||
// 下拉项:字段码 + 显示名(measurement 工具条 x/y/v/method 下拉驱动;code 可空如 method)。
|
||
struct FieldOption {
|
||
QString code;
|
||
QString name;
|
||
};
|
||
|
||
// measurement 散点工具条配置(来自服务端 scatterGraphConf;反演留空 → 视图渲染反演工具条)。
|
||
// x/y/v/method 为各下拉的可选项(含 fieldCode+name);defaultX/Y/V/Method 为默认选中项的
|
||
// fieldCode(method 的 fieldCode 全为 null,故 defaultMethod 用 name)。empty() 判定走 x 是否为空。
|
||
struct ScatterToolbarConf {
|
||
std::vector<FieldOption> x, y, v, method;
|
||
QString defaultX, defaultY, defaultV, defaultMethod;
|
||
bool empty() const { return x.empty(); }
|
||
};
|
||
|
||
// 散点载荷:反演原数据 / measurement 散点共用(≈ data::ChartParts)。
|
||
// 两者上色一致——按数据 min/max 连续插值(Plotly cauto,含负异常值,RawDataChartView 据 v
|
||
// 有限值 min/max 设 setDataRange)。verticalLegend=true(measurement)时色阶图例画在右侧竖条
|
||
// (离散带,1323→0 自上而下,对齐原版);false(默认,反演原数据)时画在底部横条。
|
||
// toolbar 非空(measurement)时视图渲染 measurement 工具条;altX*/altY* 为 x/y 下拉本地重绘
|
||
// 用的备选列(平距/斜距、伪深度/伪深度+高程),与 scatter.v/.a... 同序、一一对应,避免再发请求。
|
||
struct ScatterPayload {
|
||
geopro::core::ScatterField scatter;
|
||
geopro::core::ColorScale scale;
|
||
bool verticalLegend = false;
|
||
ScatterToolbarConf toolbar;
|
||
std::vector<double> altXHorizontal, altXSlope; // x 下拉:平距 / 斜距
|
||
std::vector<double> altYPseudo, altYElevationPseudo; // y 下拉:伪深度 / 伪深度+高程
|
||
};
|
||
|
||
// 等值面载荷:grid(rows) + 色阶 + 异常(≈ data::GridParts)。
|
||
// Grid 无默认构造,给占位初始化以满足 QVariant 对默认可构造的要求。
|
||
struct ContourPayload {
|
||
geopro::core::Grid grid{1, 1};
|
||
geopro::core::ColorScale scale;
|
||
std::vector<geopro::core::Anomaly> anomalies;
|
||
};
|
||
|
||
// 列渲染种类:Text=预格式化文本(默认);Toggle=每行开关(蓝色药丸开关,ON=可见)。
|
||
enum class TableColumnKind { Text, Toggle };
|
||
|
||
// 通用表格列定义。
|
||
struct TableColumn {
|
||
QString code;
|
||
QString title;
|
||
int width = 0;
|
||
int sort = 0;
|
||
TableColumnKind kind = TableColumnKind::Text;
|
||
};
|
||
|
||
// 通用表格载荷:列定义 + 预格式化的行(每格 QString)+ 总数(分页用)。
|
||
struct TablePayload {
|
||
std::vector<TableColumn> columns;
|
||
std::vector<std::vector<QString>> rows;
|
||
int total = 0;
|
||
};
|
||
|
||
// 柱状图系列:名称(图例/legend)+ 各类目的 y 值 + 填充色(hex,如 #5470c6;数据色,两主题一致)。
|
||
struct BarSeries {
|
||
QString name;
|
||
std::vector<double> values;
|
||
QString color;
|
||
};
|
||
|
||
// 柱状图载荷(dd_ert_measurement_gr_data 接地电阻):类目(x 轴标签,如 "#1".."#40")+
|
||
// 一个或多个系列(P1/P2,每系列一组按类目对齐的 y 值)+ 轴标题。
|
||
struct BarPayload {
|
||
std::vector<QString> categories;
|
||
std::vector<BarSeries> series;
|
||
QString xTitle;
|
||
QString yTitle;
|
||
};
|
||
|
||
// 折线图载荷(dd_trajectory_data 高程页签):单条平滑折线。
|
||
// 类目(x 轴标签,如 "#1".."#40",来自 electrodeNo)+ 对齐的 y 值(高程)+ 系列名 + 线色(hex,
|
||
// 如 #5470c6,ECharts 默认蓝,两主题一致)+ 轴标题(x「电极号」/ y「高程」)+ 是否平滑。
|
||
struct LinePayload {
|
||
std::vector<QString> categories;
|
||
std::vector<double> y;
|
||
QString seriesName;
|
||
QString color;
|
||
QString xTitle;
|
||
QString yTitle;
|
||
bool smooth = true;
|
||
};
|
||
|
||
// 轨迹地图点(dd_trajectory_data 地图页签):电极号 + WGS84 经纬度。
|
||
// 服务端 dd/ert/trajectory/line 直接返回 EPSG:4326 经纬(x=经度 lon、y=纬度 lat)。
|
||
struct MapPoint {
|
||
int electrodeNo = 0;
|
||
double lon = 0;
|
||
double lat = 0;
|
||
};
|
||
|
||
// 轨迹地图载荷:一组电极经纬点(按电极号顺序)。视图据此在 Leaflet 上画橙色空心圈标记。
|
||
struct MapPayload {
|
||
std::vector<MapPoint> points;
|
||
};
|
||
|
||
} // namespace geopro::core
|
||
|
||
Q_DECLARE_METATYPE(geopro::core::ScatterPayload)
|
||
Q_DECLARE_METATYPE(geopro::core::ContourPayload)
|
||
Q_DECLARE_METATYPE(geopro::core::TablePayload)
|
||
Q_DECLARE_METATYPE(geopro::core::BarPayload)
|
||
Q_DECLARE_METATYPE(geopro::core::LinePayload)
|
||
Q_DECLARE_METATYPE(geopro::core::MapPayload)
|