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.
nmWTAI-Platform/Src/nmNum/nmSubWxs/nmWxReservoirPropertiesDlg.cpp

575 lines
23 KiB
C++

#include "nmWxReservoirPropertiesDlg.h"
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QHeaderView>
#include <QComboBox>
#include <QCheckBox>
#include <QLabel>
#include <QLineEdit>
#include "ZxBaseUtil.h"
#include <QScrollArea>
#include "nmWxParameterProperty.h"
#include "nmDataAnalyzeManager.h"
#include "nmDataWellBase.h"
#include "nmGUIDrawerWidget.h"
#include "nmGUIComponentLineEdit.h"
#include "nmGUIComponentComboBox.h"
nmWxReservoirPropertiesDlg::nmWxReservoirPropertiesDlg() {
initParameters(); // 参数初始化
initUI(); // 初始化界面
setWindowTitle(tr("Reservoir Properties"));
resize(800, 600);
}
nmWxReservoirPropertiesDlg::~nmWxReservoirPropertiesDlg() {
// 删除UI组件
qDeleteAll(m_listAllComponents);
}
void nmWxReservoirPropertiesDlg::initParameters() {
m_verticalWells.clear();
m_verticalFracturedWells.clear();
m_horizontalFracturedWells.clear();
m_vecDataFaults.clear();
m_vecDataFractures.clear();
m_vecDataRegions.clear();
// 加载已有井数据
QVector<nmDataWellBase*> listWellData = nmDataAnalyzeManager::getCurrentInstance()->getWellDataList();
// 遍历并分类井数据
foreach (nmDataWellBase* well, listWellData) {
if (auto vfWell = dynamic_cast<nmDataVerticalFracturedWell*>(well)) {
m_verticalFracturedWells.append(*vfWell);
}
else if (auto hfWell = dynamic_cast<nmDataHorizontalFracturedWell*>(well)) {
m_horizontalFracturedWells.append(*hfWell);
}
else if (auto vWell = dynamic_cast<nmDataVerticalWell*>(well)) {
m_verticalWells.append(*vWell);
}
else if (auto hWell = dynamic_cast<nmDataHorizontalWell*>(well)) {
m_horizontalWells.append(*hWell);
}
}
// 保存初始的几何参数,用于检测是否重绘网格
m_previousVerticalWells = m_verticalWells;
m_previousHorizontalWells = m_horizontalWells;
m_previousVerticalFracturedWells = m_verticalFracturedWells;
m_previousHorizontalFracturedWells = m_horizontalFracturedWells;
// 获取油藏参数
m_reservior = nmDataAnalyzeManager::getCurrentInstance()->getReservoirDataCopy();
//获取区域标记参数
m_vecRegionMark = nmDataAnalyzeManager::getCurrentInstance()->getRegionMarkDataListCopy();
// 获取断层参数
m_vecDataFaults= nmDataAnalyzeManager::getCurrentInstance()->getFaultDataListCopy();
// 获取裂缝参数
m_vecDataFractures = nmDataAnalyzeManager::getCurrentInstance()->getFractureDataListCopy();
// 获取复合区参数
m_vecDataRegions = nmDataAnalyzeManager::getCurrentInstance()->getRegionDataListCopy();
}
void nmWxReservoirPropertiesDlg::initUI() {
m_pMainLayout = new QVBoxLayout();
this->setLayout(m_pMainLayout);
m_pTabWidget = new QTabWidget();
m_pMainLayout->addWidget(m_pTabWidget);
m_pTabWidget->addTab(initParametersUI(), tr("Parameters"));
// tabWidget->addTab(initLayerPropertiesUI(), tr("Layer properties"));
QHBoxLayout* buttonLayout = new QHBoxLayout;
QPushButton* okButton = new QPushButton(tr("OK"), this);
QPushButton* cancelButton = new QPushButton(tr("Cancel"), this);
connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
buttonLayout->addStretch();
buttonLayout->addWidget(okButton);
buttonLayout->addWidget(cancelButton);
m_pMainLayout->addLayout(buttonLayout);
}
QWidget* nmWxReservoirPropertiesDlg::initParametersUI() {
QWidget* container = new QWidget;
container->setStyleSheet("background-color: white;"); // 设置容器白底
QVBoxLayout* containerLayout = new QVBoxLayout(container);
QScrollArea* scrollArea = new QScrollArea;
scrollArea->setWidgetResizable(true);
scrollArea->setStyleSheet("QScrollArea { background-color: white; }"); // 设置滚动区域白底
QWidget* scrollContent = new QWidget;
scrollContent->setStyleSheet("background-color: white;"); // 设置滚动内容白底
QVBoxLayout* contentLayout = new QVBoxLayout(scrollContent);
//dimensionlessCheckbox = new QCheckBox(tr("Use dimensionless parameters (M,D)"), container);
//layout->addWidget(dimensionlessCheckbox);
QHBoxLayout* filterLayout = new QHBoxLayout;
QLabel* showLabel = new QLabel(tr("Show:"), container);
m_pShowComboBox = new QComboBox(container);
m_pShowComboBox->addItems(QStringList() << tr("All")
<< tr("Tested Well")
<< tr("Reservoir")
<< tr("Layer #1")
<< tr("Layer #1 - Region #1")
<< tr("Layer #1 - Region #2")
<< tr("Layer #2"));
filterLayout->addWidget(showLabel);
filterLayout->addWidget(m_pShowComboBox);
filterLayout->addStretch();
contentLayout->addLayout(filterLayout);
// Add all property components
setupVerticalWells(contentLayout);
//setupHorizontalWells(contentLayout);
setupVerticalFracturedWells(contentLayout);
setupHorizontalFracturedWells(contentLayout);
setupReserviorProperties(contentLayout);
setupRegionMarkProperties(contentLayout);
setupContourFaultProperties(contentLayout);
contentLayout->addStretch();
scrollArea->setWidget(scrollContent);
containerLayout->addWidget(scrollArea);
return container;
}
void nmWxReservoirPropertiesDlg::setupVerticalWells(QVBoxLayout *layout) {
for (int i = 0; i < m_verticalWells.size(); ++i) {
nmDataVerticalWell& well = m_verticalWells[i];
nmGUIDrawerWidget* drawer = new nmGUIDrawerWidget(well.getWellName() + tr(" - Vertical"));
QVBoxLayout* wellLayout = new QVBoxLayout;
addWellComponents(wellLayout, well);
drawer->setContentLayout(wellLayout);
layout->addWidget(drawer);
}
}
void nmWxReservoirPropertiesDlg::setupHorizontalWells(QVBoxLayout *layout) {
for (int i = 0; i < m_horizontalWells.size(); ++i) {
nmDataHorizontalWell& well = m_horizontalWells[i];
nmGUIDrawerWidget* drawer = new nmGUIDrawerWidget(well.getWellName() + tr(" - Horizontal"));
QVBoxLayout* wellLayout = new QVBoxLayout;
addWellComponents(wellLayout, well);
drawer->setContentLayout(wellLayout);
layout->addWidget(drawer);
}
}
void nmWxReservoirPropertiesDlg::setupVerticalFracturedWells(QVBoxLayout *layout) {
for (int i = 0; i < m_verticalFracturedWells.size(); ++i) {
nmDataVerticalFracturedWell& well = m_verticalFracturedWells[i];
nmGUIDrawerWidget* drawer = new nmGUIDrawerWidget(well.getWellName() + tr(" - Vertical Fractured"));
QVBoxLayout* wellLayout = new QVBoxLayout;
addWellComponents(wellLayout, well);
drawer->setContentLayout(wellLayout);
layout->addWidget(drawer);
}
}
void nmWxReservoirPropertiesDlg::setupHorizontalFracturedWells(QVBoxLayout *layout) {
for (int i = 0; i < m_horizontalFracturedWells.size(); ++i) {
nmDataHorizontalFracturedWell& well = m_horizontalFracturedWells[i];
nmGUIDrawerWidget* drawer = new nmGUIDrawerWidget(well.getWellName() + tr(" - Horizontal Fractured"));
QVBoxLayout* wellLayout = new QVBoxLayout;
addWellComponents(wellLayout, well);
drawer->setContentLayout(wellLayout);
layout->addWidget(drawer);
}
}
void nmWxReservoirPropertiesDlg::setupReserviorProperties(QVBoxLayout *layout) {
nmGUIDrawerWidget* drawer = new nmGUIDrawerWidget(tr("Reservoir Properties"));
QVBoxLayout* reservoirLayout = new QVBoxLayout;
addAttributeComponent(reservoirLayout, m_reservior.getInitialPressure());
addComboxComponent(reservoirLayout, m_reservior.getReservoirType());
addAttributeComponent(reservoirLayout, m_reservior.getPermeability());
addAttributeComponent(reservoirLayout, m_reservior.getTransmissibility());
addAttributeComponent(reservoirLayout, m_reservior.getThickness());
addAttributeComponent(reservoirLayout, m_reservior.getMiuo());
addAttributeComponent(reservoirLayout, m_reservior.getBo());
addAttributeComponent(reservoirLayout, m_reservior.getCt());
addAttributeComponent(reservoirLayout, m_reservior.getPorosity());
addAttributeComponent(reservoirLayout, m_reservior.getCf());
addAttributeComponent(reservoirLayout, m_reservior.getKxKy());
addAttributeComponent(reservoirLayout, m_reservior.getSoi());
addAttributeComponent(reservoirLayout, m_reservior.getSgi());
addAttributeComponent(reservoirLayout, m_reservior.getSwi());
drawer->setContentLayout(reservoirLayout);
layout->addWidget(drawer);
}
void nmWxReservoirPropertiesDlg::setupRegionMarkProperties(QVBoxLayout *layout) {
for (int i = 0; i < m_vecRegionMark.size(); ++i) {
nmDataRegionMark& regionMark = m_vecRegionMark[i];
nmGUIDrawerWidget* drawer = new nmGUIDrawerWidget(regionMark.getRegionMarkName());
QVBoxLayout* regionLayout = new QVBoxLayout;
addComboxComponent(regionLayout, regionMark.getReservoirType());
addAttributeComponent(regionLayout, regionMark.getComW());
addAttributeComponent(regionLayout, regionMark.getComKr());
addAttributeComponent(regionLayout, regionMark.getNetToGross());
drawer->setContentLayout(regionLayout);
layout->addWidget(drawer);
}
}
void nmWxReservoirPropertiesDlg::setupContourFaultProperties(QVBoxLayout *layout) {
nmGUIDrawerWidget* drawer = new nmGUIDrawerWidget(tr("Contour & Faults"));
QVBoxLayout* contourLayout = new QVBoxLayout;
// Add faults
for (int i = 0; i < m_vecDataFaults.size(); ++i) {
nmGUIDrawerWidget* faultDrawer = new nmGUIDrawerWidget(m_vecDataFaults[i].getFaultName());
QVBoxLayout* faultLayout = new QVBoxLayout;
setupFaultProperties(faultLayout, m_vecDataFaults[i]);
faultDrawer->setContentLayout(faultLayout);
contourLayout->addWidget(faultDrawer);
}
// Add fractures
for (int i = 0; i < m_vecDataFractures.size(); ++i) {
nmGUIDrawerWidget* fractureDrawer = new nmGUIDrawerWidget(m_vecDataFractures[i].getFractureName());
QVBoxLayout* fractureLayout = new QVBoxLayout;
setupFractureProperties(fractureLayout, m_vecDataFractures[i]);
fractureDrawer->setContentLayout(fractureLayout);
contourLayout->addWidget(fractureDrawer);
}
// Add regions
for (int i = 0; i < m_vecDataRegions.size(); ++i) {
nmGUIDrawerWidget* regionDrawer = new nmGUIDrawerWidget(m_vecDataRegions[i].getRegoinName());
QVBoxLayout* regionLayout = new QVBoxLayout;
setupRegionProperties(regionLayout, m_vecDataRegions[i]);
regionDrawer->setContentLayout(regionLayout);
contourLayout->addWidget(regionDrawer);
}
drawer->setContentLayout(contourLayout);
layout->addWidget(drawer);
}
void nmWxReservoirPropertiesDlg::setupFaultProperties(QVBoxLayout *layout, nmDataFault &fault) {
addComboxComponent(layout, fault.getFaultFlowModel());
addAttributeComponent(layout, fault.getFaultLeakage());
}
void nmWxReservoirPropertiesDlg::setupFractureProperties(QVBoxLayout *layout, nmDataFracture &fracture) {
addComboxComponent(layout, fracture.getFractureFlowModel());
addAttributeComponent(layout, fracture.getFractureDfc());
addAttributeComponent(layout, fracture.getFractureDw());
}
void nmWxReservoirPropertiesDlg::setupRegionProperties(QVBoxLayout *layout, nmDataRegion &region) {
addComboxComponent(layout, region.getRegionFlowModel());
addAttributeComponent(layout, region.getRegionLeakage());
}
void nmWxReservoirPropertiesDlg::addWellComponents(QVBoxLayout *layout, nmDataVerticalWell &well) {
//addAttributeComponent(layout, well.getInputWellHead());
//addAttributeComponent(layout, well.getWellHeadX());
//addAttributeComponent(layout, well.getWellHeadY());
addAttributeComponent(layout, well.getX());
addAttributeComponent(layout, well.getY());
//addAttributeComponent(layout, well.getDrillFloorElevation());
addAttributeComponent(layout, well.getRadius());
//addAttributeComponent(layout, well.getZw());
//addAttributeComponent(layout, well.getPerforationLength());
//addAttributeComponent(layout, well.getWellLength());
//addCheckBoxComponent(layout, well.getRateDependentSkin(), well.getWellName());
//addAttributeComponent(layout, well.getMyName());
//addAttributeComponent(layout, well.getMdStart());
//addAttributeComponent(layout, well.getMdEnd());
//addAttributeComponent(layout, well.getSkin());
// 获取第一段射孔的表皮系数
addAttributeComponent(layout, well.getPerforation(0)->getSkin());
//if (well.getRateDependentSkin().getValue() == "true") {
// addAttributeComponent(layout, well.getdSdQ());
//}
// 井筒模型为下拉框
//addComboxComponent(layout, well.getWellboreModel());
addAttributeComponent(layout, well.getWellboreStorage());
addAttributeComponent(layout, well.getFinalWellboreStorage());
//addAttributeComponent(layout, well.getCInitialCFinal());
//addAttributeComponent(layout, well.getDtChangingStorage());
//addAttributeComponent(layout, well.getLeakSkin());
//addAttributeComponent(layout, well.getBottomholeMD());
}
void nmWxReservoirPropertiesDlg::addWellComponents(QVBoxLayout *layout, nmDataHorizontalWell &well) {
addAttributeComponent(layout, well.getX());
addAttributeComponent(layout, well.getY());
addAttributeComponent(layout, well.getRadius());
//addAttributeComponent(layout, well.getDrillFloorElevation());
//addAttributeComponent(layout, well.getZw());
//addAttributeComponent(layout, well.getDrainAngle());
//addAttributeComponent(layout, well.getWellLength());
// addCheckBoxComponent(layout, well.getRateDependentSkin(), well.getWellName());
//addAttributeComponent(layout, well.getMyName());
//addAttributeComponent(layout, well.getMdStart());
//addAttributeComponent(layout, well.getMdEnd());
//addAttributeComponent(layout, well.getSkin());
// 获取第一段射孔的表皮系数
addAttributeComponent(layout, well.getPerforation(0)->getSkin());
// 井筒模型为下拉框
//addComboxComponent(layout, well.getWellboreModel());
addAttributeComponent(layout, well.getWellboreStorage());
//addAttributeComponent(layout, well.getBottomholeMD());
//if (well.getRateDependentSkin().getValue() == "true") {
// addAttributeComponent(layout, well.getdSdQ());
//}
}
void nmWxReservoirPropertiesDlg::addWellComponents(QVBoxLayout *layout, nmDataVerticalFracturedWell &well) {
addAttributeComponent(layout, well.getX());
addAttributeComponent(layout, well.getY());
addAttributeComponent(layout, well.getRadius());
//addAttributeComponent(layout, well.getDrillFloorElevation());
//addComboxComponent(layout, well.getFractureModel());
addAttributeComponent(layout, well.getDfc());
addAttributeComponent(layout, well.getFractureHalfLength());
//addAttributeComponent(layout, well.getFractureHeight());
//addAttributeComponent(layout, well.getFractureMidPointHeight());
//addAttributeComponent(layout, well.getWidth());
addAttributeComponent(layout, well.getFractureAngle());
//addAttributeComponent(layout, well.getZw());
//addAttributeComponent(layout, well.getPerforationLength());
//addAttributeComponent(layout, well.getWellLength());
// addCheckBoxComponent(layout, well.getRateDependentSkin(), well.getWellName());
//addAttributeComponent(layout, well.getMyName());
//addAttributeComponent(layout, well.getMdStart());
//addAttributeComponent(layout, well.getMdEnd());
//addAttributeComponent(layout, well.getSkin());
// 获取第一段射孔的表皮系数
addAttributeComponent(layout, well.getPerforation(0)->getSkin());
//addComboxComponent(layout, well.getWellboreModel());
addAttributeComponent(layout, well.getWellboreStorage());
//addAttributeComponent(layout, well.getBottomholeMD());
//if (well.getRateDependentSkin().getValue() == "true") {
// addAttributeComponent(layout, well.getdSdQ());
//}
}
void nmWxReservoirPropertiesDlg::addWellComponents(QVBoxLayout *layout, nmDataHorizontalFracturedWell &well) {
//addComboxComponent(layout, well.getModelingType());
addAttributeComponent(layout, well.getX());
addAttributeComponent(layout, well.getY());
addAttributeComponent(layout, well.getRadius());
//addAttributeComponent(layout, well.getDrillFloorElevation());
//addComboxComponent(layout, well.getFractureModel());
//addAttributeComponent(layout, well.getDfc());
addAttributeComponent(layout, well.getNumberOfFractures());
addAttributeComponent(layout, well.getFractureHalfLength());
//addAttributeComponent(layout, well.getFractureHeight());
//addAttributeComponent(layout, well.getFractureMidPointHeight());
//addAttributeComponent(layout, well.getWidth());
addAttributeComponent(layout, well.getFractureAngle());
//addAttributeComponent(layout, well.getZw());
//addAttributeComponent(layout, well.getDrainAngle());
//addAttributeComponent(layout, well.getWellLength());
//addCheckBoxComponent(layout, well.getRateDependentSkin(), well.getWellName());
//addAttributeComponent(layout, well.getMyName());
//addAttributeComponent(layout, well.getMdStart());
//addAttributeComponent(layout, well.getMdEnd());
//addAttributeComponent(layout, well.getSkin());
// 获取第一段射孔的表皮系数
addAttributeComponent(layout, well.getPerforation(0)->getSkin());
//addComboxComponent(layout, well.getWellboreModel());
addAttributeComponent(layout, well.getWellboreStorage());
//addAttributeComponent(layout, well.getBottomholeMD());
// addCheckBoxComponent(layout, well.getStimulatedZonesAroundFracture(), well.getWellName());
//if (well.getRateDependentSkin().getValue() == "true") {
// addAttributeComponent(layout, well.getdSdQ());
//}
//if (well.getStimulatedZonesAroundFracture().getValue() == "true") {
// addAttributeComponent(layout, well.getStimulationRadius());
// addAttributeComponent(layout, well.getPermeabilityMultiplier());
// addAttributeComponent(layout, well.getPorosityMultiplier());
//}
}
void nmWxReservoirPropertiesDlg::addAttributeComponent(QVBoxLayout *layout, const nmDataAttribute& attribute) {
// 创建一个指向 nmDataAttribute 的指针
//nmDataAttribute* pAttributePtr = new nmDataAttribute(attribute);
nmGUIComponentLineEdit* component = new nmGUIComponentLineEdit(const_cast<nmDataAttribute*>(&attribute),true);
//// 设置样式表
//QString styleSheet = "QLineEdit {"
// " width: 400px;" // 设置 QLineEdit 的宽度为 400px
// "}"
// "QLabel {"
//
// "}"
// "QComboBox {"
// " width: 50px;" // 设置 QComboBox 的宽度为 80px
// "}"
// "QHBoxLayout {"
// "}";
//component->setStyleSheet(styleSheet);
m_listAllComponents.append(component);
layout->addWidget(component);
}
void nmWxReservoirPropertiesDlg::addComboxComponent(QVBoxLayout *layout, const nmDataAttribute& attribute) {
// 创建一个指向 nmDataAttribute 的指针
nmGUIComponentComboBox* component = new nmGUIComponentComboBox(const_cast<nmDataAttribute*>(&attribute),true);
// 设置样式表
//QString styleSheet = "QLineEdit {"
// "}"
// "QLabel {"
// "}"
// "QComboBox {"
// " width: 505px;" // 设置 QComboBox 的宽度为 480px
// "}"
// "QHBoxLayout {"
// "}";
//component->setStyleSheet(styleSheet);
m_listAllComponents.append(component);
layout->addWidget(component);
}
void nmWxReservoirPropertiesDlg::accept() {
// 先更新界面数据到对象
for (int i = 0; i < m_listAllComponents.size(); i++) {
nmGUIComponentBase* pComUI = m_listAllComponents[i];
pComUI->updateValueToOrigin();
}
// 检查井的X、Y坐标是否发生了变化
bool positionChanged = false;
// 检查垂直井坐标
if (m_verticalWells.size() != m_previousVerticalWells.size()) {
positionChanged = true;
} else {
for (int i = 0; i < m_verticalWells.size(); i++) {
if (m_verticalWells[i].getX().getValue() != m_previousVerticalWells[i].getX().getValue() ||
m_verticalWells[i].getY().getValue() != m_previousVerticalWells[i].getY().getValue()) {
positionChanged = true;
break;
}
}
}
// 检查水平井坐标
if (!positionChanged) {
if (m_horizontalWells.size() != m_previousHorizontalWells.size()) {
positionChanged = true;
} else {
for (int i = 0; i < m_horizontalWells.size(); i++) {
if (m_horizontalWells[i].getX().getValue() != m_previousHorizontalWells[i].getX().getValue() ||
m_horizontalWells[i].getY().getValue() != m_previousHorizontalWells[i].getY().getValue()) {
positionChanged = true;
break;
}
}
}
}
// 检查垂直压裂井坐标
if (!positionChanged) {
if (m_verticalFracturedWells.size() != m_previousVerticalFracturedWells.size()) {
positionChanged = true;
} else {
for (int i = 0; i < m_verticalFracturedWells.size(); i++) {
if (m_verticalFracturedWells[i].getX().getValue() != m_previousVerticalFracturedWells[i].getX().getValue() ||
m_verticalFracturedWells[i].getY().getValue() != m_previousVerticalFracturedWells[i].getY().getValue()) {
positionChanged = true;
break;
}
}
}
}
// 检查水平压裂井坐标
if (!positionChanged) {
if (m_horizontalFracturedWells.size() != m_previousHorizontalFracturedWells.size()) {
positionChanged = true;
} else {
for (int i = 0; i < m_horizontalFracturedWells.size(); i++) {
if (m_horizontalFracturedWells[i].getX().getValue() != m_previousHorizontalFracturedWells[i].getX().getValue() ||
m_horizontalFracturedWells[i].getY().getValue() != m_previousHorizontalFracturedWells[i].getY().getValue()) {
positionChanged = true;
break;
}
}
}
}
// 保存所有修改到数据管理器
nmDataAnalyzeManager* manager = nmDataAnalyzeManager::getCurrentInstance();
manager->updateVerticalWells(m_verticalWells);
manager->updateVerticalFracturedWells(m_verticalFracturedWells);
manager->updateHorizontalFracturedWells(m_horizontalFracturedWells);
// 更新断层数据
manager->updateFaultData(m_vecDataFaults);
// 更新裂缝数据
manager->updateFractureData(m_vecDataFractures);
// 更新区域数据
manager->updateRegionData(m_vecDataRegions);
// 更新区域标记数据
manager->updateRegionMarkData(m_vecRegionMark);
// 更新油藏数据
manager->updateReservoirData(m_reservior);
// 只有井的坐标发生变化时才发出重绘网格的信号
if (positionChanged) {
nmDataAnalyzeManager::getCurrentInstance()->notifyDataChanged();
}
// 更新完成后,通知参数界面刷新
nmWxParameterProperty::notifyUpdateTable();
iDlgBase::accept();
}
void nmWxReservoirPropertiesDlg::reject() {
// 放弃所有修改,直接关闭对话框
iDlgBase::reject();
}