#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; }