geopro/src/app/ContourLevelDialog.hpp

59 lines
2.6 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 "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