1、完成地质图导入功能;

feature/ribbon-menu-20240927
simonyan 1 month ago
parent baae69a94d
commit ad5aa34129

@ -1,7 +1,11 @@
#pragma once
#include "ZxDataObjectDbl.h"
#include "nmData_global.h"
#include "ZxDataObjectDbl.h"
#include "nmDefines.h"
#include <QString>
#include <QList>
// 这是数值试井数据对象的例子
// 对应的表结构参见
@ -18,6 +22,7 @@
<FieldInfo Alias="扩展字段4" eDataType="2" FieldName="Ext4" Visible="0"/>
<FieldInfo Alias="扩展字段5" eDataType="2" FieldName="Ext5" Visible="0"/>
</Node> */
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<NM_PHASE_TYPE> &analyzeMultiphase() const;
void setAnalyzeMultiphase(const QList<NM_PHASE_TYPE> &newAnalyzeMultiphase);
protected:
// 与数据库关联的数据,如果父类已经定义,则无需再次定义
@ -71,7 +89,14 @@ protected:
double m_dBottomDepth;
// QDSZ
// 分析名称
QString m_sAnalyzeName;
// 分析的多相流
QList<NM_PHASE_TYPE> m_analyzeMultiphase;
// 分析的PVT目前只支持选择已经存在的
int m_iAnalyzePVTIndex;
// 分析的相渗,目前只支持选择已经存在的
int m_iAnalyzeIIIndex;
};

@ -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 // 其它
};

@ -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;
};

@ -6,19 +6,32 @@
#include <QVBoxLayout>
#include <QListWidget>
#include "nmSubWxs_global.h"
#include <QCheckBox>
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();

@ -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<NM_PHASE_TYPE> &nmDataDemo::analyzeMultiphase() const
{
return m_analyzeMultiphase;
}
void nmDataDemo::setAnalyzeMultiphase(const QList<NM_PHASE_TYPE> &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);

@ -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<QDockWidget*> dockWidgets = m_pMainWindow->findChildren<QDockWidget*>();
// 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<QDockWidget*> dockWidgets = m_pMainWindow->findChildren<QDockWidget*>();
// 遍历所有 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();

@ -11,6 +11,7 @@
#include "nmNewDlg.h"
#include "nmNewNormalDlg.h"
#include "nmWxParaProperty.h"
#include "nmDataDemo.h"
#include<QDialog>
@ -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 此处根据需要设置 改变 标识

@ -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

Loading…
Cancel
Save