#include "nmSubWxsPlotDialogController.h" #include "nmDeleteConfirmationDlg.h" #include "nmPlotDialogContext.h" #include "nmSwitchOutlineConfirmationDlg.h" #include "nmWxEditWellPlot.h" #include "nmWxMeasureDlg.h" #include "nmWxMeasuringScaleDlg.h" #include "nmWxPointerPosDlg.h" namespace { // nmSubWxs模块加载时注册绘图弹窗上下文提供者 struct nmSubWxsPlotDialogControllerRegister { nmSubWxsPlotDialogControllerRegister() { nmPlotDialogContext::setProvider(nmSubWxsPlotDialogController::instance()); } }; nmSubWxsPlotDialogControllerRegister s_register; } // 获取绘图弹窗上下文控制器单例 nmSubWxsPlotDialogController* nmSubWxsPlotDialogController::instance() { static nmSubWxsPlotDialogController s_controller; return &s_controller; } // 打开测量比例尺弹窗 bool nmSubWxsPlotDialogController::execMeasuringScaleDialog(const QPointF& pStart, const QPointF& pEnd, double* pLength) { nmWxMeasuringScaleDlg dlg(pStart, pEnd, pLength); return dlg.exec() == QDialog::Accepted; } // 创建测量工具弹窗 QWidget* nmSubWxsPlotDialogController::createMeasureDialog(QWidget* pParent) { return new nmWxMeasureDlg(pParent); } // 创建坐标显示弹窗 QWidget* nmSubWxsPlotDialogController::createPointerPosDialog(QWidget* pParent) { return new nmWxPointerPosDlg(pParent); } // 确认是否删除图元 bool nmSubWxsPlotDialogController::confirmDeleteObject() { nmDeleteConfirmationDlg dialog; return dialog.exec() == QDialog::Accepted; } // 确认是否切换边界类型 bool nmSubWxsPlotDialogController::confirmSwitchOutline() { nmSwitchOutlineConfirmationDlg dialog; return dialog.exec() == QDialog::Accepted; } // 打开井编辑弹窗并返回修改后的井数据 bool nmSubWxsPlotDialogController::editWell(QWidget* pParent, ZxDataWell* pZxDataWell, nmDataWellBase* pNmDataWell, nmDataWellBase*& pModifiedWell) { pModifiedWell = nullptr; nmWxEditWellPlot* pEditWellDlg = new nmWxEditWellPlot(pParent, pZxDataWell, pNmDataWell); if(pEditWellDlg->exec() != QDialog::Accepted) { delete pEditWellDlg; return false; } pModifiedWell = pEditWellDlg->getModifiedDataWell(); delete pEditWellDlg; return true; }