#pragma once #include #include #include "DatasetDetailController.hpp" #include "model/Anomaly.hpp" #include "model/ColorScale.hpp" #include "model/Field.hpp" class QSlider; class QLabel; class QwtPlot; class QwtPlotRescaler; namespace geopro::app { class AnomalyTablePanel; class DescriptionPanel; class ColorBarWidget; class ColorMapService; class ContourPlotItem; // 网格数据图表视图:工具条 + QwtPlot(白底 + 真实比尺 + 实时平移/滚轮缩放,x 轴在底部) // + 独立色阶条 + 底部双页签(异常列表/描述)。 // 填充走 ContourPlotItem 栅格热力图 + 矢量等值线 + 标注 + 异常叠加。 class GridDataChartView : public QWidget { Q_OBJECT public: explicit GridDataChartView(QWidget* parent = nullptr); ~GridDataChartView() override; // 开页时调用:仅喂底部异常列表(网格数据随网格页激活懒加载)。 void setData(const geopro::controller::DatasetDetailController::ChartData& d); // 网格数据到达(懒加载结果):建色彩服务 + ContourPlotItem,挂到 QwtPlot,更新色阶条/异常表。 void setGridData(const geopro::core::Grid& grid, const geopro::core::ColorScale& gridScale, const std::vector& anoms); private: void rebuildContour(); // 按当前显隐开关重建并重绘 ContourPlotItem geopro::controller::DatasetDetailController::ChartData data_; QwtPlot* plot_ = nullptr; QwtPlotRescaler* rescaler_ = nullptr; ColorBarWidget* colorBar_ = nullptr; AnomalyTablePanel* anomalyTable_ = nullptr; DescriptionPanel* descriptionPanel_ = nullptr; QSlider* simplifySlider_ = nullptr; QLabel* simplifyValueLabel_ = nullptr; // 渲染状态 ColorMapService* colorSvc_ = nullptr; // heap,setGridData 重建 ContourPlotItem* contourItem_ = nullptr; geopro::core::Grid grid_{1, 1}; geopro::core::ColorScale gridScale_; std::vector anoms_; bool hasGrid_ = false; // 工具条显隐开关 bool showAnomalies_ = true; bool showLabels_ = true; }; } // namespace geopro::app