#include #include #include "IxPtyPano.h" #include "ZxSubAxisX.h" #include "ZxSubAxisY.h" #include "ZxPlot.h" #include "ZxObjText.h" #include "nmObjPointWellTool.h" #include "nmObjPointWell.h" ZX_DEFINE_DYNAMIC(nObjPointWell, nmObjPointWell) nmObjPointWell::nmObjPointWell() { init("", NULL, NULL); } nmObjPointWell::nmObjPointWell(const QString& sName, \ ZxSubAxisX* pAxisX, \ ZxSubAxisY* pAxisY) : nmObjPoint(sName, pAxisX, pAxisY) { init(sName, pAxisX, pAxisY); } nmObjPointWell::~nmObjPointWell() { } void nmObjPointWell::init(const QString& sName, \ ZxSubAxisX* pAxisX, \ ZxSubAxisY* pAxisY) { m_sObjTag = "nObjPointWell"; nmObjBase::init(sName, pAxisX, pAxisY); initFlags(); m_oDot = ZxDot(DTS_DownTriangle, QColor(255, 0, 0, 125), 1.f, true); m_sDesc = ""; m_bShowSubObjs = true; m_oDot = ZxDot(DTS_Circle, QColor(0, 255, 0), 1.5f, true); m_clrFillUnvalid = QColor(0, 255, 255); m_clrOuter = QColor(255, 0, 0); m_vecPoints << QPointF(0.f, 0.f); loadTempl(); } void nmObjPointWell::initTools() { m_pTool = new nmObjPointWellTool(); nmObjBase::initTools(); } void nmObjPointWell::initFlags() { // TODO,如果是选择的井,则位置和大小都不能动,设置为true setLockPos(false); setLockSize(false); setReadOnly(false); } void nmObjPointWell::initSubObjs() { // nmObjPoint::initSubObjs(); ZxPlot* pPlot = dynamic_cast(this->getParent()); if (NULL != pPlot) { QString sName = ""; ZxObjBase* p = pPlot->addOneObj(POT_Text, sName, false, \ m_pAxisX, m_pAxisY); appendSubObjs(p); ZxObjText* pBoundText = dynamic_cast(p); Q_ASSERT (NULL != pBoundText); pBoundText->setFrameVisible(false); QColor clr = QColor(255, 255, 255, 64); pBoundText->setBackgroundColor(clr); pBoundText->setReadOnly(true); int n = Qt::AlignHCenter | Qt::AlignVCenter; pBoundText->setAlignFlag(n); pBoundText->setFont(QFont("Times", 8)); pBoundText->deselect(true); pBoundText->deselectOthers(); pBoundText->setText(tr("PointWell")); } } void nmObjPointWell::setPointTag(QString s) { nmObjPoint::setPointTag(s); } void nmObjPointWell::onSerialize(ZxSerializer* ser) { nmObjBase::onSerialize(ser); ser->write("PDesc", m_sDesc); ser->write("ClrFillUnvalid", m_clrFillUnvalid); ser->write("ClrOuter", m_clrOuter); } void nmObjPointWell::onDeserialize(ZxSerializer* ser) { nmObjBase::onDeserialize(ser); ser->read("PDesc", m_sDesc); ser->read("ClrFillUnvalid", m_clrFillUnvalid); ser->read("ClrOuter", m_clrOuter); } void nmObjPointWell::onSaveTempl(ZxSerializer* ser) { nmObjBase::onSaveTempl(ser); ser->write("PDesc", m_sDesc); ser->write("ClrFillUnvalid", m_clrFillUnvalid); ser->write("ClrOuter", m_clrOuter); } void nmObjPointWell::onLoadTempl(ZxSerializer* ser) { nmObjBase::onLoadTempl(ser); ser->read("PDesc", m_sDesc); ser->read("ClrFillUnvalid", m_clrFillUnvalid); ser->read("ClrOuter", m_clrOuter); }