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.
109 lines
4.9 KiB
C
109 lines
4.9 KiB
C
|
3 weeks ago
|
#ifndef NMWELLEDITORCONTROLLER_H
|
||
|
|
#define NMWELLEDITORCONTROLLER_H
|
||
|
|
|
||
|
|
#include <QObject>
|
||
|
|
#include "nmSubWxs_global.h"
|
||
|
|
|
||
|
|
#include <QPointF>
|
||
|
|
class QLineF;
|
||
|
|
|
||
|
|
#include <QMap>
|
||
|
|
#include <QPair>
|
||
|
|
|
||
|
|
// 自定义类前向声明
|
||
|
|
class nmDataWellBase;
|
||
|
|
class nmDataPerforation;
|
||
|
|
class nmWxWellboreTrajectoryDisplay;
|
||
|
|
|
||
|
|
// 控制器内部维护的当前模式状态
|
||
|
|
enum WellEditMode {
|
||
|
|
None, // 默认无操作模式
|
||
|
|
EditWellboreTrajectory, // 编辑井筒轨迹模式(包含井筒和裂缝编辑)
|
||
|
|
EditPerforation, // 编辑射孔模式
|
||
|
|
AddPerforation, // 添加射孔模式
|
||
|
|
DeletePerforation, // 删除射孔模式
|
||
|
|
SnapPerforation // 吸附模式
|
||
|
|
// ... 其他模式
|
||
|
|
};
|
||
|
|
|
||
|
|
// 编辑井控制器
|
||
|
|
class NM_SUB_WXS_EXPORT nmWellEditorController : public QObject
|
||
|
|
{
|
||
|
|
Q_OBJECT
|
||
|
|
public:
|
||
|
|
// 构造函数:接收模型和视图的引用
|
||
|
|
explicit nmWellEditorController(nmDataWellBase* pModel, nmWxWellboreTrajectoryDisplay* pView, QObject* parent = nullptr);
|
||
|
|
~nmWellEditorController();
|
||
|
|
|
||
|
|
private:
|
||
|
|
// 辅助函数:统一清理所有编辑模式(在控制器和视图中都关闭)
|
||
|
|
void clearAllEditModes();
|
||
|
|
// 辅助函数:设置新的模式,并通知视图更新 UI
|
||
|
|
void setMode(WellEditMode eNewMode);
|
||
|
|
|
||
|
|
public slots:
|
||
|
|
// --- 响应 nmWxWellboreTrajectoryDisplay (视图) 发出的模式请求信号 ---
|
||
|
|
void onRequestEditWellMode(int nCurrentViewId); // 请求编辑井筒/裂缝模式
|
||
|
|
void onRequestEditPerforationsMode(int nCurrentViewId); // 请求编辑射孔模式
|
||
|
|
void onRequestNewPerforationMode(int nCurrentViewId); // 请求添加射孔模式
|
||
|
|
void onRequestDeletePerforationMode(int nCurrentViewId); // 请求删除射孔模式
|
||
|
|
void onRequestSnapPerforationMode(int nCurrentViewId); // 请求吸附射孔模式
|
||
|
|
|
||
|
|
// --- 响应 nmWxWellboreTrajectoryDisplay (视图) 发出的视图切换信号 ---
|
||
|
|
void onViewChanged(int nNewViewId);
|
||
|
|
|
||
|
|
// 清理视图状态
|
||
|
|
void slotClearViewStates();
|
||
|
|
|
||
|
|
// 响应井筒点移动信号 (只在拖动结束时触发)
|
||
|
|
void slotWellboreTrajectoryPointMoved(const QPointF& newScenePos);
|
||
|
|
// 响应射孔移动信号 (只在拖动结束时触发)
|
||
|
|
void slotPerforationDragFinished(nmDataPerforation* pPerforationData, double proposedMdStart, double proposedMdEnd);
|
||
|
|
// 处理添加新射孔的请求
|
||
|
|
void slotTryAddNewPerforation(const QPointF& scenePos,
|
||
|
|
double fractureTopMd,
|
||
|
|
double fractureBottomMd,
|
||
|
|
const QLineF& wellboreVisualLine);
|
||
|
|
// 处理删除射孔数据的请求
|
||
|
|
void slotDeletePerforation(nmDataPerforation* pPerforationData);
|
||
|
|
// 接收裂缝几何变化信号的槽函数
|
||
|
|
void slotFractureGeometryChanged(double newHalfLength, double newAngle);
|
||
|
|
// 更新截面图下裂缝的高度信息
|
||
|
|
void slotHandleFractureRectUpdate(qreal newTopMD, qreal newBottomMD);
|
||
|
|
// 接收射孔更新,主要是垂直裂缝井截面图
|
||
|
|
void slotUpdatePerforations(const QMap<nmDataPerforation*, QPair<double, double>>& updatedPerforations);
|
||
|
|
// 更新裂缝半长(多段压裂水平井)
|
||
|
|
void slotUpdateFractureHalfLength(double newHalfLength);
|
||
|
|
// 更新井位置(多段压裂水平井)
|
||
|
|
void slotUpdateWellborePos(QPointF finalWellboreEndPos);
|
||
|
|
// 更新多段压裂水平井的裂缝位置
|
||
|
|
void slotHFWellFractureGeometryChanged(double newHeight, double newMidPointY);
|
||
|
|
|
||
|
|
private:
|
||
|
|
// 在直井上尝试添加射孔段
|
||
|
|
bool tryAddNewPerforationInVerticalWell(const QPointF& scenePos);
|
||
|
|
// 在垂直裂缝井上尝试添加射孔段
|
||
|
|
bool tryAddNewPerforationInVerticalFracturedWell(const QPointF& scenePos, const double& fractureTopMd, const double& fractureBottomMd);
|
||
|
|
// 在多段压裂水平井上尝试添加射孔段
|
||
|
|
bool tryAddNewPerforationInHorizontalFracturedWell(const QPointF& scenePos, const QLineF& wellboreVisualLine);
|
||
|
|
|
||
|
|
// 吸附射孔段到井筒上
|
||
|
|
void snapPerforationToWellbore();
|
||
|
|
|
||
|
|
// // --- 响应 QGraphicsItem 交互的细粒度槽函数 (来自 nmWxWellboreTrajectoryDisplay 内部发出的信号) ---
|
||
|
|
// void onWellborePointMoved(const QPointF& newScenePos); // 响应 nmWellborePointGraphicsItem::positionChanged
|
||
|
|
// void onFractureHalfLengthChanged(int fractureIndex, double newHalfLength, bool isDragging); // 响应裂缝半长拖拽
|
||
|
|
// void onPerforationMoved(nmDataPerforation* perf, double newMd, bool isDragging); // 响应射孔拖拽 (如果单个MD点)
|
||
|
|
// void onPerforationRangeChanged(nmDataPerforation* perf, double newStartMd, double newEndMd, bool isDragging); // 响应射孔范围拖拽
|
||
|
|
|
||
|
|
// // --- 响应鼠标在场景空白处点击的槽函数 (用于添加射孔等) ---
|
||
|
|
// void onSceneClickedForAddPerforation(const QPointF& scenePos); // 假设 nmWxWellboreTrajectoryDisplay 会发出此信号
|
||
|
|
|
||
|
|
private:
|
||
|
|
nmDataWellBase* m_pModel; // 数据模型引用
|
||
|
|
nmWxWellboreTrajectoryDisplay* m_pView; // 视图引用
|
||
|
|
WellEditMode m_eCurrentMode; // 当前编辑模式
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif // NMWELLEDITORCONTROLLER_H
|