From ad5aa34129d293592ef013b2cd94906f2311a340 Mon Sep 17 00:00:00 2001 From: simonyan <315082291@qq.com> Date: Thu, 10 Oct 2024 10:39:58 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=AE=8C=E6=88=90=E5=9C=B0=E8=B4=A8?= =?UTF-8?q?=E5=9B=BE=E5=AF=BC=E5=85=A5=E5=8A=9F=E8=83=BD=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Include/nmNum/nmData/nmDataDemo.h | 29 ++++++++- Include/nmNum/nmData/nmDefines.h | 10 ++- Include/nmNum/nmSubWnd/nmSubWndDemo.h | 9 +++ Include/nmNum/nmSubWxs/nmNewNormalDlg.h | 15 ++++- Src/nmNum/nmData/nmDataDemo.cpp | 53 +++++++++++---- Src/nmNum/nmSubWnd/nmSubWndDemo.cpp | 87 +++++++++++++++++-------- Src/nmNum/nmSubWnd/nmSubWndUtils.cpp | 11 +++- Src4/nmNum/nmSubWxs/nmSubWxs.pro | 8 +++ 8 files changed, 175 insertions(+), 47 deletions(-) diff --git a/Include/nmNum/nmData/nmDataDemo.h b/Include/nmNum/nmData/nmDataDemo.h index dea6163..fab94da 100644 --- a/Include/nmNum/nmData/nmDataDemo.h +++ b/Include/nmNum/nmData/nmDataDemo.h @@ -1,7 +1,11 @@ #pragma once -#include "ZxDataObjectDbl.h" #include "nmData_global.h" +#include "ZxDataObjectDbl.h" +#include "nmDefines.h" + +#include +#include // 这是数值试井数据对象的例子 // 对应的表结构参见 @@ -18,6 +22,7 @@ */ + class NM_DATA_EXPORT nmDataDemo : public ZxDataObjectDbl { ZX_DECLARE_DYNAMIC @@ -59,6 +64,19 @@ public: void setBottomDepth(const double& d); double getBottomDepth() const; + // 分析名称的Get和Set + void setAnalyzeName(const QString &newAnalyzeName); + const QString &analyzeName() const; + + void setAnalyzePVTIndex(int newAnalyzePVTIndex); + int analyzePVTIndex() const; + + int analyzeIIIndex() const; + void setAnalyzeIIIndex(int newAnalyzeIIIndex); + + const QList &analyzeMultiphase() const; + void setAnalyzeMultiphase(const QList &newAnalyzeMultiphase); + protected: // 与数据库关联的数据,如果父类已经定义,则无需再次定义 @@ -71,7 +89,14 @@ protected: double m_dBottomDepth; // QDSZ - + // 分析名称 + QString m_sAnalyzeName; + // 分析的多相流 + QList m_analyzeMultiphase; + // 分析的PVT,目前只支持选择已经存在的 + int m_iAnalyzePVTIndex; + // 分析的相渗,目前只支持选择已经存在的 + int m_iAnalyzeIIIndex; }; diff --git a/Include/nmNum/nmData/nmDefines.h b/Include/nmNum/nmData/nmDefines.h index 8eda03e..a8f88cd 100644 --- a/Include/nmNum/nmData/nmDefines.h +++ b/Include/nmNum/nmData/nmDefines.h @@ -1,11 +1,17 @@ #pragma once // 数值试井绘图对象类型 -enum NM_Obj_Type -{ +enum NM_Obj_Type { NOT_Point = 0, //点 NOT_Line, //线 NOT_Polygon, //多边形 NOT_Other, //其它 NOT_UNKNWON }; +// 多相流的类型 +enum NM_PHASE_TYPE { + PHASE_OIL, // 油 + PHASE_GAS, // 气 + PHASE_WATER, // 水 + PHASE_UNKNOWN // 其它 +}; diff --git a/Include/nmNum/nmSubWnd/nmSubWndDemo.h b/Include/nmNum/nmSubWnd/nmSubWndDemo.h index 5b8cbea..f8cd4b5 100644 --- a/Include/nmNum/nmSubWnd/nmSubWndDemo.h +++ b/Include/nmNum/nmSubWnd/nmSubWndDemo.h @@ -10,6 +10,7 @@ class nmGuiPlot; class ZxTableView; class iDockBaseWx; class nmWxParaProperty; +class nmDataDemo; class NM_SUB_WND_EXPORT nmSubWndDemo : public iSubWndBaseAF { @@ -99,6 +100,10 @@ public: QString sName, int nID, \ bool bLicensed); + // analyzeData setter and getter + nmDataDemo *analyzeData() const; + void setAnalyzeData(nmDataDemo *newAnalyzeData); + signals: public slots: @@ -115,6 +120,8 @@ public slots: private: // 地质图导入 void geologicalMapImport(); + // 隐藏公共的Dock视图 + void setTopDocksVisible(bool visible); private: @@ -136,4 +143,6 @@ private: QListWidget* m_pListWxTemp; #endif + // QDSZ + nmDataDemo* m_pAnalyzeData; }; diff --git a/Include/nmNum/nmSubWxs/nmNewNormalDlg.h b/Include/nmNum/nmSubWxs/nmNewNormalDlg.h index e6f0a24..ed2c27f 100644 --- a/Include/nmNum/nmSubWxs/nmNewNormalDlg.h +++ b/Include/nmNum/nmSubWxs/nmNewNormalDlg.h @@ -6,19 +6,32 @@ #include #include #include "nmSubWxs_global.h" +#include + +class nmDataDemo; class NM_SUB_WXS_EXPORT nmNewNormalDlg : public QDialog { Q_OBJECT public: - nmNewNormalDlg(); + nmNewNormalDlg(nmDataDemo*); ~nmNewNormalDlg(); private: // 布局器 QVBoxLayout* m_mainLayout; + // 分析名称 输入框 + QLineEdit * m_nameEdit; + // 相态选择 + QCheckBox* m_checkboxWater; + QCheckBox* m_checkboxOil; + QCheckBox* m_checkboxGas; + // PVT和相渗选择 QListWidget* m_pvtListWidget; QListWidget* m_iiListWidget; + // 数据类 + nmDataDemo* m_pAnalyzeData; + void initUI(); void renderComponents(); diff --git a/Src/nmNum/nmData/nmDataDemo.cpp b/Src/nmNum/nmData/nmDataDemo.cpp index 34d772d..b6c36d9 100644 --- a/Src/nmNum/nmData/nmDataDemo.cpp +++ b/Src/nmNum/nmData/nmDataDemo.cpp @@ -8,21 +8,17 @@ nmDataDemo::nmDataDemo() : ZxDataObjectDbl(0) //m_sID = ""; m_sWellCode = ""; //m_sName = ""; - m_dTopDepth = 0.00; m_dBottomDepth = 0.00; - m_sRemark = ""; m_sCth = "ndd"; - checkXmlTable(); } nmDataDemo::nmDataDemo(const nmDataDemo &other) : ZxDataObjectDbl(other) { - if (this == &other) - { + if (this == &other) { return; } checkXmlTable(); @@ -44,14 +40,12 @@ nmDataDemo &nmDataDemo::operator = (const nmDataDemo &other) //m_sName = other.m_sName; m_dTopDepth = other.m_dTopDepth; m_dBottomDepth = other.m_dBottomDepth; - return *this; } ZxDataObject* nmDataDemo::clone() { ensureLoaded(); - return (new nmDataDemo(*this)); } @@ -90,6 +84,46 @@ double nmDataDemo::getBottomDepth()const return m_dBottomDepth; } +void nmDataDemo::setAnalyzeName(const QString &newAnalyzeName) +{ + m_sAnalyzeName = newAnalyzeName; +} + +const QString &nmDataDemo::analyzeName() const +{ + return m_sAnalyzeName; +} + +void nmDataDemo::setAnalyzePVTIndex(int newAnalyzePVTIndex) +{ + m_iAnalyzePVTIndex = newAnalyzePVTIndex; +} + +int nmDataDemo::analyzePVTIndex() const +{ + return m_iAnalyzePVTIndex; +} + +int nmDataDemo::analyzeIIIndex() const +{ + return m_iAnalyzeIIIndex; +} + +void nmDataDemo::setAnalyzeIIIndex(int newAnalyzeIIIndex) +{ + m_iAnalyzeIIIndex = newAnalyzeIIIndex; +} + +const QList &nmDataDemo::analyzeMultiphase() const +{ + return m_analyzeMultiphase; +} + +void nmDataDemo::setAnalyzeMultiphase(const QList &newAnalyzeMultiphase) +{ + m_analyzeMultiphase = newAnalyzeMultiphase; +} + bool nmDataDemo::_parseData(VecVariant vec, int& n) { m_sCode = vec.at(n++).toString(); @@ -97,27 +131,23 @@ bool nmDataDemo::_parseData(VecVariant vec, int& n) m_sName = vec.at(n++).toString(); m_dTopDepth = vec.at(n++).toDouble(); m_dBottomDepth = vec.at(n++).toDouble(); - return ZxDataObjectDbl::_parseData(vec, n); } bool nmDataDemo::_sumUpData(VecVariant& vec) { ensureLoaded(); - vec.append(m_sCode); vec.append(m_sWellCode); vec.append(m_sName); vec.append(m_dTopDepth); vec.append(m_dBottomDepth); - return ZxDataObjectDbl::_sumUpData(vec); } void nmDataDemo::onSerialize(ZxSerializer* ser) { ZxDataObjectDbl::onSerialize(ser); - ser->write("WellCode", m_sWellCode); ser->write("TopDepth", m_dTopDepth); ser->write("BottomDepth", m_dBottomDepth); @@ -126,7 +156,6 @@ void nmDataDemo::onSerialize(ZxSerializer* ser) void nmDataDemo::onDeserialize(ZxSerializer* ser) { ZxDataObjectDbl::onDeserialize(ser); - ser->read("WellCode", m_sWellCode); ser->read("TopDepth", m_dTopDepth); ser->read("BottomDepth", m_dBottomDepth); diff --git a/Src/nmNum/nmSubWnd/nmSubWndDemo.cpp b/Src/nmNum/nmSubWnd/nmSubWndDemo.cpp index 3b7dc1f..3951b65 100644 --- a/Src/nmNum/nmSubWnd/nmSubWndDemo.cpp +++ b/Src/nmNum/nmSubWnd/nmSubWndDemo.cpp @@ -36,6 +36,7 @@ #include "nmWxParaProperty.h" #include "nmSubWndDemo.h" +#include "nmDataDemo.h" #include "nmDataLogFile.h" @@ -58,6 +59,7 @@ nmSubWndDemo::nmSubWndDemo(QWidget *parent, QString sExt) : m_pDataWell = zxCurWell; } m_sMdiWndType = s_MdiType_DataNum; +// m_analyzeData = new nmDataDemo(); setWindowTitle(tr("nmSubWndDemo")); } @@ -76,6 +78,7 @@ nmSubWndDemo::~nmSubWndDemo() m_pWxDockTemp = NULL; } #endif + this->setTopDocksVisible(true); } void nmSubWndDemo::configWnd() @@ -205,20 +208,31 @@ void nmSubWndDemo::initUiDockPtys() // 示例:演示增加Dock并且追加至程序主窗口 void nmSubWndDemo::initUiTop() { - // TODO,不创建新的Dock + // 隐藏所有Dock + this->setTopDocksVisible(false); + // 创建新的Dock + iDockBaseWx* pDockWx = new iDockBaseWx(tr("TODO:Demo")); + Q_ASSERT (NULL != pDockWx); + QListWidget* pListWx = new QListWidget(); + Q_ASSERT (NULL != pListWx); + pDockWx->setWidget(pListWx); + m_pListWxTemp = pListWx; + pDockWx->setMinimumWidth(_resoSizeW(200)); + emit sigAppendDock2Main(pDockWx, Qt::LeftDockWidgetArea); + m_pWxDockTemp = pDockWx; return; // 基础参数Dock - { - iDockBaseWx* pDockWx = new iDockBaseWx(tr("TODO:Demo")); - Q_ASSERT (NULL != pDockWx); - QListWidget* pListWx = new QListWidget(); - Q_ASSERT (NULL != pListWx); - pDockWx->setWidget(pListWx); - m_pListWxTemp = pListWx; - pDockWx->setMinimumWidth(_resoSizeW(200)); - emit sigAppendDock2Main(pDockWx, Qt::LeftDockWidgetArea); - m_pWxDockTemp = pDockWx; - } +// { +// iDockBaseWx* pDockWx = new iDockBaseWx(tr("TODO:Demo")); +// Q_ASSERT (NULL != pDockWx); +// QListWidget* pListWx = new QListWidget(); +// Q_ASSERT (NULL != pListWx); +// pDockWx->setWidget(pListWx); +// m_pListWxTemp = pListWx; +// pDockWx->setMinimumWidth(_resoSizeW(200)); +// emit sigAppendDock2Main(pDockWx, Qt::LeftDockWidgetArea); +// m_pWxDockTemp = pDockWx; +// } } #endif @@ -305,13 +319,6 @@ void nmSubWndDemo::finalDeals() void nmSubWndDemo::onActivated() { #ifdef QT_DEBUG - // TODO,主程序的Dock操作 - // 获取所有 Dock 视图 - QList dockWidgets = m_pMainWindow->findChildren(); - // TODO,遍历所有 Dock 视图并移除位于左侧的 - foreach (QDockWidget* dock, dockWidgets) { - dock->hide(); - } // 当前窗体激活时,可以做些事情,比如把隐藏的Dock显示出来 if (NULL != m_pWxDockTemp) { if (!m_pWxDockTemp->isVisible()) { @@ -561,19 +568,43 @@ void nmSubWndDemo::geologicalMapImport() // 打开文件对话框选择图片文件 QString filePath = QFileDialog::getOpenFileName(nullptr, "选择图片文件", "", "Images (*.png *.xpm *.jpg)"); if (!filePath.isEmpty()) { - // 加载图片 - QPixmap pixmap(filePath); -// if (!pixmap.isNull()) { -// // 创建标签并显示图片 -// QLabel label; -// label.setPixmap(pixmap); -// label.show(); -// } - m_pWxPlot->setBackgroundImg(pixmap); + // 画布 设置背景,并自适应宽高 + ZxPlot* pPlot = m_pWxPlot->m_pPlot; + pPlot->setBkImgFile(filePath); +// QImage* pBkImg = pPlot->getBkImg(); +// Q_ASSERT (NULL != pBkImg); +// int w = pBkImg->width(); +// int h = pBkImg->height(); +// pPlot->getMainAxisX()->setRangeMinMax(0, w, true); +// pPlot->getMainAxisY()->setRangeMinMax(0, h, true); nmDataLogFile::getInstance()->writeLog(filePath); } } +void nmSubWndDemo::setTopDocksVisible(bool visible) +{ + // 获取主程序所有 Dock 视图 + QList dockWidgets = m_pMainWindow->findChildren(); + // 遍历所有 Dock 视图并移除位于左侧的 + foreach (QDockWidget* dock, dockWidgets) { + if (visible) { + dock->show(); + } else { + dock->hide(); + } + } +} + +void nmSubWndDemo::setAnalyzeData(nmDataDemo *newAnalyzeData) +{ + m_pAnalyzeData = newAnalyzeData; +} + +nmDataDemo *nmSubWndDemo::analyzeData() const +{ + return m_pAnalyzeData; +} + bool nmSubWndDemo::onConfirmClosing() { return iSubWndBaseAF::onConfirmClosing(); diff --git a/Src/nmNum/nmSubWnd/nmSubWndUtils.cpp b/Src/nmNum/nmSubWnd/nmSubWndUtils.cpp index 792e1b6..20d4e78 100644 --- a/Src/nmNum/nmSubWnd/nmSubWndUtils.cpp +++ b/Src/nmNum/nmSubWnd/nmSubWndUtils.cpp @@ -11,6 +11,7 @@ #include "nmNewDlg.h" #include "nmNewNormalDlg.h" #include "nmWxParaProperty.h" +#include "nmDataDemo.h" #include @@ -28,15 +29,21 @@ iSubWnd* nmSubWndUtils::createSubWnd(QString sID, QString sExt) // Here is your own codes int nID = sID.toInt(); if (nID == 5101) { + // 初始化一个数据类 + nmDataDemo* analyzeData = new nmDataDemo(); // TODO,先弹窗做新建分析,再创建subWnd - nmNewNormalDlg* dlg = new nmNewNormalDlg(); + nmNewNormalDlg* dlg = new nmNewNormalDlg(analyzeData); dlg->exec(); if(dlg->result() == QDialog::Rejected) { // 对话框被用户显式拒绝 // 在这里处理你的逻辑 + delete analyzeData; + analyzeData = NULL; return nullptr; } - pSubWnd = new nmSubWndDemo(NULL, sExt); + nmSubWndDemo* pSubWndDemo = new nmSubWndDemo(NULL, sExt); + pSubWndDemo->setAnalyzeData(analyzeData); + pSubWnd = pSubWndDemo; } if (NULL != pSubWnd) { // TODO 此处根据需要设置 改变 标识 diff --git a/Src4/nmNum/nmSubWxs/nmSubWxs.pro b/Src4/nmNum/nmSubWxs/nmSubWxs.pro index ebedf98..0a831aa 100644 --- a/Src4/nmNum/nmSubWxs/nmSubWxs.pro +++ b/Src4/nmNum/nmSubWxs/nmSubWxs.pro @@ -31,6 +31,9 @@ INCLUDEPATH += $${wtInclude}/iData/iXmlManager INCLUDEPATH += $${wtInclude}/iData/iXmlManager/Models INCLUDEPATH += $${wtInclude}/iData/iSysUtils +INCLUDEPATH += $${wtInclude}/iData/iDataPool +INCLUDEPATH += $${wtInclude}/iData/iDataEngine + INCLUDEPATH += $${wtInclude}/iGui INCLUDEPATH += $${wtInclude}/iGui/iGuiBase INCLUDEPATH += $${wtInclude}/iGui/iGuiGridPty @@ -39,6 +42,11 @@ INCLUDEPATH += $${wtInclude}/nmNum INCLUDEPATH += $${wtInclude}/nmNum/nmSubWxs INCLUDEPATH += $${wtInclude}/nmNum/nmSubWxs/SubWxs +INCLUDEPATH += $${wtInclude}/mData +INCLUDEPATH += $${wtInclude}/mData/mModuleDefines +INCLUDEPATH += $${wtInclude}/mData/mProjectManager +INCLUDEPATH += $${wtInclude}/mData/mProjectManager/DataModels + SOURCES += $${wtSrc}/nmNum/nmSubWxs/*.cpp HEADERS += $${wtInclude}/nmNum/nmSubWxs/*.h #FORMS += $${wtSrc}/nmNum/nmSubWxs/SubWxs/*.ui