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.
nmWATI/Src/nmNum/nmData/nmDataDemo.cpp

196 lines
3.9 KiB
C++

#include "ZxSerializer.h"
#include "nmDataDemo.h"
//#include "nmGuiPlot.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::s_instance = NULL;
nmDataDemo* nmDataDemo::getInstance()
{
if (NULL == s_instance) {
s_instance = new nmDataDemo();
}
return s_instance;
}
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 nmDataModelType::sTypeNumDataDemo;
}
QString nmDataDemo::getTableName()
{
// 返回表名,模型自行处理
return nmDataTableName::sTableNumDataDemo;
}
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;
}
void nmDataDemo::setAnalyzeName(const QString &newAnalyzeName)
{
m_sAnalyzeName = newAnalyzeName;
}
const QString &nmDataDemo::analyzeName() const
{
return m_sAnalyzeName;
}
void nmDataDemo::setAnalyzePVTIndex(int newAnalyzePVTIndex)
{
m_iAnalyzePVTIndex = newAnalyzePVTIndex;
}
int nmDataDemo::analyzePVTIndex() const
{
return m_iAnalyzePVTIndex;
}
int nmDataDemo::analyzeIIIndex() const
{
return m_iAnalyzeIIIndex;
}
void nmDataDemo::setAnalyzeIIIndex(int newAnalyzeIIIndex)
{
m_iAnalyzeIIIndex = newAnalyzeIIIndex;
}
const QList<NM_PHASE_TYPE> &nmDataDemo::analyzeMultiphase() const
{
return m_analyzeMultiphase;
}
void nmDataDemo::setAnalyzeMultiphase(const QList<NM_PHASE_TYPE> &newAnalyzeMultiphase)
{
m_analyzeMultiphase = newAnalyzeMultiphase;
}
void *nmDataDemo::getWxPlot() const
{
return m_pWxPlot;
}
void nmDataDemo::setWxPlot(void *newPWxPlot)
{
m_pWxPlot = newPWxPlot;
}
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");
}