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

58 lines
2.0 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 <QDialog>
#include <QJsonArray>
#include <QString>
#include <vector>
class QComboBox;
class QLineEdit;
class QSpinBox;
class QTableWidget;
class QPushButton;
class QVBoxLayout;
namespace geopro::data {
class IDatasetCommandRepository;
}
namespace geopro::app {
// 自动标注对话框I13复刻原版 AutoAnnotationDialog
// 左:规则列表(阈值模式 数值/百分位、min/max、最小点数、异常类型
// 执行 → executeExceptionMark(预演) → 预览表;确定保存 → batchCreateException → reloadGrid。
// 异常类型仅支持面/polygon原版同故 listExceptionTypes 取 remarkSourceType="3"。
class AutoAnnotationDialog : public QDialog {
Q_OBJECT
public:
AutoAnnotationDialog(geopro::data::IDatasetCommandRepository* repo, QString dsObjectId,
QString projectId, QWidget* parent = nullptr);
private:
struct RuleRow {
QComboBox* mode = nullptr; // 1 数值 / 2 百分位
QLineEdit* min = nullptr;
QLineEdit* max = nullptr;
QSpinBox* minPoints = nullptr;
QComboBox* type = nullptr; // userData = 异常类型 id
};
void loadExceptionTypes(); // 拉面异常类型(填充所有规则行下拉)
void addRule(); // 加一条规则卡片
QJsonArray buildRuleList() const; // 组装 exceptionMarkRuleList
void onExecute(); // executeExceptionMark → 预览
void onSave(); // batchCreateException
geopro::data::IDatasetCommandRepository* repo_ = nullptr;
QString dsObjectId_;
QString projectId_;
QVBoxLayout* ruleHost_ = nullptr;
std::vector<RuleRow> rules_;
QJsonArray exceptionTypeOptions_; // 缓存的类型列表({id,name}),新增规则行复用
QTableWidget* previewTable_ = nullptr;
QJsonArray previewExceptions_; // execute 返回的预览异常confirm 时批量存)
QPushButton* saveBtn_ = nullptr;
};
} // namespace geopro::app