1、完成从菜单栏进行绘制井、边界、断层、裂缝的功能;

feature/ribbon-menu-20240927
simonyan 4 weeks ago
parent c6a75af079
commit c99a1ca616

File diff suppressed because one or more lines are too long

@ -115,12 +115,12 @@
<!-- 数值试井相关功能 --> <!-- 数值试井相关功能 -->
<Btn ID="700" Name="nmInsertObjPoint" Text="" CheckMode="0" Icon="InsertPoint" Tips="[样例]插入点" /> <Btn ID="700" Name="nmInsertObjPoint" Text="" CheckMode="0" Icon="InsertPoint" Tips="[样例]插入点" />
<Btn ID="701" Name="nmInsertObjLine" Text="" CheckMode="0" Icon="InsertLine" Tips="[样例]插入线" /> <Btn ID="701" Name="nmInsertObjPointWell" Text="" CheckMode="0" Icon="InsertPoint" Tips="油井" />
<Btn ID="702" Name="nmInsertObjPolygon" Text="" CheckMode="0" Icon="InsertPolygon" Tips="[样例]插入多边形" /> <Btn ID="702" Name="nmInsertObjLine" Text="" CheckMode="0" Icon="InsertLine" Tips="[样例]插入线" />
<Btn ID="703" Name="nmInsertObjPolygonOutline" Text="" CheckMode="0" Icon="InsertPolygon" Tips="边界" /> <Btn ID="703" Name="nmInsertObjPolygon" Text="" CheckMode="0" Icon="InsertPolygon" Tips="[样例]插入多边形" />
<Btn ID="704" Name="nmInsertObjLineCrack" Text="" CheckMode="0" Icon="InsertLine" Tips="裂缝" /> <Btn ID="704" Name="nmInsertObjPolygonOutline" Text="" CheckMode="0" Icon="InsertPolygon" Tips="边界" />
<Btn ID="705" Name="nmInsertObjLineFault" Text="" CheckMode="0" Icon="InsertLine" Tips="断层" /> <Btn ID="705" Name="nmInsertObjLineCrack" Text="" CheckMode="0" Icon="InsertLine" Tips="裂缝" />
<Btn ID="706" Name="nmInsertObjPointWell" Text="" CheckMode="0" Icon="InsertPoint" Tips="油井" /> <Btn ID="706" Name="nmInsertObjLineFault" Text="" CheckMode="0" Icon="InsertLine" Tips="断层" />
<!-- PVT相关 --> <!-- PVT相关 -->
<Btn ID="800" Name="BasicOption" Text="" Icon="PvtBasicOption" Tips="基础选项" /> <Btn ID="800" Name="BasicOption" Text="" Icon="PvtBasicOption" Tips="基础选项" />

@ -143,6 +143,9 @@ private:
void identificationRegion(); void identificationRegion();
// 网格生成 // 网格生成
void generationMesh(); void generationMesh();
// 从菜单点击绘制除非ToolBar上的点击
void triggerToolBarAction(int index);
private: private:
// 绘图相关 // 绘图相关

@ -127,11 +127,13 @@ nmObjBase* nmGuiPlot::_createOneObj(NM_Obj_Type o, QString& sName)
listOlds << m_pPlot->getObjByIndex(i)->getName(); listOlds << m_pPlot->getObjByIndex(i)->getName();
} }
sName = ZxBaseUtil::getNextOneName(listOlds, sName); sName = ZxBaseUtil::getNextOneName(listOlds, sName);
nmDataLogFile::getInstance()->writeLog(sName + " " + QString::number(o)); nmDataLogFile::getInstance()->writeLog(sName + " ------ " + QString::number(o));
// 创建,此处代码为了简洁,作了非规范性书写 // 创建,此处代码为了简洁,作了非规范性书写
nmObjBase* pObj = NULL; nmObjBase* pObj = NULL;
if (o == NOT_Point) { if (o == NOT_Point) {
pObj = new nmObjPoint(sName, NULL, NULL); pObj = new nmObjPoint(sName, NULL, NULL);
} else if (o == NOT_Point_Well) {
pObj = new nmObjPointWell(sName, NULL, NULL);
} else if (o == NOT_Line) { } else if (o == NOT_Line) {
pObj = new nmObjLine(sName, NULL, NULL); pObj = new nmObjLine(sName, NULL, NULL);
} else if (o == NOT_Polygon) { } else if (o == NOT_Polygon) {
@ -142,10 +144,9 @@ nmObjBase* nmGuiPlot::_createOneObj(NM_Obj_Type o, QString& sName)
pObj = new nmObjLineCrack(sName, NULL, NULL); pObj = new nmObjLineCrack(sName, NULL, NULL);
} else if (o == NOT_Line_Fault) { } else if (o == NOT_Line_Fault) {
pObj = new nmObjLineFault(sName, NULL, NULL); pObj = new nmObjLineFault(sName, NULL, NULL);
} else if (o == NOT_Point_Well) {
pObj = new nmObjPointWell(sName, NULL, NULL);
} else { } else {
zxLogRunW(tr("Type '%1' not supported.").arg((int)o)); zxLogRunW(tr("Type '%1' not supported.").arg((int)o));
nmDataLogFile::getInstance()->writeLog(tr("Type '%1' not supported.").arg((int)o));
return NULL; return NULL;
} }
Q_ASSERT (NULL != pObj); Q_ASSERT (NULL != pObj);

