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/nmPlot/nmObjPointWell.cpp

124 lines
3.2 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include <QPainter>
#include <ZxSerializer.h>
#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<ZxPlot*>(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<ZxObjText*>(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);
}