You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
243 lines
6.9 KiB
C
243 lines
6.9 KiB
C
|
3 weeks ago
|
#ifndef NMWXTIMEDEPENDENTSKIN_H
|
||
|
|
#define NMWXTIMEDEPENDENTSKIN_H
|
||
|
|
|
||
|
|
#include <QDialog>
|
||
|
|
#include <QVector>
|
||
|
|
#include <QPair>
|
||
|
|
#include <QPainter>
|
||
|
|
#include <QPolygon>
|
||
|
|
|
||
|
|
#include "nmDataAnalyzeManager.h"
|
||
|
|
#include "nmDataWellBase.h"
|
||
|
|
#include "nmDataAttribute.h"
|
||
|
|
#include "nmDataPerforation.h"
|
||
|
|
|
||
|
|
class nmWxChartWidget;
|
||
|
|
class nmWxPressFlowChartWidget;
|
||
|
|
class QTableWidget;
|
||
|
|
class QTableWidgetItem;
|
||
|
|
class QPushButton;
|
||
|
|
class QCheckBox;
|
||
|
|
class QRadioButton;
|
||
|
|
class QComboBox;
|
||
|
|
class QLineEdit;
|
||
|
|
class QToolButton;
|
||
|
|
class QVBoxLayout;
|
||
|
|
class QHBoxLayout;
|
||
|
|
class QLabel;
|
||
|
|
|
||
|
|
class nmWxTimeDependentSkin : public QDialog
|
||
|
|
{
|
||
|
|
Q_OBJECT
|
||
|
|
|
||
|
|
public:
|
||
|
|
|
||
|
|
nmWxTimeDependentSkin(nmDataWellBase* pWellData, QWidget *parent = nullptr);
|
||
|
|
~nmWxTimeDependentSkin();
|
||
|
|
|
||
|
|
// 静态方法
|
||
|
|
static void showForCurrentWell(nmDataWellBase* pSpecificWellData = nullptr, QWidget* parent = nullptr);
|
||
|
|
|
||
|
|
private slots:
|
||
|
|
// 按钮点击事件
|
||
|
|
void onAddClicked();
|
||
|
|
void onRemoveClicked();
|
||
|
|
void onSplitStepsClicked();
|
||
|
|
void onComputeClicked();
|
||
|
|
void onSkinVsRateClicked();
|
||
|
|
void onPerforationClosingBtnClicked();
|
||
|
|
// 表格数据变化事件
|
||
|
|
void onTableDataChanged(int row, int column);
|
||
|
|
void onTableRowClicked(int row, int column);
|
||
|
|
// 确认和取消按钮
|
||
|
|
void onAccept();
|
||
|
|
void onReject();
|
||
|
|
|
||
|
|
// 右侧按钮槽函数
|
||
|
|
void onRightAddClicked();
|
||
|
|
void onRightInsertClicked();
|
||
|
|
void onRightDeleteClicked();
|
||
|
|
|
||
|
|
//表皮速率对比槽函数
|
||
|
|
void onFilterClicked();
|
||
|
|
void onResetFilterClicked();
|
||
|
|
void onResetLinesClicked();
|
||
|
|
|
||
|
|
void onSkinValuesChanged(double skin0Value, double dSkinDqValue);
|
||
|
|
void onFlowSegmentSelected(int segmentIndex);
|
||
|
|
void onChartPointClicked(double timePoint);
|
||
|
|
|
||
|
|
void onBoundaryMoved(int segmentIndex, double newTime);
|
||
|
|
void onSegmentsMerged(int segmentIndex);
|
||
|
|
void onSnapToRateChangesToggled(bool checked);
|
||
|
|
|
||
|
|
void onBoundaryMovedFinal(int segmentIndex, double newTime);
|
||
|
|
|
||
|
|
void loadSavedLinePositionsIfValid();
|
||
|
|
|
||
|
|
void onCrossMarksFiltered();
|
||
|
|
|
||
|
|
void onTimeUnitChanged(const QString &unit);
|
||
|
|
|
||
|
|
void onAddRateDependentToggled(bool checked);
|
||
|
|
void onDSdQUnitChanged(const QString& unit);
|
||
|
|
|
||
|
|
void onShowDatesToggled(bool checked);
|
||
|
|
|
||
|
|
void onPerforationChanged(int index);
|
||
|
|
|
||
|
|
private:
|
||
|
|
// 初始化UI
|
||
|
|
void initUI();
|
||
|
|
|
||
|
|
void reloadFromDataSource(nmDataWellBase* pSpecificWellData);
|
||
|
|
|
||
|
|
|
||
|
|
// 更新图表
|
||
|
|
void updateCharts();
|
||
|
|
|
||
|
|
void showInteractiveChart(); // 显示交互式图表
|
||
|
|
void restoreOriginalCharts(); // 恢复原始占位符
|
||
|
|
void initializeChartFromData();
|
||
|
|
|
||
|
|
void hideToolbarButtons(); // 隐藏工具栏按钮
|
||
|
|
void restoreToolbarState(); // 恢复工具栏状态
|
||
|
|
|
||
|
|
void createChartModeBtn(); // 创建表皮速率对比相关按钮
|
||
|
|
void createEditBoxes(); // 创建编辑框的方法
|
||
|
|
|
||
|
|
void updateEditBoxesFromData(); // 从数据更新编辑框显示
|
||
|
|
|
||
|
|
void ensureHeaderRowExists();
|
||
|
|
void createTimeUnitCombo();
|
||
|
|
void createDSdQUnitCombo();
|
||
|
|
|
||
|
|
// 处理流量数据,将时间间隔累加为绝对时间
|
||
|
|
QVector<QPointF> processFlowData(const QVector<QPointF>& rawFlowData);
|
||
|
|
|
||
|
|
void updateTableFromFlowSegments();
|
||
|
|
|
||
|
|
QIcon createTriangleIcon();
|
||
|
|
|
||
|
|
bool insertFlowSegmentAtMiddle(int segmentIndex);
|
||
|
|
|
||
|
|
void saveChartPositionsToData(); // 保存图表位置到数据对象
|
||
|
|
void loadChartPositionsFromData(); // 从数据对象加载图表位置
|
||
|
|
|
||
|
|
// ========== 流动段数据修改方法 ==========
|
||
|
|
void initializeDefaultFlowSegment();
|
||
|
|
void splitSelectedFlowSegment();
|
||
|
|
void selectFlowSegment(int segmentIndex);
|
||
|
|
void splitAllFlowSegments();
|
||
|
|
int splitFlowSegmentAtIndex(int segmentIndex);
|
||
|
|
bool addFlowSegmentAtTime(double timePoint);
|
||
|
|
bool addFlowSegmentAtExactTime(double timePoint);
|
||
|
|
bool splitFlowSegmentAtTime(int segmentIndex, double splitTime);
|
||
|
|
bool insertFlowSegmentBeforeSegment(int segmentIndex);
|
||
|
|
void addLastFlowSegmentIfMissing(bool snapToRateChanges);
|
||
|
|
bool mergeSegmentWithPrevious(int segmentIndex);
|
||
|
|
void snapAllBoundariesToFlowStepsAndMerge();
|
||
|
|
|
||
|
|
// 工具函数
|
||
|
|
double convertTime(double value, const QString& fromUnit, const QString& toUnit) const;
|
||
|
|
|
||
|
|
void refreshTableStructure(); // 根据是否启用“流量相关”重建表头/单位行
|
||
|
|
double convertDSdQ(double v, const QString& fromU, const QString& toU) const;
|
||
|
|
|
||
|
|
static double toSeconds(double value, const QString& unit);
|
||
|
|
static double fromSeconds(double sec, const QString& unit);
|
||
|
|
bool moveFlowSegmentBoundarySec(int segmentIndex, double newBoundarySec);
|
||
|
|
|
||
|
|
// SkinVsRate模式的状态保存和恢复
|
||
|
|
void saveStateBeforeSkinVsRate();
|
||
|
|
void restoreStateAfterSkinVsRate();
|
||
|
|
|
||
|
|
// 添加辅助方法
|
||
|
|
QString formatTimeDisplay(double timeInHours, int segmentIndex) const;
|
||
|
|
void updateTimeUnitComboVisibility();
|
||
|
|
|
||
|
|
private:
|
||
|
|
|
||
|
|
// UI 组件
|
||
|
|
QVBoxLayout* m_pMainLayout;
|
||
|
|
QHBoxLayout* m_pToolbarLayout;
|
||
|
|
QVBoxLayout* m_pChartLayout;
|
||
|
|
QSplitter* m_pChartSplitter;
|
||
|
|
|
||
|
|
// 工具栏按钮
|
||
|
|
QPushButton* m_pSkinVsRateBtn;
|
||
|
|
QPushButton* m_pAddBtn;
|
||
|
|
QPushButton* m_pRemoveBtn;
|
||
|
|
QPushButton* m_pSplitStepsBtn;
|
||
|
|
QPushButton* m_pComputeBtn;
|
||
|
|
QPushButton* m_pPerforationClosingBtn;
|
||
|
|
|
||
|
|
// 复选框
|
||
|
|
QCheckBox* m_pSnapToRateChangesCheckBox;
|
||
|
|
QCheckBox* m_pShowDatesCheckBox;
|
||
|
|
QCheckBox* m_pAddRateDependentCheckBox;
|
||
|
|
|
||
|
|
// 图表模式按钮
|
||
|
|
QWidget* m_pFilterContainer;
|
||
|
|
QWidget* m_pResetFilterContainer;
|
||
|
|
QWidget* m_pResetLinesContainer;
|
||
|
|
QPushButton* m_pFilterBtn;
|
||
|
|
QPushButton* m_pResetFilterBtn;
|
||
|
|
QPushButton* m_pResetLinesBtn;
|
||
|
|
|
||
|
|
// 编辑框
|
||
|
|
QWidget* m_pEditContainer;
|
||
|
|
QLineEdit* m_pSkinEdit;
|
||
|
|
QLineEdit* m_pDSkinDqEdit;
|
||
|
|
QLabel* m_pSkinLabel;
|
||
|
|
QLabel* m_pDSkinLabel;
|
||
|
|
|
||
|
|
// 图表组件
|
||
|
|
nmWxPressFlowChartWidget* m_pPressureChart;
|
||
|
|
nmWxPressFlowChartWidget* m_pFlowRateChart;
|
||
|
|
nmWxPressFlowChartWidget* m_pOriginalPressureChart;
|
||
|
|
nmWxPressFlowChartWidget* m_pOriginalFlowRateChart;
|
||
|
|
nmWxChartWidget* m_pChartWidget;
|
||
|
|
|
||
|
|
// 表格和按钮
|
||
|
|
QTableWidget* m_pDataTable;
|
||
|
|
QPushButton* m_pOkBtn;
|
||
|
|
QPushButton* m_pCancelBtn;
|
||
|
|
QPushButton* m_pRightAddBtn;
|
||
|
|
QPushButton* m_pRightInsertBtn;
|
||
|
|
QPushButton* m_pRightDeleteBtn;
|
||
|
|
|
||
|
|
// 下拉框
|
||
|
|
QComboBox* m_pComboBox;
|
||
|
|
|
||
|
|
QComboBox* m_pTimeUnitCombo; // 时间单位下拉框
|
||
|
|
QString m_timeDisplayUnit;
|
||
|
|
QComboBox* m_pDSdQUnitCombo; // 流量单位下拉框
|
||
|
|
QString m_dSdQDisplayUnit;
|
||
|
|
|
||
|
|
// 数据成员
|
||
|
|
nmDataWellBase* m_currentWell; // 当前井数据
|
||
|
|
nmDataPerforation m_perforationData; // 射孔段数据
|
||
|
|
int m_currentPerforationIndex; // 当前射孔段索引
|
||
|
|
|
||
|
|
QVector<QPointF> pressurePoints; // 压力数据
|
||
|
|
QVector<QPointF> flowPoints; // 处理后的流量数据
|
||
|
|
|
||
|
|
// 模式标志
|
||
|
|
bool m_isAddMode;
|
||
|
|
bool m_isRemoveMode;
|
||
|
|
bool m_hasPerformedInitialFit;
|
||
|
|
bool m_rateDependentState;
|
||
|
|
|
||
|
|
// 保存进入SkinVsRate模式前的完整数据状态
|
||
|
|
nmDataPerforation m_savedFlowSegmentData;
|
||
|
|
bool m_savedRateDependentState;
|
||
|
|
|
||
|
|
// 静态成员变量
|
||
|
|
static nmWxTimeDependentSkin* s_instance;
|
||
|
|
static QString s_currentWellName;
|
||
|
|
static nmDataWellBase* s_currentWellData;
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif // NMWXTIMEDEPENDENTSKIN_H
|