#include "ZxSerializer.h" #include "nmDataDemo.h" ZX_DEFINE_DYNAMIC(DataDemo, nmDataDemo) nmDataDemo::nmDataDemo() : ZxDataObjectDbl(0) { //m_sID = ""; m_sWellCode = ""; //m_sName = ""; m_dTopDepth = 0.00; m_dBottomDepth = 0.00; m_sRemark = ""; m_sCth = "ndd"; checkXmlTable(); } nmDataDemo::nmDataDemo(const nmDataDemo &other) : ZxDataObjectDbl(other) { if (this == &other) { return; } checkXmlTable(); //m_sID = other.m_sID; m_sWellCode = other.m_sWellCode; //m_sName = other.m_sName; m_dTopDepth = other.m_dTopDepth; m_dBottomDepth = other.m_dBottomDepth; } nmDataDemo::~nmDataDemo() { } nmDataDemo &nmDataDemo::operator = (const nmDataDemo &other) { //m_sID = other.m_sID; m_sWellCode = other.m_sWellCode; //m_sName = other.m_sName; m_dTopDepth = other.m_dTopDepth; m_dBottomDepth = other.m_dBottomDepth; return *this; } ZxDataObject* nmDataDemo::clone() { ensureLoaded(); return (new nmDataDemo(*this)); } QString nmDataDemo::type() const { return iDataModelType::sTypeNumDataDemo; } void nmDataDemo::setWellCode(const QString& s) { m_sWellCode = s; } QString nmDataDemo::getWellCode()const { ensureLoaded(); return m_sWellCode; } void nmDataDemo::setTopDepth(const double& d) { m_dTopDepth = d; } double nmDataDemo::getTopDepth()const { ensureLoaded(); return m_dTopDepth; } void nmDataDemo::setBottomDepth(const double& d) { m_dBottomDepth = d; } double nmDataDemo::getBottomDepth()const { ensureLoaded(); return m_dBottomDepth; } bool nmDataDemo::_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(); return ZxDataObjectDbl::_parseData(vec, n); } bool nmDataDemo::_sumUpData(VecVariant& vec) { ensureLoaded(); vec.append(m_sCode); vec.append(m_sWellCode); vec.append(m_sName); vec.append(m_dTopDepth); vec.append(m_dBottomDepth); return ZxDataObjectDbl::_sumUpData(vec); } void nmDataDemo::onSerialize(ZxSerializer* ser) { ZxDataObjectDbl::onSerialize(ser); ser->write("WellCode", m_sWellCode); ser->write("TopDepth", m_dTopDepth); ser->write("BottomDepth", m_dBottomDepth); } void nmDataDemo::onDeserialize(ZxSerializer* ser) { ZxDataObjectDbl::onDeserialize(ser); ser->read("WellCode", m_sWellCode); ser->read("TopDepth", m_dTopDepth); ser->read("BottomDepth", m_dBottomDepth); } QIcon nmDataDemo::getIcon(bool expanded) const { return zxLoadIcon("DataDemo"); }