@ -31,6 +31,7 @@ bool nmGuiPlotCmdHelper::runAction(QString sAction)
Q_ASSERT (NULL != m_pGuiPlot); Q_ASSERT (NULL != m_pGuiPlot);
ZxPlot* pPlot = m_pGuiPlot->m_pPlot; ZxPlot* pPlot = m_pGuiPlot->m_pPlot;
Q_ASSERT (NULL != pPlot); Q_ASSERT (NULL != pPlot);
nmDataLogFile::getInstance()->writeLog(" cmdHelper " + sAction);
// 鼠标交互,插入数值试井绘图对象 的例子:点、线、多边形 // 鼠标交互,插入数值试井绘图对象 的例子:点、线、多边形
if (_isSame(sAction, "nmInsertObjPoint")) { if (_isSame(sAction, "nmInsertObjPoint")) {
nmObjToolBase* pObjTool = new nmObjPointTool(); nmObjToolBase* pObjTool = new nmObjPointTool();
@ -39,6 +40,14 @@ bool nmGuiPlotCmdHelper::runAction(QString sAction)
connect(pObjTool, SIGNAL(sigPtsFinished(QVector<QPointF>&)), \ connect(pObjTool, SIGNAL(sigPtsFinished(QVector<QPointF>&)), \
this, SLOT(slotObjPtsFinished(QVector<QPointF>&))); this, SLOT(slotObjPtsFinished(QVector<QPointF>&)));
return true; 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")) { } else if (_isSame(sAction, "nmInsertObjLine")) {
nmObjToolBase* pObjTool = new nmObjLineTool(); nmObjToolBase* pObjTool = new nmObjLineTool();
Q_ASSERT (NULL != pObjTool); Q_ASSERT (NULL != pObjTool);
@ -76,14 +85,6 @@ bool nmGuiPlotCmdHelper::runAction(QString sAction)
connect(pObjTool, SIGNAL(sigPtsFinished(QVector<QPointF>&)), \ connect(pObjTool, SIGNAL(sigPtsFinished(QVector<QPointF>&)), \
this, SLOT(slotObjPtsFinished(QVector<QPointF>&))); this, SLOT(slotObjPtsFinished(QVector<QPointF>&)));
return true; 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 { } else {
// 其它Action // 其它Action
} }

@ -48,8 +48,8 @@ nmObjLineCrack::~nmObjLineCrack()
void nmObjLineCrack::initTools() void nmObjLineCrack::initTools()
{ {
m_pTool = new nmObjLineCrackTool();
ZxObjBase::initTools(); ZxObjBase::initTools();
m_pTool = new nmObjLineCrackTool();
} }
void nmObjLineCrack::initSubObjs() void nmObjLineCrack::initSubObjs()

@ -2,11 +2,13 @@
#include "nmObjLine.h" #include "nmObjLine.h"
#include "nmObjLineCrackTool.h" #include "nmObjLineCrackTool.h"
#include "nmDataLogFile.h"
nmObjLineCrackTool::nmObjLineCrackTool() nmObjLineCrackTool::nmObjLineCrackTool()
{ {
setText(tr("nObjLineCrackTool")); setText(tr("nObjLineCrackTool"));
m_oNot = NOT_Line_Crack; m_oNot = NOT_Line_Crack;
nmDataLogFile::getInstance()->writeLog(" nmObjLineCrackTool ++++++++ " + QString::number(m_oNot));
} }

@ -2,11 +2,13 @@
#include "nmObjLine.h" #include "nmObjLine.h"
#include "nmObjLineFaultTool.h" #include "nmObjLineFaultTool.h"
#include "nmDataLogFile.h"
nmObjLineFaultTool::nmObjLineFaultTool() nmObjLineFaultTool::nmObjLineFaultTool()
{ {
setText(tr("nObjLineFaultTool")); setText(tr("nObjLineFaultTool"));
m_oNot = NOT_Line_Fault; m_oNot = NOT_Line_Fault;
nmDataLogFile::getInstance()->writeLog(" nmObjLineCrackTool ++++++++ " + QString::number(m_oNot));
} }

@ -3,7 +3,7 @@
#include "nmObjLine.h" #include "nmObjLine.h"
#include "nmObjLineTool.h" #include "nmObjLineTool.h"
nmObjLineTool::nmObjLineTool() : nmObjPointTool() nmObjLineTool::nmObjLineTool()
{ {
setText(tr("nObjLineTool")); setText(tr("nObjLineTool"));
m_oNot = NOT_Line; m_oNot = NOT_Line;

@ -672,11 +672,12 @@ void nmSubWndMain::drawPolygonOutline()
{ {
// 获取多边形边界的绘制,并模拟触发点击操作 // 获取多边形边界的绘制,并模拟触发点击操作
// 目前多边形边界绘制是工具栏的第4个所以用 3 // 目前多边形边界绘制是工具栏的第4个所以用 3
QList<QAction *> actions = m_pPlotToolBar->actions(); // QList<QAction *> actions = m_pPlotToolBar->actions();
if (!actions.isEmpty()) { // if (!actions.isEmpty()) {
QAction *action = actions[3]; // QAction *action = actions[3];
action->trigger(); // action->trigger();
} // }
this->triggerToolBarAction(NOT_PolygonOutline);
} }
void nmSubWndMain::drawSquareOutline() void nmSubWndMain::drawSquareOutline()
@ -689,21 +690,24 @@ void nmSubWndMain::drawRoundOutline()
void nmSubWndMain::drawFault() void nmSubWndMain::drawFault()
{ {
this->triggerToolBarAction(NOT_Line_Fault);
} }
void nmSubWndMain::drawWell() void nmSubWndMain::drawWell()
{ {
// 获取多边形边界的绘制,并模拟触发点击操作 // 获取多边形边界的绘制,并模拟触发点击操作
// 目前多边形边界绘制是工具栏的第4个所以用 3 // 目前多边形边界绘制是工具栏的第4个所以用 3
QList<QAction *> actions = m_pPlotToolBar->actions(); // QList<QAction *> actions = m_pPlotToolBar->actions();
if (!actions.isEmpty()) { // if (!actions.isEmpty()) {
QAction *action = actions[0]; // QAction *action = actions[0];
action->trigger(); // action->trigger();
} // }
this->triggerToolBarAction(NOT_Point_Well);
} }
void nmSubWndMain::drawCrack() void nmSubWndMain::drawCrack()
{ {
this->triggerToolBarAction(NOT_Line_Crack);
} }
void nmSubWndMain::drawRegion() void nmSubWndMain::drawRegion()
@ -730,7 +734,18 @@ void nmSubWndMain::generationMesh()
//// gridWindow->resize(1200, 800); //// gridWindow->resize(1200, 800);
//// gridWindow->show(); //// gridWindow->show();
// gridWindow->initialize(); // gridWindow->initialize();
// gridWindow->render(); // gridWindow->render();
}
void nmSubWndMain::triggerToolBarAction(int index)
{
// 获取多边形边界的绘制,并模拟触发点击操作
// 目前多边形边界绘制是工具栏的第4个所以用 3
QList<QAction *> actions = m_pPlotToolBar->actions();
if (!actions.isEmpty() && index >= 0 && index < actions.count()) {
QAction *action = actions[index];
action->trigger();
}
} }
bool nmSubWndMain::onConfirmClosing() bool nmSubWndMain::onConfirmClosing()

Loading…
Cancel
Save