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/nmReservoirPropertiesSession.h

99 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 "nmReservoirPropertiesDataSource.h"
#include "nmReservoirParameterCatalog.h"
#include <QMap>
#include <QVariant>
class nmAttrRegistry;
/**
* @brief 储层参数编辑会话。
* @note 会话持有独立工作副本和独立属性注册表;取消时直接销毁会话即可。
*/
class NM_SUB_WXS_EXPORT nmReservoirPropertiesSession
{
public:
/**
* @brief 构造编辑会话。
* @param pDataSource 参数数据源,不转移所有权。
*/
explicit nmReservoirPropertiesSession(nmIReservoirPropertiesDataSource* pDataSource);
/** @brief 析构编辑会话及其独立注册表。 */
~nmReservoirPropertiesSession();
/**
* @brief 从数据源创建原始快照和工作副本。
* @param sError 输出的错误信息。
* @return 初始化成功返回true。
*/
bool initialize(QString& sError);
/**
* @brief 获取指定分类的对象描述。
* @param eCategory 页面分类。
* @return 对象描述列表。
*/
QList<nmReservoirPropertyObjectInfo> objectInfos(
nmReservoirPropertiesCategory eCategory);
/**
* @brief 获取工作副本中的参数值。
* @param sParameterId 稳定参数ID。
* @return 参数值不存在时返回无效QVariant。
*/
QVariant value(const QString& sParameterId) const;
/**
* @brief 修改工作副本中的参数值。
* @param sParameterId 稳定参数ID。
* @param oValue 基准单位下的新值。
* @return 参数存在并完成修改时返回true。
*/
bool setValue(const QString& sParameterId, const QVariant& oValue);
/**
* @brief 批量修改工作副本中的参数值。
* @param mapValues 稳定参数ID到基准值的映射。
*/
void setValues(const QMap<QString, QVariant>& mapValues);
/**
* @brief 获取枚举参数的稳定code。
* @param sParameterId 稳定枚举参数ID。
* @return 稳定业务code。
*/
QString enumCode(const QString& sParameterId) const;
/**
* @brief 修改枚举参数的稳定code。
* @param sParameterId 稳定枚举参数ID。
* @param sCode 稳定业务code。
* @return 修改成功返回true。
*/
bool setEnumCode(const QString& sParameterId, const QString& sCode);
/**
* @brief 提交工作副本。
* @param sError 输出的错误信息。
* @return 提交成功返回true。
*/
bool commit(QString& sError);
/** @brief 获取只读工作副本,供后续导入预览或测试使用。 */
const nmReservoirPropertiesSnapshot& workingSnapshot() const;
private:
/** @brief 判断井坐标或几何参数是否发生变化。 */
bool isGeometryChanged() const;
nmIReservoirPropertiesDataSource* m_pDataSource; ///< 参数数据源,不拥有所有权。
nmAttrRegistry* m_pAttrRegistry; ///< 编辑会话独占的属性注册表。
nmReservoirPropertiesSnapshot m_oOriginalSnapshot; ///< 打开对话框时的原始快照。
nmReservoirPropertiesSnapshot m_oWorkingSnapshot; ///< 所有界面编辑写入的工作副本。
bool m_bInitialized; ///< 会话是否初始化成功。
};