|
|
|
|
@ -78,7 +78,7 @@
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <cmath>
|
|
|
|
|
#include <QMdiSubWindow>
|
|
|
|
|
#include <QDialog>
|
|
|
|
|
#include "ZxMdiArea.h"
|
|
|
|
|
|
|
|
|
|
#include "nmSingalCenter.h"
|
|
|
|
|
@ -344,23 +344,10 @@ void nmSubWndMain::onPebiResultSnapshotChanged()
|
|
|
|
|
const QString sSnapshotId = pSnapshot->getSnapshotId();
|
|
|
|
|
if(sSnapshotId == m_sObservedPebiResultSnapshotId) {
|
|
|
|
|
// 切换结果井时关闭上一口井的敏感性窗口及附属表格,保留批次数据供再次查看。
|
|
|
|
|
ZxMdiArea* area = pSubWndFitting->m_pMdiArea;
|
|
|
|
|
if(area) {
|
|
|
|
|
iGuiPlot* loglog = pSubWndFitting->getPlotByTag(s_Tag_ChartSensitivity);
|
|
|
|
|
bool closed = false;
|
|
|
|
|
foreach(QMdiSubWindow* window, area->subWindowList()) {
|
|
|
|
|
if(window->objectName() != "nmSensitivityHistory" &&
|
|
|
|
|
window->objectName() != "nmSensitivityHistogram" &&
|
|
|
|
|
!(loglog && window->isAncestorOf(loglog))) continue;
|
|
|
|
|
foreach(iGuiPlot* plot, window->findChildren<iGuiPlot*>())
|
|
|
|
|
clearResultCurveDataTables(plot);
|
|
|
|
|
foreach(QDialog* dialog, window->findChildren<QDialog*>()) {
|
|
|
|
|
if(dialog->isWindow()) dialog->close();
|
|
|
|
|
}
|
|
|
|
|
window->close();
|
|
|
|
|
closed = true;
|
|
|
|
|
}
|
|
|
|
|
if(closed && area->isVisible()) area->relayoutSubWnds();
|
|
|
|
|
const char* names[] = { "nmSensitivityLoglog", "nmSensitivityHistory", "nmSensitivityHistogram" };
|
|
|
|
|
for(int i = 0; i < 3; ++i) {
|
|
|
|
|
QDialog* window = pSubWndFitting->findChild<QDialog*>(names[i]);
|
|
|
|
|
if(window) window->close();
|
|
|
|
|
}
|
|
|
|
|
// 同一快照内切换结果井仍由 onWellSelected() 处理,不重复刷新全部结果页面。
|
|
|
|
|
return;
|
|
|
|
|
@ -1961,15 +1948,29 @@ void nmSubWndMain::onForecastDataChanged()
|
|
|
|
|
m_pResultRefreshFitting->setModified(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QDialog* nmSubWndMain::createResultDialog(const QString& name, const QString& title)
|
|
|
|
|
{
|
|
|
|
|
// 关闭时销毁结果窗口及子控件,计算结果保留在数据中心供再次查看。
|
|
|
|
|
QDialog* dialog = new QDialog(m_pResultRefreshFitting.data(),
|
|
|
|
|
Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
|
|
|
|
dialog->setObjectName(name);
|
|
|
|
|
dialog->setWindowTitle(title);
|
|
|
|
|
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
|
|
|
|
dialog->resize(900, 650);
|
|
|
|
|
QVBoxLayout* layout = new QVBoxLayout(dialog);
|
|
|
|
|
layout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
dialog->installEventFilter(this);
|
|
|
|
|
return dialog;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmSubWndMain::onShowForecastResult()
|
|
|
|
|
{
|
|
|
|
|
// 使用面板绑定的分析页面,切换活动分析不会改变预测结果的归属。
|
|
|
|
|
iSubWndFitting* fitting = m_pResultRefreshFitting.data();
|
|
|
|
|
nmDataAnalyzeManager* manager = m_pResultRefreshDataManager.data();
|
|
|
|
|
if(!fitting || !fitting->m_pMdiArea || !manager ||
|
|
|
|
|
if(!fitting || !manager ||
|
|
|
|
|
nmDataAnalyzeManager::findManagerByFitting(fitting) != manager) return;
|
|
|
|
|
ZxMdiArea* area = fitting->m_pMdiArea;
|
|
|
|
|
QMdiSubWindow* window = area->findChild<QMdiSubWindow*>("nmForecastResult");
|
|
|
|
|
QDialog* window = fitting->findChild<QDialog*>("nmForecastResult");
|
|
|
|
|
const QSharedPointer<nmDataForecast::Result> result = manager->getForecastData()
|
|
|
|
|
? manager->getForecastData()->getResult() : QSharedPointer<nmDataForecast::Result>();
|
|
|
|
|
const QSharedPointer<const nmPebiResultSnapshot> snapshot = manager->getPebiResultSnapshot();
|
|
|
|
|
@ -1979,9 +1980,7 @@ void nmSubWndMain::onShowForecastResult()
|
|
|
|
|
// 基础结果或结果井切换后清除旧窗口;模型参数编辑不影响上次预测的显示。
|
|
|
|
|
if(window) {
|
|
|
|
|
foreach(iGuiPlot* plot, window->findChildren<iGuiPlot*>()) clearResultCurveDataTables(plot);
|
|
|
|
|
area->removeSubWindow(window);
|
|
|
|
|
delete window;
|
|
|
|
|
if(area->isVisible()) area->relayoutSubWnds();
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@ -1991,10 +1990,9 @@ void nmSubWndMain::onShowForecastResult()
|
|
|
|
|
const QVector<double>& rates = result->rates;
|
|
|
|
|
const bool created = window == nullptr;
|
|
|
|
|
if(created) {
|
|
|
|
|
// 结果页面由 MDI 承载,关闭预测输入对话框不销毁结果。
|
|
|
|
|
QWidget* page = new QWidget;
|
|
|
|
|
QVBoxLayout* layout = new QVBoxLayout(page);
|
|
|
|
|
layout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
window = createResultDialog("nmForecastResult", nmWxForecast::tr("Forecast"));
|
|
|
|
|
QWidget* page = window;
|
|
|
|
|
QVBoxLayout* layout = qobject_cast<QVBoxLayout*>(window->layout());
|
|
|
|
|
QSplitter* charts = new QSplitter(Qt::Vertical, page);
|
|
|
|
|
charts->setObjectName("nmForecastCharts");
|
|
|
|
|
charts->setChildrenCollapsible(false);
|
|
|
|
|
@ -2029,9 +2027,6 @@ void nmSubWndMain::onShowForecastResult()
|
|
|
|
|
connect(plot->getAxisOf(0), SIGNAL(sigRangeChanged(double,double,bool,bool)),
|
|
|
|
|
this, SLOT(syncForecastTimeAxis(double,double,bool,bool)));
|
|
|
|
|
}
|
|
|
|
|
window = area->addSubWindow(page);
|
|
|
|
|
window->setObjectName("nmForecastResult");
|
|
|
|
|
window->setAttribute(Qt::WA_DeleteOnClose, false);
|
|
|
|
|
}
|
|
|
|
|
// 与预测输入窗口共用标题译文,不附加井名。
|
|
|
|
|
window->setWindowTitle(nmWxForecast::tr("Forecast"));
|
|
|
|
|
@ -2103,12 +2098,9 @@ void nmSubWndMain::onShowForecastResult()
|
|
|
|
|
// 时间刻度及标题只在下图显示,上图仍保留横轴数据与同步关系。
|
|
|
|
|
plot->getAxisOf(0)->setMinimizeAxis(i == 0);
|
|
|
|
|
}
|
|
|
|
|
const bool restore = window->isHidden();
|
|
|
|
|
window->widget()->show();
|
|
|
|
|
window->show();
|
|
|
|
|
// 隐藏的分析页交给框架显示事件布局,避免此时重排把结果重新隐藏。
|
|
|
|
|
if((created || restore) && area->isVisible()) area->relayoutSubWnds();
|
|
|
|
|
area->setActiveSubWindow(window);
|
|
|
|
|
window->raise();
|
|
|
|
|
window->activateWindow();
|
|
|
|
|
QTimer::singleShot(0, this, SLOT(fitForecastViews()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -2135,7 +2127,22 @@ void nmSubWndMain::onReadonlyCurveDoubleClicked(
|
|
|
|
|
|
|
|
|
|
bool nmSubWndMain::eventFilter(QObject* watched, QEvent* event)
|
|
|
|
|
{
|
|
|
|
|
// 子窗口缩放、重新显示均在内部控件完成尺寸更新后再适配。
|
|
|
|
|
// 关闭结果对话框时同步关闭其曲线数据表、Show 和统计设置窗口。
|
|
|
|
|
if((event->type() == QEvent::Close || event->type() == QEvent::Hide) &&
|
|
|
|
|
qobject_cast<QDialog*>(watched)) {
|
|
|
|
|
foreach(iGuiPlot* plot, watched->findChildren<iGuiPlot*>())
|
|
|
|
|
clearResultCurveDataTables(plot);
|
|
|
|
|
foreach(QDialog* dialog, watched->findChildren<QDialog*>())
|
|
|
|
|
if(dialog->isWindow()) dialog->close();
|
|
|
|
|
}
|
|
|
|
|
// 独立窗口不再经过 MDI 的画布适配,显示和缩放时适配自己的绘图区。
|
|
|
|
|
QDialog* dialog = qobject_cast<QDialog*>(watched);
|
|
|
|
|
if(dialog && (event->type() == QEvent::Resize || event->type() == QEvent::Show)) {
|
|
|
|
|
dialog->layout()->activate();
|
|
|
|
|
foreach(iGuiPlot* plot, dialog->findChildren<iGuiPlot*>())
|
|
|
|
|
plot->m_pPlotView->setZoomMode(ZxRenderView::eZoomFitWindow, true);
|
|
|
|
|
}
|
|
|
|
|
// 对话框缩放、重新显示均在内部控件完成尺寸更新后再适配。
|
|
|
|
|
if(watched->objectName() == "nmForecastCharts" &&
|
|
|
|
|
(event->type() == QEvent::Resize || event->type() == QEvent::Show))
|
|
|
|
|
QTimer::singleShot(0, this, SLOT(fitForecastViews()));
|
|
|
|
|
@ -2146,8 +2153,8 @@ void nmSubWndMain::fitForecastViews()
|
|
|
|
|
{
|
|
|
|
|
// 只适配图形画布的显示尺寸,不改变用户选定的时间和压力范围。
|
|
|
|
|
iSubWndFitting* fitting = m_pResultRefreshFitting.data();
|
|
|
|
|
if(!fitting || !fitting->m_pMdiArea) return;
|
|
|
|
|
QMdiSubWindow* window = fitting->m_pMdiArea->findChild<QMdiSubWindow*>("nmForecastResult");
|
|
|
|
|
if(!fitting) return;
|
|
|
|
|
QDialog* window = fitting->findChild<QDialog*>("nmForecastResult");
|
|
|
|
|
if(!window) return;
|
|
|
|
|
foreach(iGuiPlot* plot, window->findChildren<iGuiPlot*>())
|
|
|
|
|
plot->m_pPlotView->setZoomMode(ZxRenderView::eZoomFitWindow, true);
|
|
|
|
|
@ -2157,8 +2164,8 @@ void nmSubWndMain::syncForecastTimeAxis(double minimum, double maximum, bool rec
|
|
|
|
|
{
|
|
|
|
|
// 只同步本分析预测图的横轴;阻断回传,避免两张图相互触发范围更新。
|
|
|
|
|
iSubWndFitting* fitting = m_pResultRefreshFitting.data();
|
|
|
|
|
if(!fitting || !fitting->m_pMdiArea) return;
|
|
|
|
|
QMdiSubWindow* window = fitting->m_pMdiArea->findChild<QMdiSubWindow*>("nmForecastResult");
|
|
|
|
|
if(!fitting) return;
|
|
|
|
|
QDialog* window = fitting->findChild<QDialog*>("nmForecastResult");
|
|
|
|
|
if(!window) return;
|
|
|
|
|
iGuiPlot* rate = window->findChild<iGuiPlot*>("nmForecastRate");
|
|
|
|
|
iGuiPlot* pressure = window->findChild<iGuiPlot*>("nmForecastPressure");
|
|
|
|
|
@ -2182,34 +2189,28 @@ void nmSubWndMain::onShowSensitiveResults()
|
|
|
|
|
updateSensitiveHistoryPlot();
|
|
|
|
|
updateSensitiveHistogramPlot();
|
|
|
|
|
QSharedPointer<nmDataSensitive::BatchResult> result = manager->getSensitiveData()->getResults();
|
|
|
|
|
iGuiPlot* plot = fitting->getPlotByTag(s_Tag_ChartSensitivity);
|
|
|
|
|
if(plot) clearResultCurveDataTables(plot);
|
|
|
|
|
QDialog* window = fitting->findChild<QDialog*>("nmSensitivityLoglog");
|
|
|
|
|
if(result.isNull()) {
|
|
|
|
|
// 新模型已丢弃旧批次,同时清除图元与撤销记录,避免窗口恢复或保存后残留旧曲线。
|
|
|
|
|
if(plot) {
|
|
|
|
|
for(int i = plot->m_pPlot->getObjCount() - 1; i >= 0; --i) {
|
|
|
|
|
if(qobject_cast<ZxObjCurve*>(plot->m_pPlot->getObjByIndex(i)))
|
|
|
|
|
plot->m_pPlot->removeObjByIndex(i);
|
|
|
|
|
}
|
|
|
|
|
plot->clearUndoStack();
|
|
|
|
|
plot->setCurveData(QVector<iCurveDesc>());
|
|
|
|
|
plot->runUpdate();
|
|
|
|
|
QMdiSubWindow* subWindow = nullptr;
|
|
|
|
|
for(QWidget* parent = plot->parentWidget(); parent && !subWindow; parent = parent->parentWidget())
|
|
|
|
|
subWindow = qobject_cast<QMdiSubWindow*>(parent);
|
|
|
|
|
if(subWindow) subWindow->close();
|
|
|
|
|
else plot->hide();
|
|
|
|
|
// 清除批次时销毁旧图及附属窗口。
|
|
|
|
|
if(window) {
|
|
|
|
|
window->close();
|
|
|
|
|
delete window;
|
|
|
|
|
}
|
|
|
|
|
if(sender() == manager) fitting->setModified(true);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const bool created = plot == nullptr;
|
|
|
|
|
// 通用取窗接口未实现敏感性类型,直接复用框架已有的内部 MDI 创建函数。
|
|
|
|
|
if(created) plot = fitting->initSensitivityPlot();
|
|
|
|
|
if(!plot) {
|
|
|
|
|
QMessageBox::warning(fitting, nmWxSensitive::tr("Sensitivity"),
|
|
|
|
|
tr("Failed to create sensitivity plot."));
|
|
|
|
|
return;
|
|
|
|
|
iGuiPlot* plot = window ? window->findChild<iGuiPlot*>() : nullptr;
|
|
|
|
|
if(plot) clearResultCurveDataTables(plot);
|
|
|
|
|
// 与预测一致,直接在结果对话框内创建框架绘图控件,不经过主界面 MDI。
|
|
|
|
|
if(!window) {
|
|
|
|
|
window = createResultDialog("nmSensitivityLoglog", tr("Sensitivity loglog plot"));
|
|
|
|
|
plot = new iGuiPlot(true, window);
|
|
|
|
|
plot->initUI(tr("Sensitivity loglog plot"));
|
|
|
|
|
plot->m_pPlotView->setSimpleMode(true);
|
|
|
|
|
plot->setAxisX(tr("Time"), "hr");
|
|
|
|
|
plot->setAxisY(tr("Pressure"), "MPa");
|
|
|
|
|
plot->m_pPlot->setBKColor(Qt::white);
|
|
|
|
|
window->layout()->addWidget(plot);
|
|
|
|
|
}
|
|
|
|
|
connect(plot, SIGNAL(sigDoubleClicked(ZxPlot*,ZxObjBase*,const QPointF&,bool&)),
|
|
|
|
|
this, SLOT(onReadonlyCurveDoubleClicked(ZxPlot*,ZxObjBase*,const QPointF&,bool&)), Qt::UniqueConnection);
|
|
|
|
|
@ -2288,58 +2289,42 @@ void nmSubWndMain::onShowSensitiveResults()
|
|
|
|
|
curve->setVisible(!hidden.contains(curve->getName()));
|
|
|
|
|
plot->setReadOnly(true);
|
|
|
|
|
plot->freshAxisScales(true, false);
|
|
|
|
|
// 只有新建或恢复窗口时才重新调整内部布局。
|
|
|
|
|
QMdiSubWindow* subWindow = nullptr;
|
|
|
|
|
for(QWidget* parent = plot->parentWidget(); parent && !subWindow; parent = parent->parentWidget())
|
|
|
|
|
subWindow = qobject_cast<QMdiSubWindow*>(parent);
|
|
|
|
|
const bool restore = subWindow && subWindow->isHidden();
|
|
|
|
|
plot->show();
|
|
|
|
|
if(subWindow) {
|
|
|
|
|
// 敏感性子窗口标题使用数值模块译文,与历史图、直方图保持一致。
|
|
|
|
|
subWindow->setWindowTitle(tr("Sensitivity loglog plot"));
|
|
|
|
|
subWindow->show();
|
|
|
|
|
if(created || restore) {
|
|
|
|
|
ZxMdiArea* area = qobject_cast<ZxMdiArea*>(subWindow->mdiArea());
|
|
|
|
|
fitting->layoutSubWnds(area ? area->getLayoutMode() : WLM_Cell);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
window->show();
|
|
|
|
|
window->raise();
|
|
|
|
|
window->activateWindow();
|
|
|
|
|
if(sender() == manager) fitting->setModified(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmSubWndMain::updateSensitiveHistoryPlot()
|
|
|
|
|
{
|
|
|
|
|
// 复用框架的上下压力/流量控件,作为同一分析页面中的独立 MDI 子窗口。
|
|
|
|
|
// 复用框架的上下压力/流量控件,在本分析的独立对话框展示。
|
|
|
|
|
iSubWndFitting* fitting = m_pResultRefreshFitting.data();
|
|
|
|
|
nmDataAnalyzeManager* manager = m_pResultRefreshDataManager.data();
|
|
|
|
|
if(!fitting || !fitting->m_pMdiArea || !manager || !manager->getSensitiveData()) return;
|
|
|
|
|
ZxMdiArea* area = fitting->m_pMdiArea;
|
|
|
|
|
QMdiSubWindow* window = area->findChild<QMdiSubWindow*>("nmSensitivityHistory");
|
|
|
|
|
if(!fitting || !manager || !manager->getSensitiveData()) return;
|
|
|
|
|
QDialog* window = fitting->findChild<QDialog*>("nmSensitivityHistory");
|
|
|
|
|
const QSharedPointer<nmDataSensitive::BatchResult> batch = manager->getSensitiveData()->getResults();
|
|
|
|
|
if(batch.isNull()) {
|
|
|
|
|
// 新模型丢弃旧批次时一并销毁窗口,曲线和撤销记录不再残留。
|
|
|
|
|
if(window) {
|
|
|
|
|
area->removeSubWindow(window);
|
|
|
|
|
window->close();
|
|
|
|
|
delete window;
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const bool created = window == nullptr;
|
|
|
|
|
if(created) {
|
|
|
|
|
// PF 继承对话框,用普通页面承载,关闭子窗口时不进入其对话框关闭流程。
|
|
|
|
|
QWidget* page = new QWidget;
|
|
|
|
|
QVBoxLayout* layout = new QVBoxLayout(page);
|
|
|
|
|
layout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
// PF 作为对话框内的控件使用,保留框架的上下曲线布局。
|
|
|
|
|
window = createResultDialog("nmSensitivityHistory", tr("Sensitivity history plot"));
|
|
|
|
|
QWidget* page = window;
|
|
|
|
|
QVBoxLayout* layout = qobject_cast<QVBoxLayout*>(window->layout());
|
|
|
|
|
iGuiPlotPF* history = new iGuiPlotPF(s_Tag_HIST_PF, true, true, page);
|
|
|
|
|
history->setWindowFlags(Qt::Widget);
|
|
|
|
|
history->initUI(tr("Sensitivity history plot"));
|
|
|
|
|
history->setTableHelperVisible(false);
|
|
|
|
|
layout->addWidget(history);
|
|
|
|
|
window = area->addSubWindow(page);
|
|
|
|
|
window->setObjectName("nmSensitivityHistory");
|
|
|
|
|
window->setWindowTitle(tr("Sensitivity history plot"));
|
|
|
|
|
window->setAttribute(Qt::WA_DeleteOnClose, false);
|
|
|
|
|
}
|
|
|
|
|
installSensitiveShow(window->widget());
|
|
|
|
|
installSensitiveShow(window);
|
|
|
|
|
iGuiPlotPF* history = window->findChild<iGuiPlotPF*>();
|
|
|
|
|
QVector<iCurveDesc> curves;
|
|
|
|
|
// 基准压力、实测压力和流量均取成功求解快照,未求解的参数或制度编辑不参与绘图。
|
|
|
|
|
@ -2408,13 +2393,12 @@ void nmSubWndMain::updateSensitiveHistoryPlot()
|
|
|
|
|
plot->setReadOnly(true);
|
|
|
|
|
plot->freshAxisScales(true, true);
|
|
|
|
|
}
|
|
|
|
|
const bool restore = window->isHidden();
|
|
|
|
|
history->show();
|
|
|
|
|
window->widget()->show();
|
|
|
|
|
window->show();
|
|
|
|
|
// 历史图只显示曲线,隐藏框架默认的空数据表侧栏。
|
|
|
|
|
history->m_pTableHelper->hide();
|
|
|
|
|
if(created || restore) area->relayoutSubWnds();
|
|
|
|
|
window->raise();
|
|
|
|
|
window->activateWindow();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmSubWndMain::installSensitiveShow(QWidget* host)
|
|
|
|
|
@ -2464,23 +2448,22 @@ void nmSubWndMain::updateSensitiveHistogramPlot()
|
|
|
|
|
{
|
|
|
|
|
iSubWndFitting* fitting = m_pResultRefreshFitting.data();
|
|
|
|
|
nmDataAnalyzeManager* manager = m_pResultRefreshDataManager.data();
|
|
|
|
|
if(!fitting || !fitting->m_pMdiArea || !manager || !manager->getSensitiveData()) return;
|
|
|
|
|
ZxMdiArea* area = fitting->m_pMdiArea;
|
|
|
|
|
QMdiSubWindow* window = area->findChild<QMdiSubWindow*>("nmSensitivityHistogram");
|
|
|
|
|
if(!fitting || !manager || !manager->getSensitiveData()) return;
|
|
|
|
|
QDialog* window = fitting->findChild<QDialog*>("nmSensitivityHistogram");
|
|
|
|
|
const QSharedPointer<nmDataSensitive::BatchResult> batch = manager->getSensitiveData()->getResults();
|
|
|
|
|
if(batch.isNull() || batch->m_calcType != nmDataSensitive::CALC_MONTE_CARLO) {
|
|
|
|
|
// 新模型或确定性批次不保留上一批 Monte-Carlo 的统计图。
|
|
|
|
|
if(window) {
|
|
|
|
|
area->removeSubWindow(window);
|
|
|
|
|
window->close();
|
|
|
|
|
delete window;
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const bool created = window == nullptr;
|
|
|
|
|
if(created) {
|
|
|
|
|
QWidget* page = new QWidget;
|
|
|
|
|
QVBoxLayout* layout = new QVBoxLayout(page);
|
|
|
|
|
layout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
window = createResultDialog("nmSensitivityHistogram", tr("Sensitivity histogram plot"));
|
|
|
|
|
QWidget* page = window;
|
|
|
|
|
QVBoxLayout* layout = qobject_cast<QVBoxLayout*>(window->layout());
|
|
|
|
|
QHBoxLayout* options = new QHBoxLayout;
|
|
|
|
|
QPushButton* scatter = new QPushButton(tr("Scatter plot"), page);
|
|
|
|
|
scatter->setObjectName("nmScatterButton");
|
|
|
|
|
@ -2502,14 +2485,10 @@ void nmSubWndMain::updateSensitiveHistogramPlot()
|
|
|
|
|
plot->getAxisOf(i)->setVisible(true);
|
|
|
|
|
}
|
|
|
|
|
layout->addWidget(plot);
|
|
|
|
|
window = area->addSubWindow(page);
|
|
|
|
|
window->setObjectName("nmSensitivityHistogram");
|
|
|
|
|
window->setWindowTitle(tr("Sensitivity histogram plot"));
|
|
|
|
|
window->setAttribute(Qt::WA_DeleteOnClose, false);
|
|
|
|
|
connect(scatter, SIGNAL(clicked()), this, SLOT(onSensitiveScatter()));
|
|
|
|
|
connect(settings, SIGNAL(clicked()), this, SLOT(onSensitiveHistogramOptions()));
|
|
|
|
|
}
|
|
|
|
|
iGuiPlot* plot = window->widget()->findChild<iGuiPlot*>();
|
|
|
|
|
iGuiPlot* plot = window->findChild<iGuiPlot*>();
|
|
|
|
|
const int binCount = batch->m_nHistogramBins;
|
|
|
|
|
// 拟合参数与误差共用分箱绘制,轴名称和单位随本批选择同步切换。
|
|
|
|
|
const int variable = batch->m_nHistogramVariable;
|
|
|
|
|
@ -2600,11 +2579,10 @@ void nmSubWndMain::updateSensitiveHistogramPlot()
|
|
|
|
|
plot->setAxisScaleX(minimum, maximum, ticksX);
|
|
|
|
|
plot->setAxisScaleY(0.0, top, ticksY);
|
|
|
|
|
plot->setAxisScaleY2(0.0, 110.0, ticksY2);
|
|
|
|
|
const bool restore = window->isHidden();
|
|
|
|
|
plot->show();
|
|
|
|
|
window->widget()->show();
|
|
|
|
|
window->show();
|
|
|
|
|
if(created || restore) area->relayoutSubWnds();
|
|
|
|
|
window->raise();
|
|
|
|
|
window->activateWindow();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmSubWndMain::onSensitiveHistogramOptions()
|
|
|
|
|
@ -2612,13 +2590,13 @@ void nmSubWndMain::onSensitiveHistogramOptions()
|
|
|
|
|
// 设置窗口复用当前批次,分箱数在 Apply 或 OK 后才应用到直方图。
|
|
|
|
|
iSubWndFitting* fitting = m_pResultRefreshFitting.data();
|
|
|
|
|
nmDataAnalyzeManager* manager = m_pResultRefreshDataManager.data();
|
|
|
|
|
if(!fitting || !fitting->m_pMdiArea || !manager || !manager->getSensitiveData()) return;
|
|
|
|
|
QMdiSubWindow* window = fitting->m_pMdiArea->findChild<QMdiSubWindow*>("nmSensitivityHistogram");
|
|
|
|
|
if(!fitting || !manager || !manager->getSensitiveData()) return;
|
|
|
|
|
QDialog* window = fitting->findChild<QDialog*>("nmSensitivityHistogram");
|
|
|
|
|
const QSharedPointer<nmDataSensitive::BatchResult> batch = manager->getSensitiveData()->getResults();
|
|
|
|
|
if(!window || batch.isNull()) return;
|
|
|
|
|
nmWxSensitivityHistogramOptions* dialog = window->findChild<nmWxSensitivityHistogramOptions*>();
|
|
|
|
|
if(!dialog) {
|
|
|
|
|
dialog = new nmWxSensitivityHistogramOptions(batch, batch->m_nHistogramBins, window->widget());
|
|
|
|
|
dialog = new nmWxSensitivityHistogramOptions(batch, batch->m_nHistogramBins, window);
|
|
|
|
|
connect(dialog, SIGNAL(settingsChanged(int,int)), this, SLOT(onSensitiveHistogramSettingsChanged(int,int)));
|
|
|
|
|
connect(manager, SIGNAL(sigSensitiveResultsChanged()), dialog, SLOT(reject()));
|
|
|
|
|
}
|
|
|
|
|
@ -2637,8 +2615,8 @@ void nmSubWndMain::onSensitiveHistogramSettingsChanged(int bins, int variable)
|
|
|
|
|
batch->m_nHistogramVariable = variable;
|
|
|
|
|
batch->m_nHistogramBins = bins;
|
|
|
|
|
iSubWndFitting* fitting = m_pResultRefreshFitting.data();
|
|
|
|
|
if(!fitting || !fitting->m_pMdiArea) return;
|
|
|
|
|
QMdiSubWindow* window = fitting->m_pMdiArea->findChild<QMdiSubWindow*>("nmSensitivityHistogram");
|
|
|
|
|
if(!fitting) return;
|
|
|
|
|
QDialog* window = fitting->findChild<QDialog*>("nmSensitivityHistogram");
|
|
|
|
|
if(!window) return;
|
|
|
|
|
fitting->setModified(true);
|
|
|
|
|
updateSensitiveHistogramPlot();
|
|
|
|
|
@ -2661,10 +2639,10 @@ void nmSubWndMain::onSensitiveScatter()
|
|
|
|
|
// 与 Show 一样打开独立弹窗,重复点击时激活已有窗口。
|
|
|
|
|
iSubWndFitting* fitting = m_pResultRefreshFitting.data();
|
|
|
|
|
nmDataAnalyzeManager* manager = m_pResultRefreshDataManager.data();
|
|
|
|
|
if(!fitting || !fitting->m_pMdiArea || !manager || !manager->getSensitiveData()) return;
|
|
|
|
|
if(!fitting || !manager || !manager->getSensitiveData()) return;
|
|
|
|
|
const QSharedPointer<nmDataSensitive::BatchResult> batch = manager->getSensitiveData()->getResults();
|
|
|
|
|
if(batch.isNull() || batch->m_calcType != nmDataSensitive::CALC_MONTE_CARLO) return;
|
|
|
|
|
QMdiSubWindow* window = fitting->m_pMdiArea->findChild<QMdiSubWindow*>("nmSensitivityHistogram");
|
|
|
|
|
QDialog* window = fitting->findChild<QDialog*>("nmSensitivityHistogram");
|
|
|
|
|
if(!window) return;
|
|
|
|
|
nmWxSensitivityScatter* dialog = window->findChild<nmWxSensitivityScatter*>();
|
|
|
|
|
if(!dialog) {
|
|
|
|
|
@ -2677,7 +2655,7 @@ void nmSubWndMain::onSensitiveScatter()
|
|
|
|
|
well->m_oCurves.m_vecHistoryPressure, well->m_oCurves.m_vecResultPressure);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
dialog = new nmWxSensitivityScatter(batch, baseError, window->widget());
|
|
|
|
|
dialog = new nmWxSensitivityScatter(batch, baseError, window);
|
|
|
|
|
connect(dialog, SIGNAL(filterChanged()), this, SLOT(onSensitiveFilterChanged()));
|
|
|
|
|
// 构造时已应用初始阈值,连接完成后补一次结果面板同步。
|
|
|
|
|
onSensitiveFilterChanged();
|
|
|
|
|
|