diff --git a/logPlus/CloudDataDlg.cpp b/logPlus/CloudDataDlg.cpp index 54a0370..b960ffd 100644 --- a/logPlus/CloudDataDlg.cpp +++ b/logPlus/CloudDataDlg.cpp @@ -3,6 +3,8 @@ #include "ApiClient.h" #include #include "geometryutils.h" +#include "MemRdWt.h" +#include "qtprojectwidgets.h" static QString joinUrl(const QString &base, const QString &path) { @@ -38,6 +40,11 @@ CloudDataDlg::~CloudDataDlg() } +void CloudDataDlg::setProjectWidgets(QtProjectWidgets* projectWidgets) +{ + m_projectWidgets = projectWidgets; +} + void CloudDataDlg::initTreeProjects(QJsonObject jObj) { ui->btn_back->setVisible(false); @@ -288,6 +295,31 @@ void CloudDataDlg::on_btn_back_clicked() void CloudDataDlg::on_btn_import_clicked() { + if (!m_projectWidgets) + return; + + QString strSlfName = ""; + QString strWellName = ""; + QString strLeft = m_projectWidgets->getLeftTreeString(); + if (strLeft.length() > 0) + { + QStringList list = strLeft.split("#@@#");//QString字符串分割函数 + if (list.size() > 3) + { + strSlfName = list[0]; + strWellName = list[1]; + } + } + else { + QMessageBox::warning(this, "提示", "请先选中导入到的目标井次!"); + return; + } + if (strSlfName == "" || strWellName == "") + { + QMessageBox::warning(this, "提示", "请先选中导入到的目标井次!"); + return; + } + QVector vecId; QMap> mapSelect; foreach(QTreeWidgetItem *pItem, ui->treeWidget->selectedItems()) { @@ -297,6 +329,7 @@ void CloudDataDlg::on_btn_import_clicked() QString strType = pItem->data(0, Qt::UserRole).toString(); QString strId = pItem->data(0, Qt::UserRole + 1).toString(); QString strName = pItem->text(0); + vecId << strId; qDebug() << "选择:" << strType << "," << strId << "," << strName; if (mapSelect.contains(strType)) { @@ -310,6 +343,99 @@ void CloudDataDlg::on_btn_import_clicked() } } } + +// QVector vecv; +// QString strC = "E:/ALogplus/logplus/Outdata/JPH-307_WTDD.txt"; +// QStringList lines; +// QFile file(strC); +// if (file.open(QIODevice::ReadOnly)) { +// QTextStream stream(&file); +// stream.setCodec("UTF-8"); // 设置UTF-8编码 +// QString line; +// stream.readLine(); +// while (!stream.atEnd()) { +// line = stream.readLine(); // 不包括“\n”的一行文本 +// QStringList slist = line.split(" "); +// for (int i = 0; i < slist.size(); i++) +// { +// float f = slist.at(i).toFloat(); +// vecv << f; +// } +// +// } +// file.close(); +// } +// +// CMemRdWt *logio = new CMemRdWt(); +// if (!logio->Open(strSlfName.toStdString().c_str(), CSlfIO::modeReadWrite)) +// { +// delete logio; +// QMessageBox::information(NULL, "提示", "SLF文件打开失败,请检查!!", QMessageBox::Yes); +// return; +// } +// +// float fsdep = 500.0f; +// float fedep = 600.0f; +// float fdep = 0.0250000004f; +// int nwaveIdx = logio->OpenWave("WDDW"); +// if (nwaveIdx < 0) +// { +// Slf_WAVE Slf_pInfo; +// Slf_pInfo.RepCode = 4; +// Slf_pInfo.CodeLen = 4; +// Slf_pInfo.MinValue = 0; +// Slf_pInfo.MaxValue = 64.2214966; +// Slf_pInfo.StartDepth = fsdep;//pInfo.StartDepth; +// Slf_pInfo.EndDepth = fedep;//pInfo.EndDepth; +// Slf_pInfo.DepLevel = fdep; +// Slf_pInfo.StartTime = 0; +// Slf_pInfo.TimeLevel = 5.0f; +// Slf_pInfo.TimeSamples = 24; +// Slf_pInfo.ArrayNum = 1; +// Slf_pInfo.DefVal = -9999.25; +// strcpy(Slf_pInfo.DepthUnit, "M"); +// strupr(Slf_pInfo.DepthUnit); +// strcpy(Slf_pInfo.TimeUnit, "ns"); +// strcpy(Slf_pInfo.Name, "WDDW"); +// strcpy(Slf_pInfo.AliasName, "WDDW"); +// strcpy(Slf_pInfo.Unit, ""); +// strcpy(Slf_pInfo.AliasUnit, ""); +// nwaveIdx = logio->OpenWave((Slf_WAVE *)&Slf_pInfo); +// } +// +// DWORD sample = (int)((fedep - fsdep) / fdep + 1.5);//0.5);//whp change 2018.10.15 保证读写一致 +// logio->WriteWave(nwaveIdx, fsdep, sample, vecv.data()); +// +// logio->CloseWave(nwaveIdx); + + //float fsdep = 2294.51245f; + //float fedep = 3178.69995f; + //float fdep = 0.031250000f; + //int index1 = logio->OpenCurve("TTSts"); + //if (index1 < 0) + //{ + // Slf_CURVE myWave; + // strcpy(myWave.Name, "TTSts"); + // strcpy(myWave.AliasName, "TTSts"); + // strcpy(myWave.DepthUnit, "m"); + // myWave.CodeLen = 4;//float + // myWave.RepCode = 4; + // myWave.DefVal = 0; + // myWave.StartDepth = fsdep; + // myWave.EndDepth = fedep; + // myWave.DepLevel = fdep; + // strcpy(myWave.DepthUnit, "m"); + // index1 = logio->OpenCurve((Slf_CURVE *)&myWave); + //} + + //DWORD sample = (int)((fedep - fsdep) / fdep + 1.5); + //DWORD ncnt = vecv.size(); + //if (index1 > 0) + // logio->WriteCurve(index1, fsdep, sample, vecv.data()); + + //logio->CloseCurve(index1); + delete logio; + int a = 0; } void CloudDataDlg::onItemDoubleClicked(QTreeWidgetItem* item, int index) diff --git a/logPlus/CloudDataDlg.h b/logPlus/CloudDataDlg.h index 72085db..1258a45 100644 --- a/logPlus/CloudDataDlg.h +++ b/logPlus/CloudDataDlg.h @@ -7,6 +7,7 @@ #pragma execution_character_set("utf-8") +class QtProjectWidgets; //单元格边框选中对话框 class CloudDataDlg : public QDialog { @@ -16,6 +17,8 @@ public: CloudDataDlg(QWidget *parent = 0); ~CloudDataDlg(); + void setProjectWidgets(QtProjectWidgets* projectWidgets); + void initTreeProjects(QJsonObject jObj);//加载树图 void initTreeWells(QJsonObject jObj);//加载树图 bool initTreeData(QTreeWidgetItem* itemJing, QJsonObject& jObjCi, QJsonObject catObj, @@ -37,6 +40,8 @@ private slots: private: Ui::CloudDataDlg *ui; + QtProjectWidgets *m_projectWidgets = NULL; + }; diff --git a/logPlus/mainwindow.cpp b/logPlus/mainwindow.cpp index 930399f..3d4f63b 100644 --- a/logPlus/mainwindow.cpp +++ b/logPlus/mainwindow.cpp @@ -758,8 +758,16 @@ void MainWindow::s_showView() void MainWindow::s_cloudData() { - CloudDataDlg dlg; - dlg.exec(); + if (!m_pCloudDlg) + { + m_pCloudDlg = new CloudDataDlg(this); + m_pCloudDlg->setProjectWidgets(m_projectWidgets); + } + if (m_pCloudDlg) + { + m_pCloudDlg->show(); + } + } //开发工具 diff --git a/logPlus/mainwindow.h b/logPlus/mainwindow.h index a002a43..acb6a2a 100644 --- a/logPlus/mainwindow.h +++ b/logPlus/mainwindow.h @@ -25,6 +25,7 @@ namespace Ui { class MainWindow; } +class CloudDataDlg; class WellLogTableDialogNew; class MainWindow : public QMainWindow { @@ -44,6 +45,8 @@ public: //QDockWidget *m_propertyView = nullptr; //属性区 //QDockWidget *m_logView = nullptr; //日志区 //QDockWidget *m_gdbView = nullptr; //调试区 + //云数据对话框 + CloudDataDlg* m_pCloudDlg = NULL; //子页面 QtProjectWidgets *m_projectWidgets; //左侧工程区