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.
nmWTAI-Platform/Src/nmNum/nmPlot/nmGuiPlotCmdHelper.cpp

549 lines
21 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 "ZxBaseUtil.h"
#include "zxLogInstance.h"
#include <QLineF>
#include <QWidget>
#include <QtCore/qnumeric.h>
#include "ZxPlot.h"
#include "ZxSubAxisX.h"
#include "ZxSubAxisY.h"
#include "iGuiPlot.h"
#include "nmObjBase.h"
#include "nmObjPointTool.h"
#include "nmObjLineTool.h"
#include "nmObjPolygonTool.h"
#include "nmObjPolygonOutlineTool.h"
#include "nmObjLineCrackTool.h"
#include "nmObjLineCrack.h"
#include "nmObjLineFaultTool.h"
#include "nmObjLineFault.h"
#include "nmObjLineMeasuringScaleTool.h"
#include "nmObjPointWellTool.h"
#include "nmObjPointWell.h"
#include "nmObjLineMeasureTool.h"
#include "nmObjLineMeasure.h"
#include "nmGuiPlot.h"
#include "nmGuiPlotCmdHelper.h"
#include "nmPlotGraphicBinder.h"
#include "nmDataLogFile.h"
#include "nmObjRectTool.h"
#include "nmObjRectOutlineTool.h"
#include "nmObjRectOutline.h"
#include "nmObjRoundTool.h"
#include "nmObjRoundOutlineTool.h"
#include "nmObjRoundOutline.h"
#include "nmObjPolygonOutline.h"
#include "nmObjRegionMark.h"
#include "nmObjRegionTool.h"
#include "nmObjDeleteTool.h"
#include "nmPlotDialogContext.h"
#include "nmPlotDialogContextProvider.h"
#include "nmObjRegionMarkTool.h"
#include "nmDataAnalyzeManager.h"
namespace {
bool isBoundaryObject(ZxObjBase* obj)
{
return dynamic_cast<nmObjRectOutline*>(obj) != nullptr ||
dynamic_cast<nmObjRoundOutline*>(obj) != nullptr ||
dynamic_cast<nmObjPolygonOutline*>(obj) != nullptr;
}
} // namespace
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);
// 清除图元选中状态
nmGuiPlot* pNmPlot = static_cast<nmGuiPlot*>(m_pGuiPlot);
pNmPlot->clearPlotsSelectStates();
// 添加之前先激活所有图元对象的可见性
// 边界
pNmPlot->setContourVisibility(true);
// TODO:位图
// 断层
pNmPlot->setAllFaultsVisible(true);
// 井
pNmPlot->setAllWellsVisible(true);
// 裂缝
pNmPlot->setAllFracturesVisible(true);
// 区域
pNmPlot->setAllRegionsVisible(true);
// 区域标记
pNmPlot->setAllRegionMarksVisible(true);
// 同时将显示界面的父节点更新为选中
nmDataAnalyzeManager::getCurrentInstance()->setAllCategoriesRootVisibility(true);
// 清除上次的工具
foreach (nmObjToolBase* oldTool, m_activeTools.values()) {
// 移除工具不会保证触发停用回调,切换命令前主动清理工具光标。
if (nmObjDeleteTool* deleteTool = dynamic_cast<nmObjDeleteTool*>(oldTool)) {
deleteTool->resetDeleteCursor();
}
oldTool->resetInteractionCursor();
pPlot->removeTools(oldTool);
}
m_activeTools.clear();
// 绘制前确认替换意图,提交新图元前保留原边界。
if (sAction == "nmInsertObjPolygonOutline" || \
sAction == "nmInsertObjRectOutline" || \
sAction == "nmInsertObjRoundOutline" )
{
const QString sTargetOutlineTag = sAction == "nmInsertObjRectOutline"
? QLatin1String("nObjRectOutline")
: (sAction == "nmInsertObjRoundOutline"
? QLatin1String("nObjRoundOutline") : QLatin1String("nObjPolygonOutline"));
for (int i = pPlot->getObjCount() - 1; i >= 0; --i) {
ZxObjBase* obj = pPlot->getObjByIndex(i);
if (!isBoundaryObject(obj)) continue;
nmPlotDialogContextProvider* provider = nmPlotDialogContext::provider();
if (provider == nullptr ||
!provider->confirmSwitchOutline(pNmPlot, obj->getTagName(), sTargetOutlineTag)) {
return false;
}
break; // 地图只保留一个业务边界。
}
}
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>&)));
m_activeTools.insert(pObjTool->getNOT(), pObjTool);
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>&)));
m_activeTools.insert(pObjTool->getNOT(), pObjTool);
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>&)));
m_activeTools.insert(pObjTool->getNOT(), pObjTool);
return true;
} else if (_isSame(sAction, "nmInsertObjPolygon")) {
nmObjToolBase* pObjTool = new nmObjPolygonTool();
Q_ASSERT (NULL != pObjTool);
pPlot->appendTools(pObjTool);
pObjTool->beginCreationCursor();
connect(pObjTool, SIGNAL(sigPtsFinished(QVector<QPointF>&)), \
this, SLOT(slotObjPtsFinished(QVector<QPointF>&)));
connect(pObjTool, SIGNAL(sigCreationCancelled()),
this, SLOT(slotObjCreationCancelled()));
m_activeTools.insert(pObjTool->getNOT(), pObjTool);
return true;
} else if (_isSame(sAction, "nmInsertObjPolygonOutline")) {
nmObjToolBase* pObjTool = new nmObjPolygonOutlineTool();
Q_ASSERT (NULL != pObjTool);
pPlot->appendTools(pObjTool);
pObjTool->beginCreationCursor();
connect(pObjTool, SIGNAL(sigPtsFinished(QVector<QPointF>&)), \
this, SLOT(slotObjPtsFinished(QVector<QPointF>&)));
connect(pObjTool, SIGNAL(sigCreationCancelled()),
this, SLOT(slotObjCreationCancelled()));
m_activeTools.insert(pObjTool->getNOT(), pObjTool);
return true;
} else if (_isSame(sAction, "nmInsertObjRect")) {
nmObjToolBase* pObjTool = new nmObjRectTool(); //矩形对象工具类
Q_ASSERT (NULL != pObjTool);
pPlot->appendTools(pObjTool);
pObjTool->beginCreationCursor();
connect(pObjTool, SIGNAL(sigPtsFinished(QVector<QPointF>&)), \
this, SLOT(slotObjPtsFinished(QVector<QPointF>&)));
connect(pObjTool, SIGNAL(sigCreationCancelled()),
this, SLOT(slotObjCreationCancelled()));
m_activeTools.insert(pObjTool->getNOT(), pObjTool);
return true;
} else if (_isSame(sAction, "nmInsertObjRectOutline")) {
nmObjToolBase* pObjTool = new nmObjRectOutlineTool(); //矩形边界工具类
Q_ASSERT (NULL != pObjTool);
pPlot->appendTools(pObjTool);
pObjTool->beginCreationCursor();
connect(pObjTool, SIGNAL(sigPtsFinished(QVector<QPointF>&)), \
this, SLOT(slotObjPtsFinished(QVector<QPointF>&)));
connect(pObjTool, SIGNAL(sigCreationCancelled()),
this, SLOT(slotObjCreationCancelled()));
m_activeTools.insert(pObjTool->getNOT(), pObjTool);
return true;
} else if (_isSame(sAction, "nmInsertObjRound")) {
nmObjToolBase* pObjTool = new nmObjRoundTool(); //圆形对象工具类
Q_ASSERT (NULL != pObjTool);
pPlot->appendTools(pObjTool);
pObjTool->beginCreationCursor();
connect(pObjTool, SIGNAL(sigPtsFinished(QVector<QPointF>&)), \
this, SLOT(slotObjPtsFinished(QVector<QPointF>&)));
connect(pObjTool, SIGNAL(sigCreationCancelled()),
this, SLOT(slotObjCreationCancelled()));
m_activeTools.insert(pObjTool->getNOT(), pObjTool);
return true;
} else if (_isSame(sAction, "nmInsertObjRoundOutline")) {
nmObjToolBase* pObjTool = new nmObjRoundOutlineTool(); //圆形边界工具类
Q_ASSERT (NULL != pObjTool);
pPlot->appendTools(pObjTool);
pObjTool->beginCreationCursor();
connect(pObjTool, SIGNAL(sigPtsFinished(QVector<QPointF>&)), \
this, SLOT(slotObjPtsFinished(QVector<QPointF>&)));
connect(pObjTool, SIGNAL(sigCreationCancelled()),
this, SLOT(slotObjCreationCancelled()));
m_activeTools.insert(pObjTool->getNOT(), pObjTool);
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);
pObjTool->beginCreationCursor();
connect(pObjTool, SIGNAL(sigPtsFinished(QVector<QPointF>&)),
this, SLOT(slotObjPtsFinished(QVector<QPointF>&)));
connect(pObjTool, SIGNAL(sigCreationCancelled()),
this, SLOT(slotObjCreationCancelled()));
m_activeTools.insert(NMOT_Line_Fracture, pObjTool);
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);
pObjTool->beginCreationCursor();
connect(pObjTool, SIGNAL(sigPtsFinished(QVector<QPointF>&)),
this, SLOT(slotObjPtsFinished(QVector<QPointF>&)));
connect(pObjTool, SIGNAL(sigCreationCancelled()),
this, SLOT(slotObjCreationCancelled()));
m_activeTools.insert(NMOT_Line_Fault, pObjTool);
return true;
} else if (_isSame(sAction, "nmInsertObjRegion")) {
nmObjToolBase* pObjTool = new nmObjRegionTool();
nmDataLogFile::getInstance()->writeLog("in nmGuiPlotCmdHelper " + QString::number(pObjTool->getNOT()));
Q_ASSERT(NULL != pObjTool);
pPlot->appendTools(pObjTool);
pObjTool->beginCreationCursor();
connect(pObjTool, SIGNAL(sigPtsFinished(QVector<QPointF>&)),
this, SLOT(slotObjPtsFinished(QVector<QPointF>&)));
connect(pObjTool, SIGNAL(sigCreationCancelled()),
this, SLOT(slotObjCreationCancelled()));
m_activeTools.insert(NMOT_Region, pObjTool);
return true;
} else if (_isSame(sAction, "nmInsertObjLineMeasuringScale")) {
nmObjToolBase* pObjTool = new nmObjLineMeasuringScaleTool();
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>&)));
m_activeTools.insert(NMOT_Line_MeasuringScale, pObjTool);
return true;
} else if (_isSame(sAction, "nmInsertObjLineMeasure")) {
nmObjToolBase* pExistingTool = m_activeTools.value(NMOT_Line_Measure, nullptr);
if(pExistingTool) {
return true;
}
nmObjLineMeasureTool* pMeasureTool = new nmObjLineMeasureTool();
nmObjToolBase* pObjTool = pMeasureTool;
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>&)));
m_activeTools.insert(NMOT_Line_Measure, pObjTool);
pMeasureTool->beginCreationCursor();
return true;
} else if (_isSame(sAction, "nmDeleteOneObj")) {
nmObjToolBase* pObjTool = new nmObjDeleteTool(pPlot);
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>&)));
m_activeTools.insert(NMOT_Delete, pObjTool);
return true;
} else if (_isSame(sAction, "nmInsertRegionMark")) {
nmObjToolBase* pObjTool = new nmObjRegionMarkTool(pPlot);
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>&)));
m_activeTools.insert(NMOT_RegionMark, pObjTool);
return true;
} else {
// 其它Action
}
return iGuiPlotCmdHelper::runAction(sAction);
}
void nmGuiPlotCmdHelper::cancelActiveTools()
{
nmGuiPlot* pWxPlot = dynamic_cast<nmGuiPlot*>(m_pGuiPlot);
if(pWxPlot == nullptr || pWxPlot->m_pPlot == nullptr ||
pWxPlot->m_pPlotView == nullptr) {
return;
}
foreach (nmObjToolBase* activeTool, m_activeTools.values()) {
// 取消删除模式时同步清理视口上的自定义光标。
if (nmObjDeleteTool* deleteTool = dynamic_cast<nmObjDeleteTool*>(activeTool)) {
deleteTool->resetDeleteCursor();
}
activeTool->resetInteractionCursor();
pWxPlot->m_pPlot->removeTools(activeTool);
}
m_activeTools.clear();
finalWithAcm(true, true);
}
void nmGuiPlotCmdHelper::slotObjCreationCancelled()
{
nmObjToolBase* tool = qobject_cast<nmObjToolBase*>(sender());
if (tool == nullptr || m_pGuiPlot == nullptr || m_pGuiPlot->m_pPlot == nullptr ||
m_activeTools.value(tool->getNOT(), nullptr) != tool) {
return;
}
// 先撤销登记,避免取消旧工具时误清掉后来切换的新工具。
m_activeTools.remove(tool->getNOT());
m_pGuiPlot->m_pPlot->removeTools(tool);
finalWithAcm(true, true);
}
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);
// 连续测量保留工具。已退出的工具不能通过延迟到达的松手事件提交。
const NM_Obj_Type type = pTool->getNOT();
if (type == NMOT_Line_Measure) {
if (m_activeTools.value(type, nullptr) == pTool) {
commitMeasure(pWxPlot, vec);
}
return;
}
pTool->resetInteractionCursor();
pPlot->removeTools(pTool);
m_activeTools.remove(type);
QString sName = tr("nmObj"); // 默认名称
// 根据类型设置绘图对象名称
if (pTool->getNOT() == NMOT_Point) {
sName = tr("Point");
} else if (pTool->getNOT() == NMOT_Point_Well) {
sName = tr("Well");
} else if (pTool->getNOT() == NMOT_Line) {
sName = tr("Line");
} else if (pTool->getNOT() == NMOT_Polygon) {
sName = tr("Polygon");
} else if (pTool->getNOT() == NMOT_PolygonOutline) {
sName.clear(); // 边界默认不命名,用户可在图元属性中自行填写。
} else if (pTool->getNOT() == NMOT_Line_Fracture) {
sName = tr("Fracture");
} else if (pTool->getNOT() == NMOT_Line_Fault) {
sName = tr("Fault");
} else if (pTool->getNOT() == NMOT_Line_MeasuringScale) {
sName = tr("MeasuringScale");
} else if (pTool->getNOT() == NMOT_Rect) {
sName = tr("Rectangle");
} else if (pTool->getNOT() == NMOT_RectOutline) {
sName.clear();
} else if (pTool->getNOT() == NMOT_Round) {
sName = tr("Circle");
} else if (pTool->getNOT() == NMOT_RoundOutline) {
sName.clear();
} else if (pTool->getNOT() == NMOT_Region) {
sName = tr("Limit");
} else if (pTool->getNOT() == NMOT_Delete) {
sName = tr("Delete");
} else if (pTool->getNOT() == NMOT_RegionMark) {
sName = tr("Region");
}
nmObjBase* pObj = pWxPlot->appendOneObj(pTool->getNOT(), sName, vec);
if (pObj == nullptr) {
finalWithAcm(true, true);
return;
}
// 断层/裂缝/边界创建逻辑已改由 Binder 负责(创建数据 + 建立信号连接)
if (pTool->getNOT() == NMOT_Line_Fault) {
nmObjLineFault* pFault = dynamic_cast<nmObjLineFault*>(pObj);
if (pFault && pWxPlot->graphicBinder()) {
pWxPlot->graphicBinder()->createFaultForGraphic(pFault);
}
} else if (pTool->getNOT() == NMOT_Line_Fracture) {
nmObjLineCrack* pCrack = dynamic_cast<nmObjLineCrack*>(pObj);
if (pCrack && pWxPlot->graphicBinder()) {
pWxPlot->graphicBinder()->createCrackForGraphic(pCrack);
}
} else if (pTool->getNOT() == NMOT_RectOutline ||
pTool->getNOT() == NMOT_RoundOutline ||
pTool->getNOT() == NMOT_PolygonOutline) {
// 新边界已成形。按索引移除旧图元,旧数据由接下来的 Binder 创建流程替换。
nmPlotGraphicBinder* binder = pWxPlot->graphicBinder();
for (int i = pPlot->getObjCount() - 1; i >= 0; --i) {
ZxObjBase* oldObj = pPlot->getObjByIndex(i);
if (oldObj == pObj || !isBoundaryObject(oldObj)) continue;
if (binder != nullptr) {
binder->removeOutlineBinding(static_cast<nmObjBase*>(oldObj), false);
}
pPlot->removeObjByIndex(i);
}
// 先执行 afterCreated(矩形边界会在其中 reorderPoints)
pObj->afterCreated();
// 再通过 Binder 创建数据并建立绑定
if (binder != nullptr) {
nmObjRoundOutline* pRound = dynamic_cast<nmObjRoundOutline*>(pObj);
nmObjRectOutline* pRect = dynamic_cast<nmObjRectOutline*>(pObj);
nmObjPolygonOutline* pPolygon = dynamic_cast<nmObjPolygonOutline*>(pObj);
if (pRound) {
binder->createOutlineForGraphic(pRound);
} else if (pRect) {
binder->createOutlineForGraphic(pRect);
} else if (pPolygon) {
binder->createOutlineForGraphic(pPolygon);
}
}
} else if (pTool->getNOT() == NMOT_RegionMark) {
// 先执行 afterCreated(图元内部初始化)
pObj->afterCreated();
// 再通过 Binder 创建数据并建立绑定
nmObjRegionMark* pRegionMark = dynamic_cast<nmObjRegionMark*>(pObj);
if (pRegionMark && pWxPlot->graphicBinder()) {
pWxPlot->graphicBinder()->createRegionMarkForGraphic(pRegionMark);
}
} else if (pTool->getNOT() == NMOT_Region) {
// 先执行 afterCreated(图元内部初始化:点排序)
pObj->afterCreated();
// 再通过 Binder 创建数据并建立绑定
nmObjRegion* pRegion = dynamic_cast<nmObjRegion*>(pObj);
if (pRegion && pWxPlot->graphicBinder()) {
pWxPlot->graphicBinder()->createRegionForGraphic(pRegion);
}
} else if (pTool->getNOT() == NMOT_Point_Well) {
// 井图元:先设置 Binder,再执行 afterCreated(内部通过 Binder 创建井数据)
nmObjPointWell* pWell = dynamic_cast<nmObjPointWell*>(pObj);
if (pWell && pWxPlot->graphicBinder()) {
pWell->setGraphicBinder(pWxPlot->graphicBinder());
}
pObj->afterCreated();
} else {
pObj->afterCreated();
}
}
void nmGuiPlotCmdHelper::commitMeasure(nmGuiPlot* plot, QVector<QPointF>& points)
{
ZxPlot* chart = plot->m_pPlot;
nmPlotGraphicBinder* binder = plot->graphicBinder();
if (chart == nullptr || binder == nullptr || plot->boundDataManager() == nullptr ||
points.count() != 2) {
return;
}
const ZxSubAxisX* axisX = chart->getMainAxisX();
const ZxSubAxisY* axisY = chart->getMainAxisY();
if (axisX == nullptr || axisY == nullptr ||
axisX->getRangeMin() == axisX->getRangeMax() ||
axisY->getRangeMin() == axisY->getRangeMax()) {
return;
}
// 首次单击仍可选取拟合参考点。已有测量时,只允许有效线段替换。
const bool singlePoint = points[0] == points[1];
if (singlePoint && !plot->getObjsByTag("nObjLineMeasure").isEmpty()) return;
const QVector<QPointF> values = chart->getValueForPos(points);
if (values.count() != 2) return;
const qreal length = QLineF(values[0], values[1]).length();
if (!qIsFinite(length) || (!singlePoint && length <= 0.0)) return;
QString name = tr("Measure");
nmObjLineMeasure* measure = static_cast<nmObjLineMeasure*>(
plot->appendOneObj(NMOT_Line_Measure, name, points));
if (measure == nullptr) return;
// 新线已创建,先断开旧线绑定,再写入供面板监听的同一个数据对象。
plot->removeMeasureGraphics(measure);
measure->afterCreated();
binder->createMeasureForGraphic(measure);
emit sigMeasureCommitted();
}
void nmGuiPlotCmdHelper::finishMeasure()
{
nmGuiPlot* pWxPlot = dynamic_cast<nmGuiPlot*>(m_pGuiPlot);
if(pWxPlot == nullptr || pWxPlot->m_pPlot == nullptr) {
return;
}
nmObjToolBase* pMeasureTool = m_activeTools.value(NMOT_Line_Measure, nullptr);
if(pMeasureTool) {
m_activeTools.remove(NMOT_Line_Measure);
pMeasureTool->cancelInteraction();
pMeasureTool->resetInteractionCursor();
pWxPlot->m_pPlot->removeTools(pMeasureTool);
}
pWxPlot->deleteMeasureObjects();
}
// 插入背景
void nmGuiPlotCmdHelper::insertBkImg()
{
// 与业务窗口共用导入通道,确保图片归属、保存和坐标保持规则一致。
nmGuiPlot* pMap = qobject_cast<nmGuiPlot*>(m_pGuiPlot);
if(pMap != NULL) {
pMap->importBackgroundImage();
}
}
// 插入井点
void nmGuiPlotCmdHelper::insertOneWell() {
}