geopro/src/app/panels/chart/GridDataChartView.hpp

67 lines
2.1 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include <vector>
#include <QWidget>
#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<geopro::core::Anomaly>& 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; // heapsetGridData 重建
ContourPlotItem* contourItem_ = nullptr;
geopro::core::Grid grid_{1, 1};
geopro::core::ColorScale gridScale_;
std::vector<geopro::core::Anomaly> anoms_;
bool hasGrid_ = false;
// 工具条显隐开关
bool showAnomalies_ = true;
bool showLabels_ = true;
};
} // namespace geopro::app