|
|
|
|
#include "nmDataAnalyzeManager.h"
|
|
|
|
|
#include "nmDataWellBase.h"
|
|
|
|
|
#include "nmGUIDrawerWidget.h"
|
|
|
|
|
#include "nmWxParameterProperty.h"
|
|
|
|
|
|
|
|
|
|
#include "nmGUIComponentLineEdit.h"
|
|
|
|
|
#include "nmGUIComponentComboBox.h"
|
|
|
|
|
|
|
|
|
|
#include "nmTranslationManager.h"
|
|
|
|
|
|
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
#include <QTreeWidget>
|
|
|
|
|
#include <QHeaderView>
|
|
|
|
|
#include <QRadioButton>
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
|
|
|
|
|
|
nmWxParameterProperty* nmWxParameterProperty::s_pCurrentInstance = nullptr;
|
|
|
|
|
|
|
|
|
|
// 井筒储集系数计算器
|
|
|
|
|
#include "nmWxWellboreStorageCalculator.h"
|
|
|
|
|
|
|
|
|
|
nmWxParameterProperty::nmWxParameterProperty(QWidget* mainWindow, QWidget* parent)
|
|
|
|
|
: iDlgBase(parent), m_pMainWindow(mainWindow)
|
|
|
|
|
{
|
|
|
|
|
s_pCurrentInstance = this;
|
|
|
|
|
m_pLayout = nullptr;
|
|
|
|
|
m_pTreeWidget = nullptr;
|
|
|
|
|
m_pLastEditedItem = nullptr;
|
|
|
|
|
initUI();
|
|
|
|
|
initComponents();
|
|
|
|
|
loadDatas();
|
|
|
|
|
setWindowTitle(tr("Parameter"));
|
|
|
|
|
m_pTreeWidget->expandAll();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nmWxParameterProperty::~nmWxParameterProperty()
|
|
|
|
|
{
|
|
|
|
|
if(m_pTreeWidget != nullptr) {
|
|
|
|
|
delete m_pTreeWidget;
|
|
|
|
|
m_pTreeWidget = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(s_pCurrentInstance == this) {
|
|
|
|
|
s_pCurrentInstance = nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::initUI()
|
|
|
|
|
{
|
|
|
|
|
//QRadioButton *well = new QRadioButton(tr("Well"), this);
|
|
|
|
|
//QRadioButton *region = new QRadioButton(tr("Region"), this);
|
|
|
|
|
//QRadioButton *contourfault = new QRadioButton(tr("Contour & Faults"), this);
|
|
|
|
|
//QPushButton* calculateButton = new QPushButton(tr("Calculate"), this);
|
|
|
|
|
|
|
|
|
|
//connect(well, SIGNAL(clicked()), this, SLOT(onWellSelected()));
|
|
|
|
|
//connect(region, SIGNAL(clicked()), this, SLOT(onRegionSelected()));
|
|
|
|
|
//connect(contourfault, SIGNAL(clicked()), this, SLOT(onContourFaultSelected()));
|
|
|
|
|
//connect(calculateButton,SIGNAL(clicked()), this, SLOT(onCalculate()));
|
|
|
|
|
|
|
|
|
|
//QHBoxLayout* topLayout = new QHBoxLayout();
|
|
|
|
|
//topLayout->addWidget(well);
|
|
|
|
|
//topLayout->addStretch();
|
|
|
|
|
//topLayout->addWidget(region);
|
|
|
|
|
//topLayout->addStretch();
|
|
|
|
|
//topLayout->addWidget(contourfault);
|
|
|
|
|
//topLayout->addStretch();
|
|
|
|
|
//topLayout->addWidget(calculateButton);
|
|
|
|
|
|
|
|
|
|
// 创建顶部布局,用于放置按钮
|
|
|
|
|
m_pTopLayout = new QHBoxLayout();
|
|
|
|
|
m_pTopLayout->setContentsMargins(0, 0, 0, 0); // 设置边缘间距
|
|
|
|
|
m_pTopLayout->setSpacing(0); // 设置控件间距
|
|
|
|
|
|
|
|
|
|
// 创建井筒储集计算器标签
|
|
|
|
|
QLabel* pWellboreCalculatorLabel = new QLabel(tr("Wellbore storage calculator"));
|
|
|
|
|
|
|
|
|
|
// 创建井筒储集计算器按钮
|
|
|
|
|
m_pWellboreCalculatorButton = new QPushButton();
|
|
|
|
|
|
|
|
|
|
// 获取按钮图标
|
|
|
|
|
// 初始化图标路径
|
|
|
|
|
QString sIconDir = QCoreApplication::applicationDirPath();
|
|
|
|
|
sIconDir = sIconDir.section('/', 0, -2); // 获取上一级目录
|
|
|
|
|
sIconDir += "/Res/Icon/";
|
|
|
|
|
|
|
|
|
|
m_pWellboreCalculatorButton->setIcon(QIcon(sIconDir + "NmAnalDesign2.png"));
|
|
|
|
|
m_pWellboreCalculatorButton->setIconSize(QSize(20, 20));
|
|
|
|
|
m_pWellboreCalculatorButton->setFixedSize(22, 22);
|
|
|
|
|
|
|
|
|
|
// 将按钮添加到布局中
|
|
|
|
|
m_pTopLayout->addStretch(); // 在按钮前添加伸缩器
|
|
|
|
|
m_pTopLayout->addWidget(pWellboreCalculatorLabel);
|
|
|
|
|
m_pTopLayout->addWidget(m_pWellboreCalculatorButton);
|
|
|
|
|
m_pTopLayout->setContentsMargins(5, 5, 5, 5); // 可以调整布局的边距
|
|
|
|
|
|
|
|
|
|
m_pLayout = new QVBoxLayout(this);
|
|
|
|
|
m_pLayout->addLayout(m_pTopLayout);
|
|
|
|
|
m_pLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
m_pLayout->setSpacing(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::loadDatas()
|
|
|
|
|
{
|
|
|
|
|
m_vecVerticalWells.clear();
|
|
|
|
|
m_vecVerticalFracturedWells.clear();
|
|
|
|
|
m_vecHorizontalFracturedWells.clear();
|
|
|
|
|
m_vecDataFaults.clear();
|
|
|
|
|
m_vecDataFractures.clear();
|
|
|
|
|
m_vecDataRegions.clear();
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
appendReservoirToTree(m_reservior);
|
|
|
|
|
appendWellsToTree();
|
|
|
|
|
appendFaultToTree(m_vecDataFaults);
|
|
|
|
|
appendFactureToTree(m_vecDataFractures);
|
|
|
|
|
appendRegionToTree(m_vecDataRegions);
|
|
|
|
|
appendRegionMarkToTree(m_vecRegionMark);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::onWellSelected()
|
|
|
|
|
{
|
|
|
|
|
//m_pTreeWidget->clear();
|
|
|
|
|
//appendReservoirToTree(m_reservior);
|
|
|
|
|
//appendWellsToTree();
|
|
|
|
|
//m_pTreeWidget->expandAll();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::onRegionSelected()
|
|
|
|
|
{
|
|
|
|
|
//m_pTreeWidget->clear();
|
|
|
|
|
//appendReservoirToTree(m_reservior);
|
|
|
|
|
//appendRegionToTree(m_vecDataRegions);
|
|
|
|
|
//appendRegionMarkToTree(m_vecRegionMark);
|
|
|
|
|
//m_pTreeWidget->expandAll();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::onContourFaultSelected()
|
|
|
|
|
{
|
|
|
|
|
//m_pTreeWidget->clear();
|
|
|
|
|
//appendReservoirToTree(m_reservior);
|
|
|
|
|
//appendFaultToTree(m_vecDataFaults);
|
|
|
|
|
//appendFactureToTree(m_vecDataFractures);
|
|
|
|
|
//m_pTreeWidget->expandAll();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::onCalculate()
|
|
|
|
|
{
|
|
|
|
|
// if (m_mainWindow) {
|
|
|
|
|
// m_mainWindow->runCmdBy("NmCaculation","5115");
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::initComponents()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if(m_pTreeWidget != nullptr) {
|
|
|
|
|
delete m_pTreeWidget;
|
|
|
|
|
m_pTreeWidget = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_pTreeWidget = new CustomTreeWidget;
|
|
|
|
|
|
|
|
|
|
m_pTreeWidget->setColumnCount(2);
|
|
|
|
|
m_pTreeWidget->setEditTriggers(QAbstractItemView::DoubleClicked |
|
|
|
|
|
QAbstractItemView::SelectedClicked);
|
|
|
|
|
|
|
|
|
|
CustomTreeDelegate *delegate = new CustomTreeDelegate(m_pTreeWidget);
|
|
|
|
|
m_pTreeWidget->setItemDelegate(delegate);
|
|
|
|
|
|
|
|
|
|
m_pTreeWidget->setIndentation(20); // 缩进20px
|
|
|
|
|
|
|
|
|
|
// 显示表头并设置列标题
|
|
|
|
|
QStringList headerLabels;
|
|
|
|
|
headerLabels << tr("Property") << tr("Value");
|
|
|
|
|
m_pTreeWidget->setHeaderLabels(headerLabels);
|
|
|
|
|
|
|
|
|
|
// 设置表头背景颜色
|
|
|
|
|
QHeaderView* header = m_pTreeWidget->header();
|
|
|
|
|
header->setStyleSheet("QHeaderView::section {"
|
|
|
|
|
"background-color: rgb(218, 227, 243);"
|
|
|
|
|
"border: 1px solid #c8c8c8;"
|
|
|
|
|
"}");
|
|
|
|
|
// 设置字体居中对齐
|
|
|
|
|
header->setDefaultAlignment(Qt::AlignCenter);
|
|
|
|
|
|
|
|
|
|
// 隐藏根节点的箭头
|
|
|
|
|
m_pTreeWidget->setRootIsDecorated(false);
|
|
|
|
|
|
|
|
|
|
// 使用以下样式表设置
|
|
|
|
|
m_pTreeWidget->setStyleSheet(
|
|
|
|
|
"QTreeWidget {"
|
|
|
|
|
//" border: 1px solid #c8c8c8;"
|
|
|
|
|
" border:none;"
|
|
|
|
|
" font-family: 'Microsoft YaHei';"
|
|
|
|
|
" font-size: 9pt;"
|
|
|
|
|
" background: white;"
|
|
|
|
|
"}"
|
|
|
|
|
"QTreeWidget::item {"
|
|
|
|
|
" height: 25px;"
|
|
|
|
|
" margin: 0px;"
|
|
|
|
|
"}"
|
|
|
|
|
"QTreeWidget::branch{"
|
|
|
|
|
" width: 19px;"
|
|
|
|
|
" height: 25px;"
|
|
|
|
|
" border-right: 1px solid #c8c8c8;" // 垂直右边框
|
|
|
|
|
" background: #faf5f0;"
|
|
|
|
|
"}"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
m_pTreeWidget->setColumnWidth(0, 220);
|
|
|
|
|
m_pTreeWidget->setColumnWidth(1, 220);
|
|
|
|
|
|
|
|
|
|
m_pTreeWidget->header()->setStretchLastSection(true); // 最后一项充满
|
|
|
|
|
|
|
|
|
|
m_pTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection); // 是否可以选择多个项目
|
|
|
|
|
|
|
|
|
|
m_pTreeWidget->setSelectionBehavior(QAbstractItemView::SelectRows);// 设置选择行或者列
|
|
|
|
|
|
|
|
|
|
m_pTreeWidget->setRootIsDecorated(false); // 设置最顶层的节点是否显示前面小箭头
|
|
|
|
|
|
|
|
|
|
//m_pTreeWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); // 设置是否开启滚动条
|
|
|
|
|
|
|
|
|
|
m_pLayout->addWidget(m_pTreeWidget);
|
|
|
|
|
|
|
|
|
|
connect(m_pTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(onItemDoubleClicked(QTreeWidgetItem*, int)));
|
|
|
|
|
connect(m_pWellboreCalculatorButton, SIGNAL(clicked()), this, SLOT(onWellboreCalculatorClicked())); // 连接计算按钮的信号
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::onItemDoubleClicked(QTreeWidgetItem* item, int column)
|
|
|
|
|
{
|
|
|
|
|
// 先收回上次遗留的 widget
|
|
|
|
|
if(m_pLastEditedItem) {
|
|
|
|
|
QWidget* oldW = m_pTreeWidget->itemWidget(m_pLastEditedItem, 1);
|
|
|
|
|
|
|
|
|
|
if(oldW) {
|
|
|
|
|
m_pTreeWidget->removeItemWidget(m_pLastEditedItem, 1);
|
|
|
|
|
oldW->deleteLater();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_pLastEditedItem = item;
|
|
|
|
|
|
|
|
|
|
if(column == 1) { // 只允许编辑第二列
|
|
|
|
|
|
|
|
|
|
nmDataAttribute* attr = item->data(1, Qt::UserRole).value<nmDataAttribute*>(); // 获取属性对象
|
|
|
|
|
|
|
|
|
|
if(!attr) return;
|
|
|
|
|
|
|
|
|
|
// 获取原始值和单位
|
|
|
|
|
QString originalText = item->text(1);
|
|
|
|
|
//QStringList parts = originalText.split(" "); // 单位与值之间用空格分隔
|
|
|
|
|
QString valuePart;
|
|
|
|
|
QString unitPart;
|
|
|
|
|
|
|
|
|
|
// 无单位
|
|
|
|
|
if(attr->getUnit().isEmpty()) {
|
|
|
|
|
valuePart = originalText;
|
|
|
|
|
unitPart = "";
|
|
|
|
|
} else {
|
|
|
|
|
QStringList parts = originalText.split(" "); // 单位与值之间用空格分隔
|
|
|
|
|
valuePart = parts[0]; // 取值部分
|
|
|
|
|
unitPart = (parts.size() > 1) ? parts[1] : ""; // 取单位部分
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 判断是否有可选值列表
|
|
|
|
|
if(!attr->getListValueSelections().isEmpty()) {
|
|
|
|
|
// 创建一个 QComboBox 用于选择
|
|
|
|
|
QComboBox *comboBox = new QComboBox(m_pTreeWidget);
|
|
|
|
|
comboBox->addItems(attr->getListValueSelections()); // 添加可选项
|
|
|
|
|
// 设置当前选项
|
|
|
|
|
int currentIndex = comboBox->findText(valuePart);
|
|
|
|
|
|
|
|
|
|
if(currentIndex != -1) {
|
|
|
|
|
comboBox->setCurrentIndex(currentIndex); // 设置为当前值
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 设置编辑器并展示
|
|
|
|
|
m_pTreeWidget->setItemWidget(item, column, comboBox);
|
|
|
|
|
comboBox->setFixedWidth(150);
|
|
|
|
|
comboBox->setFixedHeight(24);
|
|
|
|
|
|
|
|
|
|
// 当编辑完成时,保存并更新数据
|
|
|
|
|
connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onComboBoxSelectionChanged(int)));
|
|
|
|
|
} else {
|
|
|
|
|
// 使用 QLineEdit 来编辑数值
|
|
|
|
|
QLineEdit *editor = new QLineEdit(m_pTreeWidget);
|
|
|
|
|
editor->setText(valuePart); // 只设置数值部分为可编辑内容
|
|
|
|
|
|
|
|
|
|
QFont font = editor->font();
|
|
|
|
|
font.setBold(true); // 将字体设置为加粗
|
|
|
|
|
editor->setFont(font);
|
|
|
|
|
|
|
|
|
|
// 设置编辑器并展示
|
|
|
|
|
m_pTreeWidget->setItemWidget(item, column, editor);
|
|
|
|
|
editor->setFixedWidth(150);
|
|
|
|
|
editor->setFixedHeight(24);
|
|
|
|
|
editor->setStyleSheet("QLineEdit { border: none; background-color: rgb(242, 249, 255);}");
|
|
|
|
|
editor->setFocus();
|
|
|
|
|
|
|
|
|
|
// 当编辑完成时,保存并更新数据
|
|
|
|
|
connect(editor, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::onComboBoxSelectionChanged(int index)
|
|
|
|
|
{
|
|
|
|
|
QComboBox* comboBox = qobject_cast<QComboBox*>(sender());
|
|
|
|
|
|
|
|
|
|
if(!comboBox) return;
|
|
|
|
|
|
|
|
|
|
QTreeWidgetItem* item = m_pTreeWidget->currentItem();
|
|
|
|
|
|
|
|
|
|
if(!item) return;
|
|
|
|
|
|
|
|
|
|
// 在删除前先移除item widget
|
|
|
|
|
int column = 1;
|
|
|
|
|
m_pTreeWidget->setItemWidget(item, column, nullptr);
|
|
|
|
|
|
|
|
|
|
// 更新数据中心
|
|
|
|
|
nmDataAttribute* attr = item->data(1, Qt::UserRole).value<nmDataAttribute*>();
|
|
|
|
|
|
|
|
|
|
if(attr) {
|
|
|
|
|
QString selectedValue = comboBox->currentText();
|
|
|
|
|
attr->setValue(selectedValue);
|
|
|
|
|
// 更新界面显示文本
|
|
|
|
|
item->setText(1, selectedValue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_pTreeWidget->removeItemWidget(item, 1);
|
|
|
|
|
comboBox->deleteLater();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::onEditingFinished()
|
|
|
|
|
{
|
|
|
|
|
QLineEdit* editor = qobject_cast<QLineEdit*>(sender());
|
|
|
|
|
|
|
|
|
|
if(!editor) return;
|
|
|
|
|
|
|
|
|
|
QTreeWidgetItem* item = m_pTreeWidget->currentItem();
|
|
|
|
|
|
|
|
|
|
if(!item) return;
|
|
|
|
|
|
|
|
|
|
// 在删除前先移除item widget
|
|
|
|
|
int column = 1;
|
|
|
|
|
m_pTreeWidget->setItemWidget(item, column, nullptr);
|
|
|
|
|
|
|
|
|
|
nmDataAttribute* attr = item->data(1, Qt::UserRole).value<nmDataAttribute*>();
|
|
|
|
|
|
|
|
|
|
if(!attr) return;
|
|
|
|
|
|
|
|
|
|
DataCategory category = static_cast<DataCategory>(item->data(1, Qt::UserRole + 1).toInt());
|
|
|
|
|
|
|
|
|
|
// 解析并更新属性值
|
|
|
|
|
QString newValueStr = editor->text().trimmed();
|
|
|
|
|
QVariant oldValue = attr->getValue();
|
|
|
|
|
QVariant newValue;
|
|
|
|
|
|
|
|
|
|
bool ok;
|
|
|
|
|
|
|
|
|
|
switch(oldValue.type()) {
|
|
|
|
|
case QVariant::Double:
|
|
|
|
|
newValue = newValueStr.toDouble(&ok);
|
|
|
|
|
|
|
|
|
|
if(!ok) return;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case QVariant::Int:
|
|
|
|
|
newValue = newValueStr.toInt(&ok);
|
|
|
|
|
|
|
|
|
|
if(!ok) return;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case QVariant::String:
|
|
|
|
|
newValue = newValueStr;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
attr->setValue(newValue);
|
|
|
|
|
item->setText(1, formatAttributeValue(newValue, attr->getUnit()));
|
|
|
|
|
|
|
|
|
|
// 根据数据类别更新对应的数据到数据中心
|
|
|
|
|
nmDataAnalyzeManager* manager = nmDataAnalyzeManager::getCurrentInstance();
|
|
|
|
|
|
|
|
|
|
switch(category) {
|
|
|
|
|
case ReservoirCat:
|
|
|
|
|
manager->updateReservoirData(m_reservior);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case VerticalWellCat:
|
|
|
|
|
manager->updateVerticalWells(m_vecVerticalWells);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case VerticalFracturedWellCat:
|
|
|
|
|
manager->updateVerticalFracturedWells(m_vecVerticalFracturedWells);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case HorizontalFracturedWellCat:
|
|
|
|
|
manager->updateHorizontalFracturedWells(m_vecHorizontalFracturedWells);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FaultCat:
|
|
|
|
|
manager->updateFaultData(m_vecDataFaults);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FractureCat:
|
|
|
|
|
manager->updateFractureData(m_vecDataFractures);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case RegionCat:
|
|
|
|
|
manager->updateRegionData(m_vecDataRegions);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case RegionMarkCat:
|
|
|
|
|
manager->updateRegionMarkData(m_vecRegionMark);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
editor->deleteLater();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::appendReservoirToTree(nmDataReservoir &reservoir)
|
|
|
|
|
{
|
|
|
|
|
QTreeWidgetItem* reservoirItem = new QTreeWidgetItem(m_pTreeWidget);
|
|
|
|
|
reservoirItem->setText(0, tr("Reservoir"));
|
|
|
|
|
reservoirItem->setFlags(reservoirItem->flags() & ~Qt::ItemIsEditable); // 设置为不可编辑
|
|
|
|
|
|
|
|
|
|
// 添加属性作为子节点
|
|
|
|
|
addAttributeToTree(reservoirItem, reservoir.getThickness(), ReservoirCat);
|
|
|
|
|
addAttributeToTree(reservoirItem, reservoir.getInitialPressure(), ReservoirCat);
|
|
|
|
|
//addAttributeToTree(reservoirItem, reservoir.getReservoirType(), ReservoirCat);
|
|
|
|
|
addAttributeToTree(reservoirItem, reservoir.getPermeability(), ReservoirCat);
|
|
|
|
|
//addAttributeToTree(reservoirItem, reservoir.getMiuo(), ReservoirCat);
|
|
|
|
|
//addAttributeToTree(reservoirItem, reservoir.getBo(), ReservoirCat);
|
|
|
|
|
addAttributeToTree(reservoirItem, reservoir.getPorosity(), ReservoirCat);
|
|
|
|
|
addAttributeToTree(reservoirItem, reservoir.getTransmissibility(), ReservoirCat);
|
|
|
|
|
addAttributeToTree(reservoirItem, reservoir.getCt(), ReservoirCat);
|
|
|
|
|
//addAttributeToTree(reservoirItem, reservoir.getKxKy(), ReservoirCat);
|
|
|
|
|
addAttributeToTree(reservoirItem, reservoir.getCf(), ReservoirCat);
|
|
|
|
|
addAttributeToTree(reservoirItem, reservoir.getSoi(), ReservoirCat);
|
|
|
|
|
addAttributeToTree(reservoirItem, reservoir.getSgi(), ReservoirCat);
|
|
|
|
|
addAttributeToTree(reservoirItem, reservoir.getSwi(), ReservoirCat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::appendWellsToTree()
|
|
|
|
|
{
|
|
|
|
|
nmDataAnalyzeManager* pDataManager = nmDataAnalyzeManager::getCurrentInstance();
|
|
|
|
|
QVector<nmDataWellBase*> listWellData = pDataManager->getWellDataList();
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < listWellData.size(); ++i) {
|
|
|
|
|
nmDataWellBase* well = listWellData[i];
|
|
|
|
|
|
|
|
|
|
if(qobject_cast<nmDataVerticalWell * >(well)) {
|
|
|
|
|
appendVerticalWellToTree(static_cast<nmDataVerticalWell*>(well));
|
|
|
|
|
} else if(qobject_cast<nmDataVerticalFracturedWell * >(well)) {
|
|
|
|
|
appendVerticalFracturedWellToTree(static_cast<nmDataVerticalFracturedWell*>(well));
|
|
|
|
|
} else if(qobject_cast<nmDataHorizontalFracturedWell * >(well)) {
|
|
|
|
|
appendHorizontalFracturedWellToTree(static_cast<nmDataHorizontalFracturedWell*>(well));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::appendVerticalWellToTree(nmDataVerticalWell* well)
|
|
|
|
|
{
|
|
|
|
|
QTreeWidgetItem* wellItem = new QTreeWidgetItem(m_pTreeWidget);
|
|
|
|
|
wellItem->setText(0, well->getWellName() + " - Vertical");
|
|
|
|
|
wellItem->setFlags(wellItem->flags() & ~Qt::ItemIsEditable);
|
|
|
|
|
|
|
|
|
|
//addAttributeToTree(wellItem, well->getWellHeadX(), VerticalWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getWellHeadY(), VerticalWellCat);
|
|
|
|
|
addAttributeToTree(wellItem, well->getX(), VerticalWellCat);
|
|
|
|
|
addAttributeToTree(wellItem, well->getY(), VerticalWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getDrillFloorElevation(), VerticalWellCat);
|
|
|
|
|
addAttributeToTree(wellItem, well->getRadius(), VerticalWellCat);
|
|
|
|
|
addAttributeToTree(wellItem, well->getZw(), VerticalWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getPerforationLength(), VerticalWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getWellLength(), VerticalWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getMyName(), VerticalWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getMdStart(), VerticalWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getMdEnd(), VerticalWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getSkin(), VerticalWellCat);
|
|
|
|
|
// 获取第一段射孔的表皮系数
|
|
|
|
|
addAttributeToTree(wellItem, well->getPerforation(0)->getSkin(), VerticalWellCat);
|
|
|
|
|
//if (well->getRateDependentSkin().getValue() == "true") {
|
|
|
|
|
// addAttributeToTree(wellItem, well->getdSdQ(), VerticalWellCat);
|
|
|
|
|
//}
|
|
|
|
|
//addAttributeToTree(wellItem, well->getWellboreModel(), VerticalWellCat);
|
|
|
|
|
addAttributeToTree(wellItem, well->getWellboreStorage(), VerticalWellCat);
|
|
|
|
|
addAttributeToTree(wellItem, well->getFinalWellboreStorage(), VerticalWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getCInitialCFinal(), VerticalWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getDtChangingStorage(), VerticalWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getLeakSkin(), VerticalWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getBottomholeMD(), VerticalWellCat);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::appendVerticalFracturedWellToTree(nmDataVerticalFracturedWell* well)
|
|
|
|
|
{
|
|
|
|
|
QTreeWidgetItem* wellItem = new QTreeWidgetItem(m_pTreeWidget);
|
|
|
|
|
wellItem->setText(0, well->getWellName() + " - Vertical Fractured");
|
|
|
|
|
wellItem->setFlags(wellItem->flags() & ~Qt::ItemIsEditable);
|
|
|
|
|
|
|
|
|
|
addAttributeToTree(wellItem, well->getX(), VerticalFracturedWellCat);
|
|
|
|
|
addAttributeToTree(wellItem, well->getY(), VerticalFracturedWellCat);
|
|
|
|
|
addAttributeToTree(wellItem, well->getRadius(), VerticalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getDrillFloorElevation(), VerticalFracturedWellCat);
|
|
|
|
|
|
|
|
|
|
//addAttributeToTree(wellItem, well->getFractureModel(), VerticalFracturedWellCat);
|
|
|
|
|
addAttributeToTree(wellItem, well->getDfc(), VerticalFracturedWellCat);
|
|
|
|
|
addAttributeToTree(wellItem, well->getFractureHalfLength(), VerticalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getFractureHeight(), VerticalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getFractureMidPointHeight(), VerticalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getWidth(), VerticalFracturedWellCat);
|
|
|
|
|
addAttributeToTree(wellItem, well->getFractureAngle(), VerticalFracturedWellCat);
|
|
|
|
|
|
|
|
|
|
//addAttributeToTree(wellItem, well->getZw(), VerticalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getPerforationLength(), VerticalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getWellLength(), VerticalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getMyName(), VerticalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getMdStart(), VerticalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getMdEnd(), VerticalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getSkin(), VerticalFracturedWellCat);
|
|
|
|
|
// 获取第一段射孔的表皮系数
|
|
|
|
|
addAttributeToTree(wellItem, well->getPerforation(0)->getSkin(), VerticalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getWellboreModel(), VerticalFracturedWellCat);
|
|
|
|
|
addAttributeToTree(wellItem, well->getWellboreStorage(), VerticalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getBottomholeMD(), VerticalFracturedWellCat);
|
|
|
|
|
|
|
|
|
|
//if (well->getRateDependentSkin().getValue() == "true") {
|
|
|
|
|
// addAttributeToTree(wellItem, well->getdSdQ(), VerticalFracturedWellCat);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::appendHorizontalFracturedWellToTree(nmDataHorizontalFracturedWell* well)
|
|
|
|
|
{
|
|
|
|
|
QTreeWidgetItem* wellItem = new QTreeWidgetItem(m_pTreeWidget);
|
|
|
|
|
wellItem->setText(0, well->getWellName() + " - Horizontal Fractured");
|
|
|
|
|
wellItem->setFlags(wellItem->flags() & ~Qt::ItemIsEditable);
|
|
|
|
|
|
|
|
|
|
//addAttributeToTree(wellItem,. well->getModelingType(), HorizontalFracturedWellCat);
|
|
|
|
|
|
|
|
|
|
addAttributeToTree(wellItem, well->getX(), HorizontalFracturedWellCat);
|
|
|
|
|
addAttributeToTree(wellItem, well->getY(), HorizontalFracturedWellCat);
|
|
|
|
|
addAttributeToTree(wellItem, well->getRadius(), HorizontalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getDrillFloorElevation(), HorizontalFracturedWellCat);
|
|
|
|
|
|
|
|
|
|
//addAttributeToTree(wellItem, well->getFractureModel(), HorizontalFracturedWellCat);
|
|
|
|
|
addAttributeToTree(wellItem, well->getDfc(), HorizontalFracturedWellCat);
|
|
|
|
|
addAttributeToTree(wellItem, well->getNumberOfFractures(), HorizontalFracturedWellCat);
|
|
|
|
|
addAttributeToTree(wellItem, well->getFractureHalfLength(), HorizontalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getFractureHeight(), HorizontalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getFractureMidPointHeight(), HorizontalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getWidth(), HorizontalFracturedWellCat);
|
|
|
|
|
addAttributeToTree(wellItem, well->getFractureAngle(), HorizontalFracturedWellCat);
|
|
|
|
|
|
|
|
|
|
//addAttributeToTree(wellItem, well->getZw(), HorizontalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getDrainAngle(), HorizontalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getWellLength(), HorizontalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getMyName(), HorizontalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getMdStart(), HorizontalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getMdEnd(), HorizontalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getSkin(), HorizontalFracturedWellCat);
|
|
|
|
|
// 获取第一段射孔的表皮系数
|
|
|
|
|
addAttributeToTree(wellItem, well->getPerforation(0)->getSkin(), HorizontalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getWellboreModel(), HorizontalFracturedWellCat);
|
|
|
|
|
addAttributeToTree(wellItem, well->getWellboreStorage(), HorizontalFracturedWellCat);
|
|
|
|
|
//addAttributeToTree(wellItem, well->getBottomholeMD(), HorizontalFracturedWellCat);
|
|
|
|
|
|
|
|
|
|
//if (well->getRateDependentSkin().getValue() == "true") {
|
|
|
|
|
// addAttributeToTree(wellItem, well->getdSdQ(), HorizontalFracturedWellCat);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//if (well->getStimulatedZonesAroundFracture().getValue() == "true") {
|
|
|
|
|
// addAttributeToTree(wellItem, well->getStimulationRadius(), HorizontalFracturedWellCat);
|
|
|
|
|
// addAttributeToTree(wellItem, well->getPermeabilityMultiplier(), HorizontalFracturedWellCat);
|
|
|
|
|
// addAttributeToTree(wellItem, well->getPorosityMultiplier(), HorizontalFracturedWellCat);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::appendFaultToTree(QVector<nmDataFault> &faults)
|
|
|
|
|
{
|
|
|
|
|
for(int i = 0; i < faults.size(); ++i) {
|
|
|
|
|
nmDataFault& fault = faults[i];
|
|
|
|
|
QTreeWidgetItem* faultItem = new QTreeWidgetItem(m_pTreeWidget);
|
|
|
|
|
faultItem->setText(0, fault.getFaultName());
|
|
|
|
|
faultItem->setFlags(faultItem->flags() & ~Qt::ItemIsEditable);
|
|
|
|
|
addAttributeToTree(faultItem, fault.getFaultFlowModel(), FaultCat);
|
|
|
|
|
addAttributeToTree(faultItem, fault.getFaultLeakage(), FaultCat);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::appendFactureToTree(QVector<nmDataFracture> &fractures)
|
|
|
|
|
{
|
|
|
|
|
for(int i = 0; i < fractures.size(); ++i) {
|
|
|
|
|
nmDataFracture& fracture = fractures[i];
|
|
|
|
|
QTreeWidgetItem* fractureItem = new QTreeWidgetItem(m_pTreeWidget);
|
|
|
|
|
fractureItem->setText(0, fracture.getFractureName());
|
|
|
|
|
fractureItem->setFlags(fractureItem->flags() & ~Qt::ItemIsEditable);
|
|
|
|
|
addAttributeToTree(fractureItem, fracture.getFractureFlowModel(), FractureCat);
|
|
|
|
|
addAttributeToTree(fractureItem, fracture.getFractureDfc(), FractureCat);
|
|
|
|
|
addAttributeToTree(fractureItem, fracture.getFractureDw(), FractureCat);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::appendRegionToTree(QVector<nmDataRegion> ®ions)
|
|
|
|
|
{
|
|
|
|
|
for(int i = 0; i < regions.size(); ++i) {
|
|
|
|
|
nmDataRegion& region = regions[i];
|
|
|
|
|
QTreeWidgetItem* regionItem = new QTreeWidgetItem(m_pTreeWidget);
|
|
|
|
|
regionItem->setText(0, region.getRegoinName());
|
|
|
|
|
regionItem->setFlags(regionItem->flags() & ~Qt::ItemIsEditable);
|
|
|
|
|
addAttributeToTree(regionItem, region.getRegionFlowModel(), RegionCat);
|
|
|
|
|
addAttributeToTree(regionItem, region.getRegionLeakage(), RegionCat);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::appendRegionMarkToTree(QVector<nmDataRegionMark> ®ionMarks)
|
|
|
|
|
{
|
|
|
|
|
for(int i = 0; i < regionMarks.size(); ++i) {
|
|
|
|
|
nmDataRegionMark& regionMark = regionMarks[i];
|
|
|
|
|
QTreeWidgetItem* regionMarkItem = new QTreeWidgetItem(m_pTreeWidget);
|
|
|
|
|
regionMarkItem->setText(0, regionMark.getRegionMarkName());
|
|
|
|
|
regionMarkItem->setFlags(regionMarkItem->flags() & ~Qt::ItemIsEditable);
|
|
|
|
|
addAttributeToTree(regionMarkItem, regionMark.getReservoirType(), RegionMarkCat);
|
|
|
|
|
addAttributeToTree(regionMarkItem, regionMark.getComW(), RegionMarkCat);
|
|
|
|
|
addAttributeToTree(regionMarkItem, regionMark.getComKr(), RegionMarkCat);
|
|
|
|
|
addAttributeToTree(regionMarkItem, regionMark.getNetToGross(), RegionMarkCat);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::addAttributeToTree(QTreeWidgetItem* parent, nmDataAttribute& attr, DataCategory category)
|
|
|
|
|
{
|
|
|
|
|
QTreeWidgetItem* item = new QTreeWidgetItem(parent);
|
|
|
|
|
item->setText(0, nmTranslationManager::mapToChinese(attr.getName()));
|
|
|
|
|
item->setText(1, formatAttributeValue(attr.getValue(), attr.getUnit()));
|
|
|
|
|
item->setData(1, Qt::UserRole, qVariantFromValue(&attr));
|
|
|
|
|
item->setData(1, Qt::UserRole + 1, static_cast<int>(category));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString nmWxParameterProperty::formatAttributeValue(const QVariant& value, const QString& unit)
|
|
|
|
|
{
|
|
|
|
|
QString valueText;
|
|
|
|
|
|
|
|
|
|
// 1. 解析 QVariant 值
|
|
|
|
|
switch(value.type()) {
|
|
|
|
|
case QVariant::Double:
|
|
|
|
|
//valueText = QString::number(value.toDouble(), 'f', 4); // 保留4位小数
|
|
|
|
|
valueText = QString::number(value.toDouble());
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case QVariant::Int:
|
|
|
|
|
case QVariant::UInt:
|
|
|
|
|
valueText = QString::number(value.toInt());
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case QVariant::String:
|
|
|
|
|
valueText = value.toString();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
valueText = "N/A"; // 未知类型
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 2. 处理单位(非空时追加)
|
|
|
|
|
if(!unit.isEmpty()) {
|
|
|
|
|
valueText += " " + unit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return valueText;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::notifyUpdateTable()
|
|
|
|
|
{
|
|
|
|
|
// 检查当前是否有活动实例
|
|
|
|
|
if(!s_pCurrentInstance) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 直接执行更新逻辑
|
|
|
|
|
s_pCurrentInstance->m_pTreeWidget->clear();
|
|
|
|
|
s_pCurrentInstance->loadDatas();
|
|
|
|
|
s_pCurrentInstance->m_pTreeWidget->expandAll();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxParameterProperty::onWellboreCalculatorClicked()
|
|
|
|
|
{
|
|
|
|
|
// 创建并显示井筒储集计算器对话框
|
|
|
|
|
nmWxWellboreStorageCalculator calculatorDialog;
|
|
|
|
|
|
|
|
|
|
// 以模态对话框方式运行
|
|
|
|
|
if(calculatorDialog.exec() == QDialog::Accepted) {
|
|
|
|
|
// 获取计算后的井筒储集系数
|
|
|
|
|
double dC = calculatorDialog.getWellboreStorageValue();
|
|
|
|
|
|
|
|
|
|
if(dC != -1) {
|
|
|
|
|
// 应用到当前井的井筒储集系数
|
|
|
|
|
nmDataAnalyzeManager::getCurrentInstance()->getCurWellData()->getWellboreStorage().setValue(dC);
|
|
|
|
|
m_pTreeWidget->clear();
|
|
|
|
|
loadDatas();
|
|
|
|
|
m_pTreeWidget->expandAll();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|