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="701" Name="nmInsertObjLine" Text="" CheckMode="0" Icon="InsertLine" Tips="[样例]插入线" />
<Btn ID="702" Name="nmInsertObjPolygon" Text="" CheckMode="0" Icon="InsertPolygon" Tips="[样例]插入多边形" />
<Btn ID="703" Name="nmInsertObjPolygonOutline" Text="" CheckMode="0" Icon="InsertPolygon" Tips="边界" />
<Btn ID="704" Name="nmInsertObjLineCrack" Text="" CheckMode="0" Icon="InsertLine" Tips="裂缝" />
<Btn ID="705" Name="nmInsertObjLineFault" Text="" CheckMode="0" Icon="InsertLine" Tips="断层" />
<Btn ID="706" Name="nmInsertObjPointWell" Text="" CheckMode="0" Icon="InsertPoint" Tips="油井" />
<Btn ID="701" Name="nmInsertObjPointWell" Text="" CheckMode="0" Icon="InsertPoint" Tips="油井" />
<Btn ID="702" Name="nmInsertObjLine" Text="" CheckMode="0" Icon="InsertLine" Tips="[样例]插入线" />
<Btn ID="703" Name="nmInsertObjPolygon" Text="" CheckMode="0" Icon="InsertPolygon" Tips="[样例]插入多边形" />
<Btn ID="704" Name="nmInsertObjPolygonOutline" Text="" CheckMode="0" Icon="InsertPolygon" Tips="边界" />
<Btn ID="705" Name="nmInsertObjLineCrack" Text="" CheckMode="0" Icon="InsertLine" Tips="裂缝" />
<Btn ID="706" Name="nmInsertObjLineFault" Text="" CheckMode="0" Icon="InsertLine" Tips="断层" />
<!-- PVT相关 -->
<Btn ID="800" Name="BasicOption" Text="" Icon="PvtBasicOption" Tips="基础选项" />

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

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

@ -31,6 +31,7 @@ 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();
@ -39,6 +40,14 @@ bool nmGuiPlotCmdHelper::runAction(QString sAction)
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);
@ -76,14 +85,6 @@ bool nmGuiPlotCmdHelper::runAction(QString sAction)
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 {
// 其它Action
}

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

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

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

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

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

Loading…
Cancel
Save