|
|
|
|
|
#include "zxLogInstance.h"
|
|
|
|
|
|
#include "ZxBaHelper.h"
|
|
|
|
|
|
#include "ZxResolutionHelper.h"
|
|
|
|
|
|
#include "zxSysUtils.h"
|
|
|
|
|
|
#include "ZxPtyDock.h"
|
|
|
|
|
|
#include "iDockBaseWx.h"
|
|
|
|
|
|
#include "ZxMainWindow.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "ZxSubAxisX.h"
|
|
|
|
|
|
#include "ZxSubAxisY.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "ZxPlot.h"
|
|
|
|
|
|
#include "ZxObjCurve.h"
|
|
|
|
|
|
#include "ZxSubTitle.h"
|
|
|
|
|
|
#include "tCurvePlotScene.h"
|
|
|
|
|
|
#include "tCurvePlotView.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "ZxTableView.h"
|
|
|
|
|
|
#include "ZxTableModel.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "mModuleDefines.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "ZxDataWell.h"
|
|
|
|
|
|
#include "ZxDataProject.h"
|
|
|
|
|
|
#include "ZxRstJobWnd.h"
|
|
|
|
|
|
#ifdef QT_DEBUG
|
|
|
|
|
|
#include "ZxDataGaugeP.h"
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef QT_DEBUG
|
|
|
|
|
|
#include "nmXmlHelper.h"
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#include "nmSubWndGrid.h"
|
|
|
|
|
|
#include "nmDataDemo.h"
|
|
|
|
|
|
#include "nmDataLogFile.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "nmGuiPlot.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "nmWxGridVTKContainerWidget.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "nmCalculationUtils.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "nmCalculationPebiGrid.h"
|
|
|
|
|
|
#include "nmCalculationPebiGridTask.h"
|
|
|
|
|
|
#include "nmDataAnalyzeManager.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "QListWidget.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include <QVector>
|
|
|
|
|
|
#include <QProcess>
|
|
|
|
|
|
#include <QTimer>
|
|
|
|
|
|
|
|
|
|
|
|
#include "ZxRstWnd.h"
|
|
|
|
|
|
|
|
|
|
|
|
nmSubWndGrid::nmSubWndGrid(QWidget *parent, QString sExt, double pebiGridControl, bool bGeneratePebiGrid) :
|
|
|
|
|
|
iSubWndBaseFit(parent, sExt),
|
|
|
|
|
|
m_mainLayout(nullptr),
|
|
|
|
|
|
m_vtkWidget(nullptr),
|
|
|
|
|
|
m_pDebounceTimer(nullptr),
|
|
|
|
|
|
m_dPebiGridControl(pebiGridControl),
|
|
|
|
|
|
m_bGeneratePebiGrid(bGeneratePebiGrid)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_sMdiWndType = s_MdiType_DataAnal;
|
|
|
|
|
|
setWindowTitle(tr("nmSubWndGrid"));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nmSubWndGrid::~nmSubWndGrid()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void nmSubWndGrid::configWnd(QString sPrevInfo)
|
|
|
|
|
|
{
|
|
|
|
|
|
iSubWndBaseFit::configWnd(sPrevInfo);
|
|
|
|
|
|
|
|
|
|
|
|
if(NULL != m_pMainWindow) {
|
|
|
|
|
|
disconnect(this, SIGNAL(sigAppendDock2Main(iDockBaseWx*, Qt::DockWidgetArea)), \
|
|
|
|
|
|
m_pMainWindow, SLOT(slotAppendDock2Main(iDockBaseWx*, Qt::DockWidgetArea)));
|
|
|
|
|
|
connect(this, SIGNAL(sigAppendDock2Main(iDockBaseWx*, Qt::DockWidgetArea)), \
|
|
|
|
|
|
m_pMainWindow, SLOT(slotAppendDock2Main(iDockBaseWx*, Qt::DockWidgetArea)));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
initUI();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool nmSubWndGrid::loadRsts()
|
|
|
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool nmSubWndGrid::saveRsts()
|
|
|
|
|
|
{
|
|
|
|
|
|
ZxRstWnd* pRstWnd = this->getRstUtilWnd();
|
|
|
|
|
|
if (nullptr == pRstWnd)
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return pRstWnd->save();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void nmSubWndGrid::initUI()
|
|
|
|
|
|
{
|
|
|
|
|
|
QWidget* mainWidget = new QWidget(this);
|
|
|
|
|
|
// 设置 mainWidget 的布局和尺寸策略
|
|
|
|
|
|
mainWidget->setLayout(new QVBoxLayout(mainWidget)); // 确保 mainWidget 有自己的布局
|
|
|
|
|
|
mainWidget->layout()->setContentsMargins(0, 0, 0, 0); // 移除边距
|
|
|
|
|
|
mainWidget->layout()->setSpacing(0); // 移除间距
|
|
|
|
|
|
mainWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // 扩展策略
|
|
|
|
|
|
|
|
|
|
|
|
setCentralWidget(mainWidget);
|
|
|
|
|
|
|
|
|
|
|
|
// m_mainLayout 应该直接是 mainWidget 的布局
|
|
|
|
|
|
m_mainLayout = qobject_cast<QVBoxLayout*>(mainWidget->layout());
|
|
|
|
|
|
|
|
|
|
|
|
// 当前不是加载进来的网格,都需要根据Map几何生成新的PEBI网格
|
|
|
|
|
|
if (m_bGeneratePebiGrid)
|
|
|
|
|
|
{
|
|
|
|
|
|
generatePebiGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_vtkWidget = new nmWxGridVTKContainerWidget(this);
|
|
|
|
|
|
m_vtkWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // 扩展策略
|
|
|
|
|
|
m_mainLayout->addWidget(m_vtkWidget);
|
|
|
|
|
|
|
|
|
|
|
|
// 首次创建
|
|
|
|
|
|
//if(generatePebiGrid()) {
|
|
|
|
|
|
// // nmWxGridVTKContainerWidget 的尺寸策略
|
|
|
|
|
|
// m_vtkWidget = new nmWxGridVTKContainerWidget(this);
|
|
|
|
|
|
// m_vtkWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // 扩展策略
|
|
|
|
|
|
// m_mainLayout->addWidget(m_vtkWidget);
|
|
|
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QWidget* nmSubWndGrid::initUiMainWx()
|
|
|
|
|
|
{
|
|
|
|
|
|
return nullptr;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool nmSubWndGrid::runCmdBy(QString sName, QString sID)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(sID.toInt() == 5401) {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool nmSubWndGrid::generatePebiGrid()
|
|
|
|
|
|
{
|
|
|
|
|
|
// PEBI网格
|
|
|
|
|
|
nmCalculationPebiGrid* pPebiGridGeneratorInstance = nmCalculationPebiGrid::getInstance();
|
|
|
|
|
|
|
|
|
|
|
|
// 当前流程只保留PEBI网格;这里仍写入数据中心,供求解和后处理的旧判断继续使用。
|
|
|
|
|
|
nmDataAnalyzeManager::getCurrentInstance()->setGridType(NM_Grid_PEBI);
|
|
|
|
|
|
|
|
|
|
|
|
// 将对话框中的GridControl传给PEBI输入参数GridControl
|
|
|
|
|
|
pPebiGridGeneratorInstance->setGridControl(m_dPebiGridControl);
|
|
|
|
|
|
// 生成PEBI非结构化网格对象
|
|
|
|
|
|
return pPebiGridGeneratorInstance->meshGenPebi();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void nmSubWndGrid::updateGrid()
|
|
|
|
|
|
{
|
|
|
|
|
|
// dataChanged可能连续触发,使用当前窗口自己的定时器合并为一次网格重建
|
|
|
|
|
|
if(!m_pDebounceTimer) {
|
|
|
|
|
|
m_pDebounceTimer = new QTimer(this);
|
|
|
|
|
|
m_pDebounceTimer->setSingleShot(true); // 单次触发
|
|
|
|
|
|
connect(m_pDebounceTimer, SIGNAL(timeout()), this, SLOT(onDebounceTimeout()));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_pDebounceTimer->start(500); // 500ms 防抖
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void nmSubWndGrid::onDebounceTimeout()
|
|
|
|
|
|
{
|
|
|
|
|
|
// 数据变更后重新生成网格时继续沿用当前窗口的GridControl
|
|
|
|
|
|
nmCalculationPebiGrid::getInstance()->setGridControl(m_dPebiGridControl);
|
|
|
|
|
|
nmCalculationPebiGridTask *task = new nmCalculationPebiGridTask(this);
|
|
|
|
|
|
connect(task, SIGNAL(pebiGridGenerated(bool)),
|
|
|
|
|
|
this, SLOT(onPebiGridGenerated(bool)));
|
|
|
|
|
|
connect(task, SIGNAL(finished()), task, SLOT(deleteLater()));
|
|
|
|
|
|
task->start();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void nmSubWndGrid::onPebiGridGenerated(bool success)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!success) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
// 删除旧的 VTK 控件
|
|
|
|
|
|
if (m_vtkWidget) {
|
|
|
|
|
|
m_mainLayout->removeWidget(m_vtkWidget);
|
|
|
|
|
|
delete m_vtkWidget;
|
|
|
|
|
|
m_vtkWidget = nullptr;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 创建新的 VTK 控件,并将其加入布局
|
|
|
|
|
|
m_vtkWidget = new nmWxGridVTKContainerWidget(this);
|
|
|
|
|
|
// 设置新创建的 nmWxGridVTKContainerWidget 的尺寸策略**
|
|
|
|
|
|
m_vtkWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // 扩展策略
|
|
|
|
|
|
m_mainLayout->addWidget(m_vtkWidget);
|
|
|
|
|
|
}
|