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.
90 lines
2.5 KiB
C++
90 lines
2.5 KiB
C++
#include "nmSubWxsPlotDialogController.h"
|
|
|
|
#include "nmDeleteConfirmationDlg.h"
|
|
#include "nmPlotDialogContext.h"
|
|
#include "nmSwitchOutlineConfirmationDlg.h"
|
|
#include "nmWxMeasureDlg.h"
|
|
#include "nmWxMeasuringScaleDlg.h"
|
|
#include "nmWxPointerPosDlg.h"
|
|
#include "nmWxWellEditor.h"
|
|
|
|
#include <QMessageBox>
|
|
|
|
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,
|
|
const nmWellEditContext& oContext,
|
|
nmDataWellBase*& pModifiedWell)
|
|
{
|
|
pModifiedWell = nullptr;
|
|
|
|
// 第一步:编辑器初始化失败属于配置或数据错误,由界面层统一提示。
|
|
nmWxWellEditor oEditor(oContext, pParent);
|
|
QString sError;
|
|
if (!oEditor.initialize(sError))
|
|
{
|
|
QMessageBox::warning(pParent, oEditor.windowTitle(), sError);
|
|
return false;
|
|
}
|
|
// 第二步:只有确认关闭才转移工作副本,取消时由会话自动销毁。
|
|
if (oEditor.exec() != QDialog::Accepted)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
pModifiedWell = oEditor.takeModifiedWell();
|
|
return pModifiedWell != nullptr;
|
|
}
|