59 lines
2.6 KiB
C++
59 lines
2.6 KiB
C++
#pragma once
|
||
#include <QDialog>
|
||
|
||
#include "ContourLevels.hpp" // ContourLevelParams(纯数据,与算法同源)
|
||
|
||
class QComboBox;
|
||
class QLabel;
|
||
class QLineEdit;
|
||
class QWidget;
|
||
|
||
namespace geopro::app {
|
||
|
||
// 层级⚙ 子对话框(复刻 contourLevel.vue):分层方式 normal/logarithmic/equalArea,
|
||
// 最大/最小等值线,normal 下「间隔数↔层数」双向联动,对数/等积各自参数,恢复默认,
|
||
// 确定时按原版校验(max>min、间隔>0、层数≤50、对数 max>0/min≥0、等积 count>0)。
|
||
// 只产出参数;层级的实际重算 + 颜色插值由 ColorScaleConfigDialog 完成。
|
||
class ContourLevelDialog : public QDialog {
|
||
Q_OBJECT
|
||
public:
|
||
// init:当前层级状态(来自主表);originMin/Max:数据原始范围(仅展示+恢复默认用);
|
||
// totalArea:等积「区间面积」展示用的分母总量(3D 体取样本数,无则给原版默认 1000)。
|
||
ContourLevelDialog(const ContourLevelParams& init, double originMin, double originMax,
|
||
double totalArea, QWidget* parent = nullptr);
|
||
|
||
ContourLevelParams params() const { return result_; } // accept() 后有效
|
||
|
||
private:
|
||
void updateVisibility(); // 仅按分层方式显隐各行(不触发重算)
|
||
void onMethodChanged(); // 用户切换方式:显隐 + normal 下按层数刷间隔
|
||
void recalcLayerCountFromInterval(); // normal:层数 = ceil((max-min)/间隔)
|
||
void recalcIntervalFromLayerCount(); // normal:间隔 = (max-min)/层数
|
||
void updateIntervalArea(); // equalArea:区间面积 = totalArea/层数
|
||
void onReset();
|
||
void onAccept(); // 校验后填 result_ 并 accept
|
||
|
||
double parsed(const QLineEdit* e, double fallback) const;
|
||
|
||
QComboBox* methodCombo_ = nullptr;
|
||
QWidget* rangeRow_ = nullptr; // 最大/最小(equalArea 时隐藏)
|
||
QLineEdit* minEdit_ = nullptr;
|
||
QLineEdit* maxEdit_ = nullptr;
|
||
QWidget* normalRow_ = nullptr; // 间隔数 + 层数
|
||
QLineEdit* intervalEdit_ = nullptr;
|
||
QLineEdit* layerCountEdit_ = nullptr;
|
||
QWidget* logRow_ = nullptr; // 对数:次要等值线数
|
||
QLineEdit* logLinesEdit_ = nullptr;
|
||
QWidget* equalAreaRow_ = nullptr; // 等积:层数 + 区间面积
|
||
QLineEdit* equalAreaCountEdit_ = nullptr;
|
||
QLabel* intervalAreaLabel_ = nullptr;
|
||
|
||
double originMin_ = 0.0;
|
||
double originMax_ = 1.0;
|
||
double totalArea_ = 1000.0;
|
||
bool autoUpdating_ = false; // 防双向联动无限递归(复刻 isAutoUpdating)
|
||
ContourLevelParams result_;
|
||
};
|
||
|
||
} // namespace geopro::app
|