diff --git a/Include/nmNum/nmSubWxs/nmRCDialog.h b/Include/nmNum/nmSubWxs/nmRCDialog.h deleted file mode 100644 index 8d5b01e..0000000 --- a/Include/nmNum/nmSubWxs/nmRCDialog.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef NMRCDIALOG_H -#define NMRCDIALOG_H - -#include -#include -#include "nmSubWxs_global.h" - -class QTableWidget; - -// 储层特性 -class NM_SUB_WXS_EXPORT nmRCDialog : public QDialog -{ - Q_OBJECT -public: - nmRCDialog(); - -private slots: - void on_save(); - -private: - void initUI(); - -private: - QTableWidget* m_pTableWidget; -}; - -#endif // NMRCDIALOG_H diff --git a/Include/nmNum/nmSubWxs/nmWxRCDialog.h b/Include/nmNum/nmSubWxs/nmWxRCDialog.h new file mode 100644 index 0000000..877e302 --- /dev/null +++ b/Include/nmNum/nmSubWxs/nmWxRCDialog.h @@ -0,0 +1,29 @@ +#ifndef NMWXRCDIALOG_H +#define NMWXRCDIALOG_H + +#include +#include +#include "nmSubWxs_global.h" + +class QTableWidget; + +// 鍌ㄥ眰鐗规€ +class NM_SUB_WXS_EXPORT nmWxRCDialog : public QDialog +{ + Q_OBJECT +public: + nmWxRCDialog(); + +private slots: + void on_save(); + +private: + void initUI(); + QWidget* initOilReservoirUI(); + QWidget* initWellsUI(); + +private: + QTableWidget* m_pTableWidget; +}; + +#endif // NMWXRCDIALOG_H diff --git a/Include/nmNum/nmSubWxs/nmWxRCWell.h b/Include/nmNum/nmSubWxs/nmWxRCWell.h new file mode 100644 index 0000000..3eaf488 --- /dev/null +++ b/Include/nmNum/nmSubWxs/nmWxRCWell.h @@ -0,0 +1,63 @@ +#ifndef NMWXRCWELL_H +#define NMWXRCWELL_H + +#include + +class QListWidget; +class QLineEdit; +class QTableWidget; + +class nmWxRCWell : public QWidget +{ + Q_OBJECT +public: + explicit nmWxRCWell(QVector wellNames, QVector wellsRadius, QWidget *parent = nullptr); + +signals: +private slots: + // 选择井 + void on_selectWell(int index); + // 修改表皮系数 + void on_wellSkinChanged(QString); +private: + // 根据井的数量,先初始化默认值 + void initDefaultValue(); + // 初始化UI + void initUI(); + QListWidget* initListWidget(); + QWidget* initWellDetailWidget(); + + // 展示井的详情 + void showWellDetail(int index); +private: + // 井的数量 + QVector m_vWellNames; + // 井的半径 + QVector m_vWellsRadius; + // 井的表皮系数 + QVector m_vWellsSkin; + // 井储系数 + QVector m_vWellsReservoirFactor; + // 井的流量段,比如:井的流量段时2,则有2个持续时间和2个流量 + QVector m_vWellsTimeNum; + // 井的流量持续时间组 + QVector> m_vWellTimes; + // 井的流量组 + QVector> m_vWellFlows; + + // 井列表 + QListWidget* m_pWellListWidget; + // 井半径 + QLineEdit* m_pWellRadiusEdit; + // 井的表皮系数 + QLineEdit* m_pWellSkinEdit ; + // 井储系数 + QLineEdit* m_pWellReservoirFactorEdit; + // 井的流量段,比如:井的流量段时2,则有2个持续时间和2个流量 + QLineEdit* m_pWellTimeEdit; + + // 设置流量段数据的table + QTableWidget* m_pTimeTableWidget; +}; + +#endif // NMWXRCWELL_H diff --git a/Src/nmNum/nmSubWnd/nmSubWndMain.cpp b/Src/nmNum/nmSubWnd/nmSubWndMain.cpp index 9e68dbb..aa4547b 100644 --- a/Src/nmNum/nmSubWnd/nmSubWndMain.cpp +++ b/Src/nmNum/nmSubWnd/nmSubWndMain.cpp @@ -47,7 +47,7 @@ #include "nmObjPointWell.h" -#include "nmRCDialog.h" +#include "nmWxRCDialog.h" #include @@ -877,10 +877,10 @@ bool nmSubWndMain::onConfirmClosing() void nmSubWndMain::reservoirCharacteristics() { // 显示储藏特性的弹窗,设置参数,并保持到文件 - nmRCDialog* dlg = new nmRCDialog; + nmWxRCDialog* dlg = new nmWxRCDialog; dlg->exec(); } void nmSubWndMain::geoLayering() { -} +} \ No newline at end of file diff --git a/Src/nmNum/nmSubWxs/nmRCDialog.cpp b/Src/nmNum/nmSubWxs/nmWxRCDialog.cpp similarity index 81% rename from Src/nmNum/nmSubWxs/nmRCDialog.cpp rename to Src/nmNum/nmSubWxs/nmWxRCDialog.cpp index 67c850c..efe0092 100644 --- a/Src/nmNum/nmSubWxs/nmRCDialog.cpp +++ b/Src/nmNum/nmSubWxs/nmWxRCDialog.cpp @@ -1,20 +1,22 @@ -#include "nmRCDialog.h" +#include "nmWxRCDialog.h" #include #include #include #include #include #include +#include #include "ZxBaseUtil.h" +#include "nmWxRCWell.h" -nmRCDialog::nmRCDialog() +nmWxRCDialog::nmWxRCDialog() { this->initUI(); - this->resize(800, 360); + this->resize(800, 720); } -void nmRCDialog::on_save() +void nmWxRCDialog::on_save() { // 检查第1列是否都写了值,如何不全则不能提交 QStringList valueList; @@ -45,10 +47,33 @@ void nmRCDialog::on_save() this->accept(); } -void nmRCDialog::initUI() +void nmWxRCDialog::initUI() { QVBoxLayout* mainLayout = new QVBoxLayout; this->setLayout(mainLayout); + QTabWidget* tabWidget = new QTabWidget; + mainLayout->addWidget(tabWidget); + // 油藏属性设置 + tabWidget->addTab(this->initOilReservoirUI(), tr("OilReservoir")); + tabWidget->addTab(this->initWellsUI(), tr("Wells")); + // 井属性设置 + // 下方的操作按钮 + // 底部按钮 + QHBoxLayout* hLayout = new QHBoxLayout; + QPushButton* saveBT = new QPushButton("Save"); + QPushButton* cancelBT = new QPushButton("Cancel"); + connect(saveBT, SIGNAL(clicked()), this, SLOT(on_save())); + connect(cancelBT, SIGNAL(clicked()), this, SLOT(reject())); + hLayout->addStretch(); + hLayout->addWidget(saveBT); + hLayout->addWidget(cancelBT); + mainLayout->addLayout(hLayout); +} + + +QWidget* nmWxRCDialog::initOilReservoirUI() +{ + QVBoxLayout* mainLayout = new QVBoxLayout; m_pTableWidget = new QTableWidget; // 设置为3列, // 第一列是 名称,也是垂直的表头 @@ -100,16 +125,17 @@ void nmRCDialog::initUI() m_pTableWidget->setItem(row, column, item); } } - mainLayout->addWidget(m_pTableWidget); - // 下方的操作按钮 - // 底部按钮 - QHBoxLayout* hLayout = new QHBoxLayout; - QPushButton* saveBT = new QPushButton("Save"); - QPushButton* cancelBT = new QPushButton("Cancel"); - connect(saveBT, SIGNAL(clicked()), this, SLOT(on_save())); - connect(cancelBT, SIGNAL(clicked()), this, SLOT(reject())); - hLayout->addStretch(); - hLayout->addWidget(saveBT); - hLayout->addWidget(cancelBT); - mainLayout->addLayout(hLayout); + return m_pTableWidget; +} + +QWidget* nmWxRCDialog::initWellsUI() +{ + QVector wellNames; + wellNames.append("well1"); + wellNames.append("well2"); + QVector wellRadius; + wellRadius.append(0.05); + wellRadius.append(0.03); + nmWxRCWell* widget = new nmWxRCWell(wellNames, wellRadius, NULL); + return widget; } diff --git a/Src/nmNum/nmSubWxs/nmWxRCWell.cpp b/Src/nmNum/nmSubWxs/nmWxRCWell.cpp new file mode 100644 index 0000000..c7dffa4 --- /dev/null +++ b/Src/nmNum/nmSubWxs/nmWxRCWell.cpp @@ -0,0 +1,107 @@ +#include "nmWxRCWell.h" +#include +#include +#include +#include +#include +#include +#include + +nmWxRCWell::nmWxRCWell(QVector wellNames, QVector wellsRadius, QWidget *parent) : + m_vWellNames(wellNames), m_vWellsRadius(wellsRadius), QWidget(parent) +{ + this->initDefaultValue(); + this->initUI(); +} + +void nmWxRCWell::on_selectWell(int index) +{ + qDebug() << index; + this->showWellDetail(index); +} + +void nmWxRCWell::on_wellSkinChanged(QString v) +{ + int index = m_pWellListWidget->currentRow(); + m_vWellsSkin[index] = v.toDouble(); +} + +void nmWxRCWell::initDefaultValue() +{ + // 根据井的数量初始化默认值 + for (int i = 0; i < m_vWellNames.size(); i++) { + // 井的表皮系数 + m_vWellsSkin.append(0); + // 井储系数 + m_vWellsReservoirFactor.append(0.1); + // 流量段 + m_vWellsTimeNum.append(2); + } +} + +void nmWxRCWell::initUI() +{ + QHBoxLayout* layout = new QHBoxLayout; + this->setLayout(layout); + QListWidget* wellListWidget = this->initListWidget(); + // 坐标的列表页 + layout->addWidget(wellListWidget); + QWidget* detailWidget = this->initWellDetailWidget(); + // 右边的详情页 + layout->addWidget(detailWidget); + // 设置宽度比例 + layout->setStretchFactor(wellListWidget, 1); + layout->setStretchFactor(detailWidget, 2); + + // 设置默认是第1口井 + wellListWidget->setCurrentRow(0); +} + +QListWidget* nmWxRCWell::initListWidget() +{ + m_pWellListWidget = new QListWidget; + m_pWellListWidget->addItems(m_vWellNames.toList()); + connect(m_pWellListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(on_selectWell(int))); + return m_pWellListWidget; +} + +QWidget* nmWxRCWell::initWellDetailWidget() +{ + QWidget* detailWidget = new QWidget; + QVBoxLayout* mainLayout = new QVBoxLayout; + detailWidget->setLayout(mainLayout); + // 1、井的通用设置 + QFormLayout* layout = new QFormLayout; + // 显示井的半径 + m_pWellRadiusEdit = new QLineEdit; + m_pWellRadiusEdit->setEnabled(false); + layout->addRow(new QLabel(tr("radius")), m_pWellRadiusEdit); + // 井的表皮系数 + m_pWellSkinEdit = new QLineEdit; + connect(m_pWellSkinEdit, SIGNAL(textChanged(QString)), this, SLOT(on_wellSkinChanged(QString))); + layout->addRow(new QLabel(tr("skin")), m_pWellSkinEdit); + // 井储系数 + m_pWellReservoirFactorEdit = new QLineEdit; + layout->addRow(new QLabel(tr("RF")), m_pWellReservoirFactorEdit); + // 井的流量段,比如:井的流量段时2,则有2个持续时间和2个流量 + m_pWellTimeEdit = new QLineEdit; + layout->addRow(new QLabel(tr("TimeNum")), m_pWellTimeEdit); + mainLayout->addLayout(layout); + // 勾选是 统一设置,还是 单独设置 + // 2、井的流量设置 + m_pTimeTableWidget = new QTableWidget; + mainLayout->addWidget(m_pTimeTableWidget); + return detailWidget; +} + +void nmWxRCWell::showWellDetail(int index) +{ + qDebug() << "show well detail " << index << m_vWellsRadius.size(); + m_pWellRadiusEdit->setText(QString::number(m_vWellsRadius[index])); + // 井的表皮系数 + m_pWellSkinEdit->setText(QString::number(m_vWellsSkin[index])); + // 井储系数 + m_pWellReservoirFactorEdit->setText(QString::number(m_vWellsReservoirFactor[index])); + // 井的流量段,比如:井的流量段时2,则有2个持续时间和2个流量 + m_pWellTimeEdit->setText(QString::number(m_vWellsTimeNum[index])); +} \ No newline at end of file