|
|
|
|
@ -0,0 +1,52 @@
|
|
|
|
|
#include "panels/DatasetDetailPage.hpp"
|
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QToolButton>
|
|
|
|
|
#include <QButtonGroup>
|
|
|
|
|
#include <QCheckBox>
|
|
|
|
|
#include "panels/chart/DatasetChartView.hpp"
|
|
|
|
|
#include "panels/AnomalyTablePanel.hpp"
|
|
|
|
|
namespace geopro::app {
|
|
|
|
|
|
|
|
|
|
DatasetDetailPage::DatasetDetailPage(QWidget* parent) : QWidget(parent) {
|
|
|
|
|
auto* lay = new QVBoxLayout(this);
|
|
|
|
|
auto* bar = new QHBoxLayout();
|
|
|
|
|
auto* origin = new QToolButton(this); origin->setText("原数据"); origin->setCheckable(true);
|
|
|
|
|
auto* grid = new QToolButton(this); grid->setText("网格数据"); grid->setCheckable(true);
|
|
|
|
|
grid->setChecked(true);
|
|
|
|
|
auto* grp = new QButtonGroup(this); grp->setExclusive(true); grp->addButton(origin); grp->addButton(grid);
|
|
|
|
|
auto* showAnom = new QCheckBox("显示异常", this); showAnom->setChecked(true);
|
|
|
|
|
auto* showLines = new QCheckBox("显示等值线", this); showLines->setChecked(true);
|
|
|
|
|
bar->addWidget(origin); bar->addWidget(grid); bar->addStretch();
|
|
|
|
|
bar->addWidget(showAnom); bar->addWidget(showLines);
|
|
|
|
|
lay->addLayout(bar);
|
|
|
|
|
|
|
|
|
|
chart_ = new DatasetChartView(this);
|
|
|
|
|
anomalyTable_ = new AnomalyTablePanel(this);
|
|
|
|
|
lay->addWidget(chart_, 3);
|
|
|
|
|
lay->addWidget(anomalyTable_, 1);
|
|
|
|
|
|
|
|
|
|
connect(grid, &QToolButton::clicked, this, [this] { gridMode_ = true; showGridMode(); });
|
|
|
|
|
connect(origin, &QToolButton::clicked, this, [this] { gridMode_ = false; showScatterMode(); });
|
|
|
|
|
connect(showAnom, &QCheckBox::toggled, chart_, [this](bool on) { chart_->setShowAnomalies(on); });
|
|
|
|
|
connect(showLines, &QCheckBox::toggled, chart_, [this](bool on) {
|
|
|
|
|
chart_->setShowContourLines(on); if (gridMode_) showGridMode(); });
|
|
|
|
|
connect(anomalyTable_, &AnomalyTablePanel::hiddenChanged, chart_,
|
|
|
|
|
[this](const std::set<int>& h) { chart_->setHiddenAnomalies(h); });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DatasetDetailPage::setData(const geopro::controller::DatasetDetailController::ChartData& d) {
|
|
|
|
|
dsId_ = d.dsId; data_ = d;
|
|
|
|
|
chart_->setAnomalies(d.anomalies);
|
|
|
|
|
anomalyTable_->setAnomalies(d.anomalies, {}, {}); // 创建时间/备注可后续从 VO 补
|
|
|
|
|
if (gridMode_) showGridMode(); else showScatterMode();
|
|
|
|
|
}
|
|
|
|
|
void DatasetDetailPage::showGridMode() {
|
|
|
|
|
geopro::render::ContourOptions opt; // 默认 2x+smooth+simplify0.5
|
|
|
|
|
chart_->showContour(data_.grid, data_.gridScale, opt);
|
|
|
|
|
}
|
|
|
|
|
void DatasetDetailPage::showScatterMode() {
|
|
|
|
|
chart_->showScatter(data_.scatter, data_.scatterScale);
|
|
|
|
|
}
|
|
|
|
|
} // namespace geopro::app
|