1、油藏边界的线段数据类;

feature/ribbon-menu-20240927
simonyan 1 month ago
parent a02ea2641e
commit 72bdad54ab

@ -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

@ -24,6 +24,7 @@ enum NM_TREE_TYPE {
TREE_Mesh, // 网格节点 TREE_Mesh, // 网格节点
TREE_Solve, // 求解节点 TREE_Solve, // 求解节点
TREE_Postprocessing,// 后处理节点 TREE_Postprocessing,// 后处理节点
TREE_UNKNOW, // 其它
}; };
// 结构树油藏子节点 // 结构树油藏子节点
enum NM_TREE_OIL_RESERVOIR_TYPE { enum NM_TREE_OIL_RESERVOIR_TYPE {
@ -32,6 +33,13 @@ enum NM_TREE_OIL_RESERVOIR_TYPE {
TREE_Oil_Reservoir_Fault, // 断层节点 TREE_Oil_Reservoir_Fault, // 断层节点
TREE_Oil_Reservoir_Crack, // 裂缝节点 TREE_Oil_Reservoir_Crack, // 裂缝节点
TREE_Oil_Reservoir_Region, // 区域节点 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, // 其它
}; };

@ -1,5 +1,6 @@
#include "nmDataOilReservoirOutline.h" #include "nmDataOilReservoirOutline.h"
#include "nmDefines.h" #include "nmDefines.h"
#include "nmDataOilReservoirOutlineLineSegment.h"
ZX_DEFINE_DYNAMIC(DataOilReservoirOutline, nmDataOilReservoirOutline) ZX_DEFINE_DYNAMIC(DataOilReservoirOutline, nmDataOilReservoirOutline)

@ -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;
}
Loading…
Cancel
Save