From 72bdad54ab624959c4e6564a7b93c48105ff7a0d Mon Sep 17 00:00:00 2001 From: simonyan <315082291@qq.com> Date: Fri, 11 Oct 2024 11:43:45 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=B2=B9=E8=97=8F=E8=BE=B9=E7=95=8C?= =?UTF-8?q?=E7=9A=84=E7=BA=BF=E6=AE=B5=E6=95=B0=E6=8D=AE=E7=B1=BB=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nmDataOilReservoirOutlineLineSegment.h | 50 +++++++ Include/nmNum/nmData/nmDefines.h | 18 ++- .../nmData/nmDataOilReservoirOutline.cpp | 1 + .../nmDataOilReservoirOutlineLineSegment.cpp | 135 ++++++++++++++++++ 4 files changed, 199 insertions(+), 5 deletions(-) create mode 100644 Include/nmNum/nmData/nmDataOilReservoirOutlineLineSegment.h create mode 100644 Src/nmNum/nmData/nmDataOilReservoirOutlineLineSegment.cpp diff --git a/Include/nmNum/nmData/nmDataOilReservoirOutlineLineSegment.h b/Include/nmNum/nmData/nmDataOilReservoirOutlineLineSegment.h new file mode 100644 index 0000000..41cd3aa --- /dev/null +++ b/Include/nmNum/nmData/nmDataOilReservoirOutlineLineSegment.h @@ -0,0 +1,50 @@ +#ifndef NMDATAOILRESERVOIROUTLINELINESEGMENT_H +#define NMDATAOILRESERVOIROUTLINELINESEGMENT_H + +#include "nmData_global.h" +// 以Dbl为结尾的类,字符串扩展字段是Float +// 以Str为结尾的类,字符串扩展字段是Nvarchar +#include "ZxDataObjectDbl.h" +#include "nmDefines.h" + +class NM_DATA_EXPORT nmDataOilReservoirOutlineLineSegment : public ZxDataObjectDbl +{ + ZX_DECLARE_DYNAMIC +public: + nmDataOilReservoirOutlineLineSegment(); + nmDataOilReservoirOutlineLineSegment(const nmDataOilReservoirOutlineLineSegment &other); + virtual ~nmDataOilReservoirOutlineLineSegment(); + nmDataOilReservoirOutlineLineSegment &operator = (const nmDataOilReservoirOutlineLineSegment &other); + +public: + // 接口 + virtual ZxDataObject* clone(); + virtual QString type() const; + // 表名 + virtual QString getTableName(); + // 加载保存(数据库部分) + virtual bool _parseData(VecVariant vec, int& n); + virtual bool _sumUpData(VecVariant& vec); + + // 序列化(统一序列化为大字段时的处理) + virtual void onSerialize(ZxSerializer* ser); + virtual void onDeserialize(ZxSerializer* ser); + + // Icon + virtual QIcon getIcon(bool expanded) const; + void setFlowType(NM_OIL_RESERVOIR_OUTLINE_TYPE newFlowType); + NM_OIL_RESERVOIR_OUTLINE_TYPE flowType() const; + + // 设置起点和终点 + void setPoints(QPointF startPoint, QPointF endPoint); + +private: + // 起点 + QPointF m_startPoint; + // 终点 + QPointF m_endPoint; + // 边界端的类型:定压 | 封闭 + NM_OIL_RESERVOIR_OUTLINE_TYPE m_flowType; +}; + +#endif // NMDATAOILRESERVOIROUTLINELINESEGMENT_H diff --git a/Include/nmNum/nmData/nmDefines.h b/Include/nmNum/nmData/nmDefines.h index 9b93ee8..38f658a 100644 --- a/Include/nmNum/nmData/nmDefines.h +++ b/Include/nmNum/nmData/nmDefines.h @@ -24,14 +24,22 @@ enum NM_TREE_TYPE { TREE_Mesh, // 网格节点 TREE_Solve, // 求解节点 TREE_Postprocessing,// 后处理节点 + TREE_UNKNOW, // 其它 }; // 结构树油藏子节点 enum NM_TREE_OIL_RESERVOIR_TYPE { - TREE_Oil_Reservoir_Outline, // 边界节点 - TREE_Oil_Reservoir_Well, // 井节点 - TREE_Oil_Reservoir_Fault, // 断层节点 - TREE_Oil_Reservoir_Crack, // 裂缝节点 - TREE_Oil_Reservoir_Region, // 区域节点 + TREE_Oil_Reservoir_Outline, // 边界节点 + TREE_Oil_Reservoir_Well, // 井节点 + TREE_Oil_Reservoir_Fault, // 断层节点 + TREE_Oil_Reservoir_Crack, // 裂缝节点 + TREE_Oil_Reservoir_Region, // 区域节点 + TREE_Oil_Reservoir_Region_UNKNOW, // 其它 +}; +// 油藏边界类型 +enum NM_OIL_RESERVOIR_OUTLINE_TYPE { + OIL_Reservoir_Outline_No_Flow, // 封闭 + OIL_Reservoir_Outline_Constant_Pressure, // 定压 + OIL_Reservoir_Outline_UNKNOW, // 其它 }; diff --git a/Src/nmNum/nmData/nmDataOilReservoirOutline.cpp b/Src/nmNum/nmData/nmDataOilReservoirOutline.cpp index 7cb4e34..6064498 100644 --- a/Src/nmNum/nmData/nmDataOilReservoirOutline.cpp +++ b/Src/nmNum/nmData/nmDataOilReservoirOutline.cpp @@ -1,5 +1,6 @@ #include "nmDataOilReservoirOutline.h" #include "nmDefines.h" +#include "nmDataOilReservoirOutlineLineSegment.h" ZX_DEFINE_DYNAMIC(DataOilReservoirOutline, nmDataOilReservoirOutline) diff --git a/Src/nmNum/nmData/nmDataOilReservoirOutlineLineSegment.cpp b/Src/nmNum/nmData/nmDataOilReservoirOutlineLineSegment.cpp new file mode 100644 index 0000000..f811160 --- /dev/null +++ b/Src/nmNum/nmData/nmDataOilReservoirOutlineLineSegment.cpp @@ -0,0 +1,135 @@ +#include "nmDataOilReservoirOutlineLineSegment.h" +#include "nmDefines.h" +#include "ZxSerializer.h" + +ZX_DEFINE_DYNAMIC(DataOilReservoirOutlineLineSegment, nmDataOilReservoirOutlineLineSegment) + +nmDataOilReservoirOutlineLineSegment::nmDataOilReservoirOutlineLineSegment(): ZxDataObjectDbl(0) +{ + //m_sID = ""; +// m_sWellCode = ""; + //m_sName = ""; +// m_dTopDepth = 0.00; +// m_dBottomDepth = 0.00; + m_sRemark = ""; + m_sCth = "nmDOROLS"; + // 默认是封闭 + m_flowType = NM_OIL_RESERVOIR_OUTLINE_TYPE::OIL_Reservoir_Outline_No_Flow; + checkXmlTable(); +} + +nmDataOilReservoirOutlineLineSegment::nmDataOilReservoirOutlineLineSegment(const nmDataOilReservoirOutlineLineSegment &other) + : ZxDataObjectDbl(other) +{ + if (this == &other) { + return; + } + checkXmlTable(); + m_startPoint = other.m_startPoint; + m_endPoint = other.m_endPoint; + m_flowType = other.m_flowType; + //m_sID = other.m_sID; +} + +nmDataOilReservoirOutlineLineSegment::~nmDataOilReservoirOutlineLineSegment() +{ +} + +nmDataOilReservoirOutlineLineSegment &nmDataOilReservoirOutlineLineSegment::operator = (const nmDataOilReservoirOutlineLineSegment &other) +{ + //m_sID = other.m_sID; + m_startPoint = other.m_startPoint; + m_endPoint = other.m_endPoint; + m_flowType = other.m_flowType; + return *this; +} + +ZxDataObject* nmDataOilReservoirOutlineLineSegment::clone() +{ + ensureLoaded(); + return (new nmDataOilReservoirOutlineLineSegment(*this)); +} + +QString nmDataOilReservoirOutlineLineSegment::type() const +{ + return nmDataModelType::sTypeNumDataExample; +} + +QString nmDataOilReservoirOutlineLineSegment::getTableName() +{ + // 返回表名,模型自行处理 + return nmDataTableName::sTableNumDataExample; +} + +bool nmDataOilReservoirOutlineLineSegment::_parseData(VecVariant vec, int& n) +{ + m_sCode = vec.at(n++).toString(); +// m_sWellCode = vec.at(n++).toString(); + m_sName = vec.at(n++).toString(); +// m_dTopDepth = vec.at(n++).toDouble(); +// m_dBottomDepth = vec.at(n++).toDouble(); + m_startPoint = vec.at(n++).toPointF(); + m_endPoint = vec.at(n++).toPointF(); + m_flowType = (NM_OIL_RESERVOIR_OUTLINE_TYPE)vec.at(n++).toInt(); + return ZxDataObjectDbl::_parseData(vec, n); +} + +bool nmDataOilReservoirOutlineLineSegment::_sumUpData(VecVariant& vec) +{ + ensureLoaded(); + vec.append(m_sCode); +// vec.append(m_sWellCode); + vec.append(m_sName); +// vec.append(m_dTopDepth); +// vec.append(m_dBottomDepth); + vec.append(m_startPoint); + vec.append(m_endPoint); + vec.append((int)m_flowType); + return ZxDataObjectDbl::_sumUpData(vec); +} + +void nmDataOilReservoirOutlineLineSegment::onSerialize(ZxSerializer* ser) +{ + ZxDataObjectDbl::onSerialize(ser); +// ser->write("WellCode", m_sWellCode); +// ser->write("TopDepth", m_dTopDepth); +// ser->write("BottomDepth", m_dBottomDepth); + ser->write("StartPoint", m_startPoint); + ser->write("EndPoint", m_endPoint); + int flowType = m_flowType; + ser->write("FlowType", flowType); +} + +void nmDataOilReservoirOutlineLineSegment::onDeserialize(ZxSerializer* ser) +{ + ZxDataObjectDbl::onDeserialize(ser); +// ser->read("WellCode", m_sWellCode); +// ser->read("TopDepth", m_dTopDepth); +// ser->read("BottomDepth", m_dBottomDepth); + ser->read("StartPoint", m_startPoint); + ser->read("EndPoint", m_endPoint); + int flowType = m_flowType; + ser->read("FlowType", flowType); + m_flowType = (NM_OIL_RESERVOIR_OUTLINE_TYPE)flowType; +} + +QIcon nmDataOilReservoirOutlineLineSegment::getIcon(bool expanded) const +{ + return zxLoadIcon("DataExample"); +} + +void nmDataOilReservoirOutlineLineSegment::setFlowType(NM_OIL_RESERVOIR_OUTLINE_TYPE newFlowType) +{ + m_flowType = newFlowType; +} + +NM_OIL_RESERVOIR_OUTLINE_TYPE nmDataOilReservoirOutlineLineSegment::flowType() const +{ + return m_flowType; +} + +void nmDataOilReservoirOutlineLineSegment::setPoints(QPointF startPoint, QPointF endPoint) +{ + m_startPoint = startPoint; + m_endPoint = endPoint; +}