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.
nmWTAI-Platform/Include/nmNum/nmSubWxs/nmWellEditorSession.h

84 lines
3.2 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#include "nmSubWxs_global.h"
#include "nmDefines.h"
#include "nmPlotDialogContextProvider.h"
#include <QMap>
#include <QString>
class nmDataWellBase;
/**
* @brief 编辑井工作会话。
* @note 会话独占各井型工作副本,取消时销毁会话即可回滚全部编辑。
*/
class NM_SUB_WXS_EXPORT nmWellEditorSession
{
public:
/** @brief 创建仅持有编辑上下文副本的会话,尚不克隆原始井。 */
explicit nmWellEditorSession(const nmWellEditContext& oContext);
/** @brief 销毁所有未转移的井型工作副本。 */
~nmWellEditorSession();
/** @brief 从原始井创建当前井型工作副本。 */
bool initialize(QString& sError);
/** @brief 返回当前井型工作副本,不转移所有权。 */
nmDataWellBase* currentWell() const;
/** @brief 返回当前工作井型。 */
NM_WELL_MODEL currentWellType() const;
/** @brief 切换到指定井型并恢复或创建对应缓存。 */
bool switchWellType(NM_WELL_MODEL eWellType, QString& sError);
/** @brief 同步所有井型缓存中的井名。 */
void setWellName(const QString& sWellName);
/** @brief 设置当前工作副本的时间变表皮状态。 */
void setTimeDependentSkin(bool bEnabled);
/** @brief 返回用于井名唯一性校验的其他井名称。 */
QStringList otherWellNames() const;
/**
* @brief 转移最终工作副本所有权。
* @return 当前井型副本;调用者接管所有权,会话不再删除该对象。
*/
nmDataWellBase* takeModifiedWell();
private:
/** @brief 创建带有目标井型业务默认值的新井对象。 */
nmDataWellBase* createWell(NM_WELL_MODEL eWellType) const;
/** @brief 从已有缓存中查找与目标井型射孔语义兼容的工作副本。 */
nmDataWellBase* findCompatiblePerforationSource(
NM_WELL_MODEL eTargetType) const;
/** @brief 用共享字段和兼容的射孔业务数据初始化目标井。 */
bool initializeWorkingWell(nmDataWellBase* pSharedSource,
nmDataWellBase* pPerforationSource,
nmDataWellBase* pTarget) const;
/** @brief 白名单复制跨井型语义一致的数据,不复制井型专属几何。 */
bool copySharedWellData(nmDataWellBase* pSource,
nmDataWellBase* pTarget) const;
/**
* @brief 深拷贝射孔业务数据并将MD映射到目标井筒范围。
* @note 仅用于射孔语义兼容的垂直井族,目标默认井长保持不变。
*/
void migratePerforationData(nmDataWellBase* pSource,
nmDataWellBase* pTarget) const;
/** @brief 根据目标井当前参数重新生成裂缝等派生数据。 */
void rebuildDerivedGeometry(nmDataWellBase* pWell) const;
nmWellEditContext m_oContext; ///< 只读编辑上下文。
QMap<int, nmDataWellBase*> m_mapWorkingWells; ///< 各井型独立工作副本。
int m_nCurrentWellType; ///< 当前井型枚举值。
bool m_bInitialized; ///< 会话是否初始化完成。
};