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.
112 lines
4.2 KiB
C++
112 lines
4.2 KiB
C++
#include "ZxBaseUtil.h"
|
|
#include "zxLogInstance.h"
|
|
|
|
#include "ZxPlot.h"
|
|
#include "iGuiPlot.h"
|
|
|
|
#include "nmObjBase.h"
|
|
#include "nmObjPointTool.h"
|
|
#include "nmObjLineTool.h"
|
|
#include "nmObjPolygonTool.h"
|
|
#include "nmObjPolygonOutlineTool.h"
|
|
#include "nmObjLineCrackTool.h"
|
|
#include "nmObjLineFaultTool.h"
|
|
#include "nmObjPointWellTool.h"
|
|
|
|
#include "nmGuiPlot.h"
|
|
#include "nmGuiPlotCmdHelper.h"
|
|
|
|
#include "nmDataLogFile.h"
|
|
|
|
nmGuiPlotCmdHelper::nmGuiPlotCmdHelper(iGuiPlot* p)
|
|
: iGuiPlotCmdHelper(p)
|
|
{
|
|
}
|
|
|
|
nmGuiPlotCmdHelper::~nmGuiPlotCmdHelper()
|
|
{
|
|
}
|
|
|
|
bool nmGuiPlotCmdHelper::runAction(QString sAction)
|
|
{
|
|
Q_ASSERT (NULL != m_pGuiPlot);
|
|
ZxPlot* pPlot = m_pGuiPlot->m_pPlot;
|
|
Q_ASSERT (NULL != pPlot);
|
|
nmDataLogFile::getInstance()->writeLog(" cmdHelper " + sAction);
|
|
// 鼠标交互,插入数值试井绘图对象 的例子:点、线、多边形
|
|
if (_isSame(sAction, "nmInsertObjPoint")) {
|
|
nmObjToolBase* pObjTool = new nmObjPointTool();
|
|
Q_ASSERT (NULL != pObjTool);
|
|
pPlot->appendTools(pObjTool);
|
|
connect(pObjTool, SIGNAL(sigPtsFinished(QVector<QPointF>&)), \
|
|
this, SLOT(slotObjPtsFinished(QVector<QPointF>&)));
|
|
return true;
|
|
} else if (_isSame(sAction, "nmInsertObjPointWell")) {
|
|
nmObjToolBase* pObjTool = new nmObjPointWellTool();
|
|
nmDataLogFile::getInstance()->writeLog("in nmGuiPlotCmdHelper " + QString::number(pObjTool->getNOT()));
|
|
Q_ASSERT (NULL != pObjTool);
|
|
pPlot->appendTools(pObjTool);
|
|
connect(pObjTool, SIGNAL(sigPtsFinished(QVector<QPointF>&)), \
|
|
this, SLOT(slotObjPtsFinished(QVector<QPointF>&)));
|
|
return true;
|
|
} else if (_isSame(sAction, "nmInsertObjLine")) {
|
|
nmObjToolBase* pObjTool = new nmObjLineTool();
|
|
Q_ASSERT (NULL != pObjTool);
|
|
pPlot->appendTools(pObjTool);
|
|
connect(pObjTool, SIGNAL(sigPtsFinished(QVector<QPointF>&)), \
|
|
this, SLOT(slotObjPtsFinished(QVector<QPointF>&)));
|
|
return true;
|
|
} else if (_isSame(sAction, "nmInsertObjPolygon")) {
|
|
nmObjToolBase* pObjTool = new nmObjPolygonTool();
|
|
Q_ASSERT (NULL != pObjTool);
|
|
pPlot->appendTools(pObjTool);
|
|
connect(pObjTool, SIGNAL(sigPtsFinished(QVector<QPointF>&)), \
|
|
this, SLOT(slotObjPtsFinished(QVector<QPointF>&)));
|
|
return true;
|
|
} else if (_isSame(sAction, "nmInsertObjPolygonOutline")) {
|
|
nmObjToolBase* pObjTool = new nmObjPolygonOutlineTool();
|
|
Q_ASSERT (NULL != pObjTool);
|
|
pPlot->appendTools(pObjTool);
|
|
connect(pObjTool, SIGNAL(sigPtsFinished(QVector<QPointF>&)), \
|
|
this, SLOT(slotObjPtsFinished(QVector<QPointF>&)));
|
|
return true;
|
|
} else if (_isSame(sAction, "nmInsertObjLineCrack")) {
|
|
nmObjToolBase* pObjTool = new nmObjLineCrackTool();
|
|
nmDataLogFile::getInstance()->writeLog("in nmGuiPlotCmdHelper " + QString::number(pObjTool->getNOT()));
|
|
Q_ASSERT (NULL != pObjTool);
|
|
pPlot->appendTools(pObjTool);
|
|
connect(pObjTool, SIGNAL(sigPtsFinished(QVector<QPointF>&)), \
|
|
this, SLOT(slotObjPtsFinished(QVector<QPointF>&)));
|
|
return true;
|
|
} else if (_isSame(sAction, "nmInsertObjLineFault")) {
|
|
nmObjToolBase* pObjTool = new nmObjLineFaultTool();
|
|
nmDataLogFile::getInstance()->writeLog("in nmGuiPlotCmdHelper " + QString::number(pObjTool->getNOT()));
|
|
Q_ASSERT (NULL != pObjTool);
|
|
pPlot->appendTools(pObjTool);
|
|
connect(pObjTool, SIGNAL(sigPtsFinished(QVector<QPointF>&)), \
|
|
this, SLOT(slotObjPtsFinished(QVector<QPointF>&)));
|
|
return true;
|
|
} else {
|
|
// 其它Action
|
|
}
|
|
return iGuiPlotCmdHelper::runAction(sAction);
|
|
}
|
|
|
|
void nmGuiPlotCmdHelper::slotObjPtsFinished(QVector<QPointF>& vec)
|
|
{
|
|
nmObjToolBase* pTool = dynamic_cast<nmObjToolBase*>(sender());
|
|
if (NULL == pTool) {
|
|
return;
|
|
}
|
|
nmGuiPlot* pWxPlot = dynamic_cast<nmGuiPlot*>(m_pGuiPlot);
|
|
if (NULL == pWxPlot) {
|
|
return;
|
|
}
|
|
ZxPlot* pPlot = pWxPlot->m_pPlot;
|
|
Q_ASSERT (NULL != pPlot);
|
|
pPlot->removeTools(pTool); // 移除Tool
|
|
QString sName = tr("nmObj");
|
|
nmObjBase* pObj = pWxPlot->appendOneObj(pTool->getNOT(), sName, vec);
|
|
pObj->afterCreated();
|
|
}
|