导入lis格式数据、名称排序、重命名、删除井次、删除井。
This commit is contained in:
parent
458e342d93
commit
c8691b3983
|
|
@ -58,22 +58,28 @@ void QMyTreeWidget::closeEditor ( QWidget * editor, QAbstractItemDelegate::EndEd
|
|||
return;
|
||||
}
|
||||
QString strTreeTag = item->data(0, Qt::UserRole).toString();
|
||||
CObjWellLog* pcopyingwelllog= new CObjWellLog();
|
||||
pcopyingwelllog->SetSlfFileName(strSlfName);
|
||||
pcopyingwelllog->SetName(strOldName);
|
||||
if(!pcopyingwelllog->RenName(strNewName))
|
||||
{
|
||||
this->currentItem()->setText(0,strOldName);
|
||||
if (strTreeTag != "wellItem" && strTreeTag != "wellname")//重命名表格、曲线、波列、参数表
|
||||
{
|
||||
CObjWellLog* pcopyingwelllog= new CObjWellLog();
|
||||
pcopyingwelllog->SetSlfFileName(strSlfName);
|
||||
pcopyingwelllog->SetName(strOldName);
|
||||
if(!pcopyingwelllog->RenName(strNewName))
|
||||
{
|
||||
this->currentItem()->setText(0,strOldName);
|
||||
// pObj->SetName(strOldName);
|
||||
// AfxMessageBox("无法改名,可能因重名等问题所致!");
|
||||
QMessageBox::information(NULL, "提示", "无法改名,可能因重名等问题所致!");
|
||||
}
|
||||
//else {
|
||||
//::GetObjectEvent().OnDeAttchData(pObj->GetSlfFileName(),strOldName);
|
||||
//::GetObjectEvent().OnRefreshData(pObj->GetSlfFileName(),strNewName);
|
||||
//}
|
||||
delete pcopyingwelllog;
|
||||
item->setData(0, Qt::UserRole + 3, strNewName); // 存储额外数据,波列卡
|
||||
//else {
|
||||
//::GetObjectEvent().OnDeAttchData(pObj->GetSlfFileName(),strOldName);
|
||||
//::GetObjectEvent().OnRefreshData(pObj->GetSlfFileName(),strNewName);
|
||||
//}
|
||||
delete pcopyingwelllog;
|
||||
item->setData(0, Qt::UserRole + 3, strNewName); // 存储额外数据,波列卡
|
||||
}
|
||||
|
||||
if (strTreeTag == "wellItem" || strTreeTag == "wellname")//井次或井名
|
||||
emit closeTreeEditor();
|
||||
return;
|
||||
}
|
||||
void QMyTreeWidget::startDrag(Qt::DropActions supportedActions)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ public:
|
|||
~QMyTreeWidget();
|
||||
|
||||
QString getCurrentItemString();
|
||||
Q_SIGNALS:
|
||||
void closeTreeEditor();
|
||||
|
||||
protected:
|
||||
virtual void startDrag(Qt::DropActions supportedActions);
|
||||
virtual void closeEditor ( QWidget * editor, QAbstractItemDelegate::EndEditHint hint );
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include "InDefTableDlg.h"
|
||||
#include "qtcommonclass.h"
|
||||
#include "CallManage.h"
|
||||
#include "qmytreewidget.h"
|
||||
//
|
||||
#include "geometryutils.h"
|
||||
#include "LogIO.h"
|
||||
|
|
@ -60,6 +61,8 @@ QtProjectWidgets::QtProjectWidgets(QWidget *parent)
|
|||
|
||||
//为树 tree 创建信号槽,鼠标press时会触发对应的信号。
|
||||
connect(ui->treeWidget, &QTreeWidget::itemPressed, this, &QtProjectWidgets::onItemClicked);
|
||||
connect(ui->treeWidget, SIGNAL(closeTreeEditor()), this, SLOT(oncloseTreeEditor()));
|
||||
|
||||
//connect(ui->treeWidget, &QTreeWidget::itemChanged, this, &QtProjectWidgets::onItemChanged);
|
||||
|
||||
// 设置选择模式为多选模式
|
||||
|
|
@ -90,6 +93,22 @@ void QtProjectWidgets::slotButtonNo()
|
|||
m_ReFlag=QDialogButtonBox::StandardButton::No;
|
||||
}
|
||||
|
||||
void QtProjectWidgets::slotAsendSort()
|
||||
{
|
||||
foreach(QTreeWidgetItem *pItem, ui->treeWidget->selectedItems())
|
||||
{
|
||||
pItem->sortChildren(0,Qt::AscendingOrder);
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWidgets::slotDesendSort()
|
||||
{
|
||||
foreach(QTreeWidgetItem *pItem, ui->treeWidget->selectedItems())
|
||||
{
|
||||
pItem->sortChildren(0,Qt::DescendingOrder);
|
||||
}
|
||||
}
|
||||
|
||||
////初始化树图控件
|
||||
//void QtProjectWidgets::initTreeWidget(QString fullPath, QString strProjectName)
|
||||
//{
|
||||
|
|
@ -351,6 +370,7 @@ void QtProjectWidgets::loadIndexSysTree(QTreeWidgetItem *parent, QString fileFul
|
|||
itemIndex->setText(0, wellname);
|
||||
itemIndex->setData(0, Qt::UserRole, "wellname"); // 存储额外数据,如ID
|
||||
itemIndex->setData(0, Qt::UserRole + 1, wellFile1); // 存储额外数据,项目名
|
||||
itemIndex->setData(0, Qt::UserRole + 2, wellname); // 存储额外数据,井名
|
||||
//
|
||||
QIcon icon;
|
||||
icon.addPixmap(QPixmap(GetImagePath() + "well.png"), QIcon::Selected);
|
||||
|
|
@ -873,6 +893,11 @@ void QtProjectWidgets::initWellNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget
|
|||
connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onEditWelllogRound()));
|
||||
menu->addAction(action_New);
|
||||
|
||||
QAction* action_ReName = new QAction("重命名", treeWidget);
|
||||
action_ReName->setIcon(QIcon(GetImagePath() + "icon/Rename.png")); // 设置图标":/image/u174.png"
|
||||
connect(action_ReName, SIGNAL(triggered()), this, SLOT(onReNameObject()));
|
||||
menu->addAction(action_ReName);
|
||||
|
||||
action_New = new QAction("输出数据", treeWidget);
|
||||
action_New->setIcon(QIcon(GetImagePath() + "icon/outcurves.png")); // 设置图标
|
||||
connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onOutWellLogRound()));
|
||||
|
|
@ -914,6 +939,11 @@ void QtProjectWidgets::initSlfNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget)
|
|||
connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onWelllogInformation()));
|
||||
menu->addAction(action_New);
|
||||
|
||||
QAction* action_ReName = new QAction("重命名", treeWidget);
|
||||
action_ReName->setIcon(QIcon(GetImagePath() + "icon/Rename.png")); // 设置图标":/image/u174.png"
|
||||
connect(action_ReName, SIGNAL(triggered()), this, SLOT(onReNameObject()));
|
||||
menu->addAction(action_ReName);
|
||||
|
||||
menu->addAction(m_action_Paste);
|
||||
|
||||
//
|
||||
|
|
@ -934,6 +964,16 @@ void QtProjectWidgets::initTableFolderTreeMenu(QMenu *menu, QTreeWidget *treeWid
|
|||
QAction* action_New = new QAction("创建新表", treeWidget);
|
||||
action_New->setIcon(QIcon(GetImagePath() + "icon/CreateTable.png")); // 设置图标
|
||||
connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onCreateNewTable()));
|
||||
menu->addAction(action_New);
|
||||
|
||||
action_New = new QAction("升序", treeWidget);
|
||||
action_New->setIcon(QIcon(GetImagePath() + "icon/AscendingOrder.png")); // 设置图标
|
||||
connect(action_New, SIGNAL(triggered(bool)), this, SLOT(slotAsendSort()));
|
||||
menu->addAction(action_New);
|
||||
|
||||
action_New = new QAction("降序", treeWidget);
|
||||
action_New->setIcon(QIcon(GetImagePath() + "icon/DescendingOrder.png")); // 设置图标
|
||||
connect(action_New, SIGNAL(triggered(bool)), this, SLOT(slotDesendSort()));
|
||||
menu->addAction(action_New);
|
||||
|
||||
menu->addAction(m_action_Paste);
|
||||
|
|
@ -941,16 +981,46 @@ void QtProjectWidgets::initTableFolderTreeMenu(QMenu *menu, QTreeWidget *treeWid
|
|||
//初始化根节点(曲线表目录)-右键菜单
|
||||
void QtProjectWidgets::initCurveFolderTreeMenu(QMenu *menu, QTreeWidget *treeWidget)
|
||||
{
|
||||
QAction* action_New = new QAction("升序", treeWidget);
|
||||
action_New->setIcon(QIcon(GetImagePath() + "icon/AscendingOrder.png")); // 设置图标
|
||||
connect(action_New, SIGNAL(triggered(bool)), this, SLOT(slotAsendSort()));
|
||||
menu->addAction(action_New);
|
||||
|
||||
action_New = new QAction("降序", treeWidget);
|
||||
action_New->setIcon(QIcon(GetImagePath() + "icon/DescendingOrder.png")); // 设置图标
|
||||
connect(action_New, SIGNAL(triggered(bool)), this, SLOT(slotDesendSort()));
|
||||
menu->addAction(action_New);
|
||||
|
||||
menu->addAction(m_action_Paste);
|
||||
}
|
||||
//初始化根节点(参数卡目录)-右键菜单
|
||||
void QtProjectWidgets::initParCardFolderTreeMenu(QMenu *menu, QTreeWidget *treeWidget)
|
||||
{
|
||||
QAction* action_New = new QAction("升序", treeWidget);
|
||||
action_New->setIcon(QIcon(GetImagePath() + "icon/AscendingOrder.png")); // 设置图标
|
||||
connect(action_New, SIGNAL(triggered(bool)), this, SLOT(slotAsendSort()));
|
||||
menu->addAction(action_New);
|
||||
|
||||
action_New = new QAction("降序", treeWidget);
|
||||
action_New->setIcon(QIcon(GetImagePath() + "icon/DescendingOrder.png")); // 设置图标
|
||||
connect(action_New, SIGNAL(triggered(bool)), this, SLOT(slotDesendSort()));
|
||||
menu->addAction(action_New);
|
||||
|
||||
menu->addAction(m_action_Paste);
|
||||
}
|
||||
//初始化根节点(波列目录)-右键菜单
|
||||
void QtProjectWidgets::initWaveFolderTreeMenu(QMenu *menu, QTreeWidget *treeWidget)
|
||||
{
|
||||
QAction* action_New = new QAction("升序", treeWidget);
|
||||
action_New->setIcon(QIcon(GetImagePath() + "icon/AscendingOrder.png")); // 设置图标
|
||||
connect(action_New, SIGNAL(triggered(bool)), this, SLOT(slotAsendSort()));
|
||||
menu->addAction(action_New);
|
||||
|
||||
action_New = new QAction("降序", treeWidget);
|
||||
action_New->setIcon(QIcon(GetImagePath() + "icon/DescendingOrder.png")); // 设置图标
|
||||
connect(action_New, SIGNAL(triggered(bool)), this, SLOT(slotDesendSort()));
|
||||
menu->addAction(action_New);
|
||||
|
||||
menu->addAction(m_action_Paste);
|
||||
}
|
||||
//新建项目
|
||||
|
|
@ -1763,16 +1833,24 @@ void QtProjectWidgets::onImportSingleWellLogData()
|
|||
// InterfaceWidget *pInterfaceWidget = new InterfaceWidget();//中间工作区
|
||||
// pMainWindow->m_centerWidgets->addTab(pInterfaceWidget, "导入数据");
|
||||
pai::datamodel::LoadAllPlugin("windows");
|
||||
QStringList listFiles;//=GetFileNames("选择数据文件",fileSuffix,QFileDialog::ExistingFiles);
|
||||
QString file_name = QFileDialog::getOpenFileName(this,tr("打开测井数据文件"), "","*.txt", 0);
|
||||
// listFiles.append(QString("D:/LogPlus/OutData/jph-307.txt"));
|
||||
listFiles.append(file_name);
|
||||
DiDepthProgress DepthProgress;
|
||||
ConvertorManager::GetInstance().LoadAllConvertorPlugin();
|
||||
ConvertorManager &pManager=ConvertorManager::GetInstance();
|
||||
pManager.all=0;
|
||||
QVector<QString>vSuffix=pManager.GetSupportFileExtensions();
|
||||
QString fileSuffix("数据文件(");
|
||||
for (int i=0;i<vSuffix.size();i++)
|
||||
{
|
||||
QString sSuffix="*.";
|
||||
sSuffix.append(vSuffix[i]);
|
||||
fileSuffix.append(sSuffix);
|
||||
fileSuffix.append(" ");
|
||||
}
|
||||
fileSuffix.append(")");
|
||||
QStringList listFiles;//=GetFileNames("选择数据文件",fileSuffix,QFileDialog::ExistingFiles);
|
||||
QString file_name = QFileDialog::getOpenFileName(this,tr("打开测井数据文件"), "",fileSuffix/*"*.txt *"*/, 0);
|
||||
// listFiles.append(QString("D:/LogPlus/OutData/jph-307.txt"));
|
||||
listFiles.append(file_name);
|
||||
QVector<IConvertor*> vConvertor=pManager.GetSupportConvertors(listFiles[0], &DepthProgress);
|
||||
// if (vConvertor.empty()) return ;
|
||||
if (vConvertor.empty())
|
||||
|
|
@ -1982,7 +2060,7 @@ void QtProjectWidgets::onItemClicked(QTreeWidgetItem* item, int index)
|
|||
else if (strTreeTag == "Curve")
|
||||
{
|
||||
//曲线数据-右键菜单
|
||||
popMenu = _menuTableFolder;
|
||||
popMenu = _menuCurveFolder;
|
||||
m_strSlfName = item->parent()->data(0, Qt::UserRole+1).toString();//从父节点(井次)获取slf
|
||||
}
|
||||
|
||||
|
|
@ -2030,6 +2108,116 @@ void QtProjectWidgets::onItemChanged(QTreeWidgetItem* item, int index)
|
|||
// }
|
||||
}
|
||||
|
||||
//勾选/不勾选树图节点
|
||||
void QtProjectWidgets::oncloseTreeEditor()
|
||||
{
|
||||
QString newWellName,strTreeTag;
|
||||
foreach(QTreeWidgetItem *pItem, ui->treeWidget->selectedItems())
|
||||
{
|
||||
strTreeTag = pItem->data(0, Qt::UserRole).toString();
|
||||
}
|
||||
|
||||
if(!m_strSlfName.isEmpty()&&strTreeTag == "wellItem")
|
||||
{
|
||||
QString path,Slfname, newSlfname;
|
||||
foreach(QTreeWidgetItem *pItem, ui->treeWidget->selectedItems())
|
||||
{
|
||||
QTreeWidgetItem *parentItem = pItem;
|
||||
if (parentItem && m_strSlfName == parentItem->data(0, Qt::UserRole+1).toString())
|
||||
{
|
||||
newWellName = parentItem->parent()->text(0);
|
||||
newSlfname = parentItem->text(0);
|
||||
}
|
||||
}
|
||||
GetWellNameAndPath(m_strSlfName,Slfname,path);
|
||||
// QString newfile=path+"/"+Slfname+"_backup.slf";
|
||||
QString newfile=path+"/"+newSlfname+".slf";
|
||||
if(!QFile::rename(m_strSlfName,newfile))
|
||||
{
|
||||
QMessageBox::information(NULL,"提示","重命名失败!");
|
||||
return ;
|
||||
}
|
||||
}
|
||||
else if (strTreeTag == "wellname")
|
||||
{
|
||||
QString path,strWellName,Wellpath, newWellpath;
|
||||
foreach(QTreeWidgetItem *pItem, ui->treeWidget->selectedItems())
|
||||
{
|
||||
QTreeWidgetItem *parentItem = pItem;
|
||||
if (parentItem && "wellname" == parentItem->data(0, Qt::UserRole).toString())
|
||||
{
|
||||
strWellName = parentItem->data(0, Qt::UserRole + 2).toString();
|
||||
newWellName = parentItem->text(0);
|
||||
}
|
||||
}
|
||||
|
||||
QString pathTmp=GetLogdataPath();
|
||||
Wellpath = pathTmp + g_prjname+"/#"+strWellName;
|
||||
newWellpath = pathTmp + g_prjname+"/#"+newWellName;
|
||||
|
||||
QDir ss;
|
||||
if(ss.rename(Wellpath,newWellpath))//改目录名
|
||||
{
|
||||
QString oldPath = newWellpath + "/" + strWellName + ".well";
|
||||
QString newPath = newWellpath + "/" + newWellName + ".well";
|
||||
if(ss.rename(oldPath,newPath))
|
||||
{
|
||||
SetWellRoundWellName(newPath, newWellName);
|
||||
|
||||
QStringList slffiles;
|
||||
chakan(newWellpath, slffiles, "*.slf");
|
||||
foreach(QString slfFile1, slffiles )
|
||||
{
|
||||
SetWellRoundWellName(slfFile1, newWellName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::warning(NULL,"提示","改目文件名不成功:\n"+oldPath+"\n 到 \n"+newWellpath);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(NULL,"提示","改目录名不成功:\n"+Wellpath+"\n 到 \n"+newWellpath);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QString strProjectFolder = GetProjectFolder();
|
||||
QString strProjectFile = strProjectFolder + g_prjname;
|
||||
strProjectFile += ".wwl";
|
||||
s_OpenProject(strProjectFile);
|
||||
|
||||
int topCount = ui->treeWidget->topLevelItemCount(); // 获取顶级节点数量
|
||||
if(topCount<1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QTreeWidgetItem *item = ui->treeWidget->topLevelItem(0);
|
||||
int childCount = item->childCount(); // 获取子节点数量
|
||||
for (int i = 0; i < childCount; ++i)
|
||||
{
|
||||
//井组,数据分析...
|
||||
QTreeWidgetItem *wellGroupItem = item->child(i);
|
||||
QString wellGroupname = wellGroupItem->text(0);
|
||||
if (wellGroupname == "井组")
|
||||
{
|
||||
int wellCount = wellGroupItem->childCount(); // 获取井节点数量
|
||||
for (int j = 0; j < wellCount; ++j)
|
||||
{
|
||||
//井组,数据分析...
|
||||
QTreeWidgetItem *wellItem = wellGroupItem->child(j);
|
||||
QString wellname = wellItem->text(0);
|
||||
if(wellname==newWellName)//井
|
||||
{
|
||||
wellItem->setExpanded(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//向左侧树图,追加固井结论表格
|
||||
void QtProjectWidgets::s_AddGujingToTree(QString strSlfName, QString strWellName, QString strLineName)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,16 +23,21 @@ public:
|
|||
private:
|
||||
Ui::QtProjectWidgetsClass *ui;
|
||||
|
||||
Q_SIGNALS:
|
||||
void closeTreeEditor();
|
||||
public slots:
|
||||
void slotButtonOk();
|
||||
void slotButtonNo();
|
||||
void slotButtonCancel();
|
||||
void slotAsendSort();
|
||||
void slotDesendSort();
|
||||
//void s_initTreeWidget(QString strName);//初始化树图控件
|
||||
void s_loadTreeWidget(QString fileFull);//加载树图
|
||||
|
||||
|
||||
void onItemClicked(QTreeWidgetItem* item, int index);//鼠标点击tree菜单项
|
||||
void onItemChanged(QTreeWidgetItem* item, int index);//勾选/不勾选
|
||||
void oncloseTreeEditor(); //重命名
|
||||
|
||||
//工区管理(项目)
|
||||
void onNewProject(bool checked = false); //新建项目
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ SUBDIRS = \
|
|||
ConvertorManager \
|
||||
DataOutput \
|
||||
SLFAscIIConvertor \
|
||||
LISConvertor \
|
||||
DrawBase \
|
||||
EditPlotHeader \
|
||||
logPlus
|
||||
|
|
@ -44,6 +45,7 @@ appDllTest.file = appDllTest/src/appDllTest.pro
|
|||
ConvertorManager.file = ConvertorManager/src/ConvertorManager.pro
|
||||
DataOutput.file = DataOutput/src/DataOutput.pro
|
||||
SLFAscIIConvertor.file = tran/SLFAscIIConvertor/src/SLFAsciiConvertor.pro
|
||||
LISConvertor.file = tran/LISConvertor/src/LISConvertor.pro
|
||||
DrawBase.file = DrawBase/src/DrawBase.pro
|
||||
EditPlotHeader.file = EditPlotHeader/src/EditPlotHeader.pro
|
||||
logPlus.file = logPlus/logPlus.pro
|
||||
|
|
@ -64,6 +66,7 @@ appDllTest.depends = Slfio
|
|||
ConvertorManager.depends = Slfio BaseFun OSGDataModel WellLogUI
|
||||
DataOutput.depends = Slfio BaseFun ConvertorManager
|
||||
SLFAscIIConvertor.depends = Slfio BaseFun OSGDataModel WellLogUI ConvertorManager
|
||||
LISConvertor.depends = Slfio BaseFun OSGDataModel WellLogUI ConvertorManager
|
||||
DrawBase.depends = Slfio
|
||||
EditPlotHeader.depends = Slfio OSGDataModel
|
||||
logPlus.depends = Slfio BaseFun WellLogUI qtpropertybrowser ConvertorManager OSGDataModel DataOutput HPluginManage CallPlugin DataMgr DrawBase ModuleConsole WFEngine EditPlotHeader
|
||||
|
|
|
|||
166
tran/LISConvertor/include/CStringType.h
Normal file
166
tran/LISConvertor/include/CStringType.h
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
/**
|
||||
* @file CStringTyle.h
|
||||
* @brief CString数据自定义、井以及井次结构体
|
||||
* @date 2014-10-10
|
||||
* @author: ZhouWenfei
|
||||
*/
|
||||
|
||||
#ifndef PAI_FRAME_CSTRING_H__
|
||||
#define PAI_FRAME_CSTRING_H__
|
||||
#pragma once
|
||||
#include <iostream>
|
||||
#include <QString>
|
||||
#include <QMessageBox>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QDialog>
|
||||
#include <QFormLayout>
|
||||
#include <QTextEdit>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFormLayout>
|
||||
#include <QPushButton>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <limits.h>
|
||||
#pragma warning( push ,0)
|
||||
//#include "BaseFunExport.h"
|
||||
#pragma warning( pop )
|
||||
//#ifdef MessageBox
|
||||
//#define MessageBox MessageBox
|
||||
//#endif
|
||||
#define MAX_PATH 1024
|
||||
//#define _MAX_PATH 1024
|
||||
#define MaxCurve 1024
|
||||
#define curve_name_len 256
|
||||
#define curve_unit_len 256
|
||||
#define MIN_RANK rank_char
|
||||
#define MAX_RANK rank_longlong
|
||||
|
||||
#define INTMAX_RANK rank_longlong
|
||||
#define SIZE_T_RANK rank_long
|
||||
#define PTRDIFF_T_RANK rank_long
|
||||
#define MB_OK QMessageBox::Ok
|
||||
typedef unsigned short WORD;
|
||||
#ifdef WIN32
|
||||
typedef unsigned long DWORD;
|
||||
typedef DWORD *LPDWORD;
|
||||
typedef void *HANDLE;
|
||||
#else
|
||||
typedef unsigned int DWORD;
|
||||
typedef DWORD *LPDWORD;
|
||||
typedef void *HANDLE;
|
||||
#endif
|
||||
typedef unsigned char BYTE;
|
||||
typedef char* LPSTR;
|
||||
typedef void* LPVOID;
|
||||
|
||||
class CString;
|
||||
typedef QList<CString> CStringList;
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
//#define REPR_INT 1
|
||||
//#define REPR_SHORT 2
|
||||
//#define REPR_LONG 3
|
||||
//#define REPR_FLOAT 4
|
||||
//#define REPR_DOUBLE 5
|
||||
//#define REPR_STRING 6
|
||||
//#define REPR_CHAR 7
|
||||
//#define REPR_UCHAR 8
|
||||
//#define REPR_USHORT 9
|
||||
//#define REPR_UINT 10
|
||||
//#define REPR_ULONG 11
|
||||
//class BASEFUN_EXPORT CString;
|
||||
|
||||
//构建CString
|
||||
class CString
|
||||
{
|
||||
public:
|
||||
CString(const char *str = nullptr);
|
||||
CString(const QString str);
|
||||
CString(const CString &other);
|
||||
~CString();
|
||||
|
||||
int GetLength()const;
|
||||
int Find(char *str);
|
||||
int Find(char str);
|
||||
int Find(CString &another);
|
||||
int Find(char str[],int start);
|
||||
int ReverseFind(char ch);
|
||||
int Insert(int pos ,const CString Sctr);
|
||||
int Replace(const char *Src,const char *Dest);
|
||||
CString & TrimLeft();
|
||||
CString & MakeUpper();
|
||||
CString& MakeLower();
|
||||
CString & TrimRight();
|
||||
bool operator==(const char* other );
|
||||
bool operator!=(const char* other );
|
||||
bool operator==(const CString& other );
|
||||
bool operator!=(const CString& other );
|
||||
char operator[](int i);
|
||||
CString Right(int count)const;
|
||||
CString Left(int count)const;
|
||||
// CString operator = (const QString& SrcStr) ;
|
||||
CString operator + (const CString& SrcStr) ;
|
||||
CString operator += (CString& SrcStr) ;
|
||||
CString operator += (const CString& SrcStr) ;
|
||||
char* GetString()const;
|
||||
char GetChar(int n);
|
||||
char GetAt(int n);
|
||||
CString Mid(int pos,int count)const;
|
||||
CString Mid(int pos)const;
|
||||
void Format(const char *format,...);
|
||||
void Delete(int fromIndex,int length);
|
||||
// const char *m_temp;
|
||||
void Alloc(int len);
|
||||
void Empty();
|
||||
private:
|
||||
QString m_data;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
enum flags {
|
||||
FL_SPLAT0 = 0x00,/* Drop the value, do not assign */
|
||||
|
||||
FL_SPLAT = 0x01,/* Drop the value, do not assign */
|
||||
FL_INV = 0x02,/* Character-set with inverse */
|
||||
FL_WIDTH = 0x04,/* Field width specified */
|
||||
FL_MINUS = 0x08,/* Negative number */
|
||||
|
||||
};
|
||||
|
||||
enum ranks {
|
||||
|
||||
rank_char = -2,
|
||||
rank_short = -1,
|
||||
rank_int = 0,
|
||||
rank_long = 1,
|
||||
rank_longlong = 2,
|
||||
rank_ptr = INT_MAX/* Special value used for pointers */
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
enum bail {
|
||||
|
||||
bail_none = 0,/* No error condition */
|
||||
bail_eof,/* Hit EOF */
|
||||
bail_err/* Conversion mismatch */
|
||||
|
||||
};
|
||||
int AfxMessageBox(CString str);
|
||||
int MessageBox(QWidget *parent,char lpText[128],char*lpCaption, int UINTuType);
|
||||
void ShowMessage(QString mess);
|
||||
|
||||
//构建AfxMessageBox()函数
|
||||
//extern int BASEFUN_EXPORT AfxMessageBox(CString str);
|
||||
//extern int BASEFUN_EXPORT MessageBox(QWidget *parent,char lpText[128],char*lpCaption, int UINTuType);
|
||||
// using namespace pai::graphics;
|
||||
#endif
|
||||
|
||||
64
tran/LISConvertor/include/LisConvertor.h
Normal file
64
tran/LISConvertor/include/LisConvertor.h
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
* @file CLisConvertor.h
|
||||
* @brief LisConvertor格式解析器(解析Forward的txt格式文件)
|
||||
* @date 2014-7-29
|
||||
* @author: ZhouWenfei
|
||||
*/
|
||||
#ifndef PAI_FRAME_FOWWARDCONVERTOR_H__
|
||||
#define PAI_FRAME_FOWWARDCONVERTOR_H__
|
||||
|
||||
#pragma warning( push ,0)
|
||||
|
||||
#include "IConvertor.h"
|
||||
#include "ConvertorManager.h"
|
||||
#include "ObjectID.h"
|
||||
#include "InterIConvertor.h"
|
||||
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
#pragma warning( pop )
|
||||
BEGIN_OSGGRAPHICS_NAMESPACE;
|
||||
|
||||
class CLisConvertor :public InterIConvertor
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
CLisConvertor();
|
||||
|
||||
~CLisConvertor();
|
||||
|
||||
public:
|
||||
|
||||
virtual int ScanLogFile(char *FileName,char *Message,char **CurveName,char **CurveUnit);
|
||||
virtual bool Transfer(char *FileName,char *outfile,int *OutCurveNo,char **OutCurve,char **strChineseName,char **strUnit,int dCurveNum);
|
||||
|
||||
/**
|
||||
* @brief 该格式解析器支持的文件后缀名
|
||||
* @return QVector<QString> this convertor support all suffix file
|
||||
*/
|
||||
virtual QVector<QString>GetSupportFileExtensions();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
/**
|
||||
* @brief 初始化格式解析器支持的文件所有的后缀名
|
||||
*/
|
||||
|
||||
virtual void InitFormatSuffixName();
|
||||
|
||||
|
||||
|
||||
private:
|
||||
bool isSpLis;
|
||||
int ngapbyteSpFirst;
|
||||
|
||||
private:
|
||||
|
||||
QVector<QString>m_vFileFormatSuffixName;
|
||||
QVector<QString>m_vCurvefileName;
|
||||
};
|
||||
END_OSGGRAPHICS_NAMESPACE
|
||||
using namespace pai::graphics;
|
||||
#endif
|
||||
326
tran/LISConvertor/src/CStringType.cpp
Normal file
326
tran/LISConvertor/src/CStringType.cpp
Normal file
|
|
@ -0,0 +1,326 @@
|
|||
#include "CStringType.h"
|
||||
#include <QLabel>
|
||||
char *m_temp=NULL;
|
||||
CString::CString(const char *str)
|
||||
{
|
||||
m_temp=NULL;
|
||||
if(str==NULL)
|
||||
m_data ="";
|
||||
else
|
||||
m_data=QString::fromLocal8Bit(str);
|
||||
}
|
||||
CString::CString(const QString str)
|
||||
{
|
||||
m_temp=NULL;
|
||||
if(str==NULL)
|
||||
m_data ="";
|
||||
else
|
||||
m_data=str;
|
||||
}
|
||||
|
||||
CString::~CString()
|
||||
{
|
||||
if(m_temp) delete m_temp;
|
||||
m_temp=NULL;
|
||||
};
|
||||
void CString::Empty()
|
||||
{
|
||||
m_data ="";
|
||||
}
|
||||
|
||||
CString::CString(const CString &other)
|
||||
{
|
||||
m_temp=NULL;
|
||||
m_data=other.m_data;
|
||||
}
|
||||
int CString::GetLength()const
|
||||
{
|
||||
return m_data.length();
|
||||
}
|
||||
int CString::Find(char *str)
|
||||
{
|
||||
std::string dataStr=m_data.toStdString();
|
||||
return dataStr.find(str);
|
||||
}
|
||||
int CString::Find(CString &another)
|
||||
{
|
||||
return m_data.toStdString().find(another.m_data.toStdString());
|
||||
}
|
||||
int CString::Find(char str)
|
||||
{
|
||||
std::string dataStr=m_data.toStdString();
|
||||
return dataStr.find(str);
|
||||
}
|
||||
/*
|
||||
|
||||
*/
|
||||
int CString::Find(char str[],int start)
|
||||
{
|
||||
std::string dataStr=m_data.toStdString();
|
||||
int npos=dataStr.find(str);
|
||||
if(npos==-1)
|
||||
return -1;
|
||||
if(npos<start)
|
||||
return -1;
|
||||
return dataStr.find(str);
|
||||
}
|
||||
int CString::ReverseFind(char ch)
|
||||
{
|
||||
int index=m_data.lastIndexOf(ch);
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
int CString::Insert(int pos ,const CString Sctr)
|
||||
{
|
||||
m_data.insert(pos,Sctr.m_data);
|
||||
return m_data.length();
|
||||
}
|
||||
|
||||
int CString::Replace(const char *Src,const char *Dest)
|
||||
{
|
||||
int length=((std::string)Src).length();
|
||||
QString srcStr=QString::fromLocal8Bit(Src);
|
||||
QString destStr=QString::fromLocal8Bit(Dest);
|
||||
m_data.replace(srcStr,destStr);
|
||||
return length;
|
||||
}
|
||||
void CString::Delete(int fromIndex,int length)
|
||||
{
|
||||
m_data=m_data.remove(fromIndex,length);
|
||||
}
|
||||
CString & CString::TrimLeft()
|
||||
{
|
||||
std::string findStr=" ";
|
||||
std::string tempstr=m_data.toStdString();
|
||||
QString temp=m_data;
|
||||
vector<char>StrVector;
|
||||
int left=0;
|
||||
for (int i=0;i<tempstr.length();i++)
|
||||
{
|
||||
if(tempstr.at(i)==findStr.at(0)) {
|
||||
left++;
|
||||
continue;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
m_data=temp.mid(left);
|
||||
return *this;
|
||||
}
|
||||
CString & CString::MakeUpper()
|
||||
{
|
||||
m_data=m_data.toUpper();
|
||||
return *this;
|
||||
}
|
||||
CString& CString::MakeLower()
|
||||
{
|
||||
m_data=m_data.toLower();
|
||||
return *this;
|
||||
}
|
||||
CString & CString::TrimRight()
|
||||
{
|
||||
std::string findStr=" ";
|
||||
std::string tempstr=m_data.toStdString();
|
||||
QString temp=m_data;
|
||||
int flag=0;
|
||||
for (int i=tempstr.length()-1;i>-1;i--)
|
||||
{
|
||||
if(tempstr[i]==findStr.at(0)) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
flag=i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_data=temp.left(flag+1);
|
||||
return *this;
|
||||
}
|
||||
bool CString::operator==(const char* other )
|
||||
{
|
||||
QString srcStr=QString::fromLocal8Bit(other);
|
||||
if(this->m_data==srcStr)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
bool CString::operator!=(const char* other )
|
||||
{
|
||||
QString srcStr=QString::fromLocal8Bit(other);
|
||||
if(this->m_data!=srcStr)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
char CString::operator[](int i)
|
||||
{
|
||||
char ch=GetChar(i);
|
||||
return ch;
|
||||
}
|
||||
CString CString::Right(int count)const
|
||||
{
|
||||
if (count<0)
|
||||
{
|
||||
count=0;
|
||||
}
|
||||
if (count>m_data.length())
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
int length=m_data.length();
|
||||
QString temp=m_data;
|
||||
QString lastdata=temp.remove(0,length-count);
|
||||
CString RightStr(lastdata);
|
||||
return RightStr;
|
||||
}
|
||||
CString CString::Mid(int pos,int count)const
|
||||
{
|
||||
if (count<0)
|
||||
{
|
||||
count=0;
|
||||
}
|
||||
QString temp=m_data.mid(pos,count);
|
||||
CString mstr(temp);
|
||||
return mstr;
|
||||
}
|
||||
CString CString::Mid(int pos)const
|
||||
{
|
||||
QString temp=m_data.mid(pos);
|
||||
CString mstr(temp);
|
||||
return mstr;
|
||||
}
|
||||
|
||||
CString CString::Left(int count)const
|
||||
{
|
||||
if (count<0)
|
||||
{
|
||||
count=0;
|
||||
}
|
||||
if (count>m_data.length())
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
int length=m_data.length();
|
||||
QString temp=m_data;
|
||||
QString lastdata=temp.remove(count,length-count);
|
||||
CString leftStr(lastdata);
|
||||
return leftStr;
|
||||
}
|
||||
|
||||
CString CString::operator + (const CString& SrcStr)
|
||||
{
|
||||
CString str;
|
||||
str.m_data=m_data+SrcStr.m_data;
|
||||
return str;
|
||||
}
|
||||
/*
|
||||
CString CString::operator = (const QString& SrcStr)
|
||||
{
|
||||
CString str;
|
||||
str.m_data=SrcStr;
|
||||
return str;
|
||||
}
|
||||
*/
|
||||
CString CString::operator += (CString& SrcStr)
|
||||
{
|
||||
m_data = m_data+SrcStr.m_data ;
|
||||
return *this;
|
||||
}
|
||||
CString CString::operator += (const CString& SrcStr)
|
||||
{
|
||||
m_data = m_data+SrcStr.m_data ;
|
||||
return *this;
|
||||
}
|
||||
bool CString::operator!=(const CString& other )
|
||||
{
|
||||
return m_data!=other.m_data;
|
||||
}
|
||||
bool CString::operator==(const CString& other )
|
||||
{
|
||||
return m_data==other.m_data;
|
||||
}
|
||||
|
||||
void CString::Alloc(int len)
|
||||
{
|
||||
}
|
||||
char* CString::GetString() const
|
||||
{
|
||||
int length=((string)(m_data.toLocal8Bit().data())).length();
|
||||
if(m_temp) delete m_temp;
|
||||
m_temp=new char[length+1];
|
||||
// Alloc(length);
|
||||
strcpy(m_temp,m_data.toLocal8Bit().data());
|
||||
return m_temp;
|
||||
}
|
||||
char CString::GetChar(int n)
|
||||
{
|
||||
return GetString()[n];
|
||||
}
|
||||
char CString::GetAt(int n)
|
||||
{
|
||||
return GetChar(n);
|
||||
}
|
||||
|
||||
void CString::Format(const char *format,...)
|
||||
{
|
||||
//char *str=GetString();
|
||||
va_list args;
|
||||
va_start(args,format);
|
||||
m_data.vsprintf(format,args);
|
||||
char *buf=new char[2*strlen(m_data.toStdString().c_str())+1];
|
||||
vsprintf(buf,format,args);
|
||||
m_data=buf;
|
||||
delete buf;
|
||||
va_end(args);
|
||||
}
|
||||
void ShowMessage(QString mess)
|
||||
{
|
||||
QDialog dialog(NULL);
|
||||
dialog.setModal(false);
|
||||
Qt::WindowFlags flags = dialog.windowFlags();
|
||||
flags |= Qt::WindowStaysOnTopHint;
|
||||
flags &= ~Qt::WindowContextHelpButtonHint;
|
||||
dialog.setWindowFlags(flags);
|
||||
dialog.setWindowTitle("提示");
|
||||
QFormLayout form(&dialog);
|
||||
QLabel edit(&dialog);
|
||||
form.addRow(&edit);
|
||||
edit.setText(mess);
|
||||
// QDialogButtonBox buttonBox(QDialogButtonBox::Yes,Qt::Horizontal, &dialog);
|
||||
// form.addRow(&buttonBox);
|
||||
// if(buttonBox.button(QDialogButtonBox::Yes)) buttonBox.button(QDialogButtonBox::Yes)->setText("退出");
|
||||
// QObject::connect(buttonBox.button(QDialogButtonBox::Yes), SIGNAL(clicked()), NULL, SLOT(reject()));
|
||||
dialog.show();
|
||||
dialog.exec();
|
||||
}
|
||||
int AfxMessageBox(CString str)
|
||||
{
|
||||
QDialog dialog(NULL);
|
||||
dialog.setModal(false);
|
||||
Qt::WindowFlags flags = dialog.windowFlags();
|
||||
flags |= Qt::WindowStaysOnTopHint;
|
||||
flags &= ~Qt::WindowContextHelpButtonHint;
|
||||
dialog.setWindowFlags(flags);
|
||||
dialog.setWindowTitle("提示");
|
||||
QFormLayout form(&dialog);
|
||||
form.addWidget(new QLabel(str.GetString()));
|
||||
// dialog.show();
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
// Do something here
|
||||
}
|
||||
// return MessageBox(NULL,"提示",str.GetString(),NULL );
|
||||
// QString cstr=str.GetString();
|
||||
// QMessageBox msgBox;
|
||||
// msgBox.setText(cstr);
|
||||
// return msgBox.exec();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int MessageBox(QWidget *parent,char lpText[128],char*lpCaption, int UINTuType)
|
||||
{
|
||||
if (!parent)
|
||||
{
|
||||
char *tempName=lpCaption;
|
||||
QString addStr=QString::fromLocal8Bit(tempName);
|
||||
return QMessageBox::information(NULL,lpText,addStr,QMessageBox::Ok);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
1428
tran/LISConvertor/src/LisConvertor.cpp
Normal file
1428
tran/LISConvertor/src/LisConvertor.cpp
Normal file
File diff suppressed because it is too large
Load Diff
77
tran/LISConvertor/src/LisConvertor.pro
Normal file
77
tran/LISConvertor/src/LisConvertor.pro
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
TEMPLATE = lib
|
||||
TARGET = LisConvertor
|
||||
QT += core \
|
||||
gui \
|
||||
opengl\
|
||||
|
||||
|
||||
INCLUDEPATH += $(OSGHOME)/include \
|
||||
../include \
|
||||
../../OSGParts/include \
|
||||
../../../WellLogUI/include \
|
||||
../../../OSGFramework/include \
|
||||
../../../common\
|
||||
../../../BaseFun/include\
|
||||
../../../Slfio/include\
|
||||
../../../ConvertorManager/include\
|
||||
../../../OSGDataModel/include\
|
||||
./GeneratedFiles
|
||||
|
||||
#include(../../OSGDataModel/paiobjectmodel.libinfo)
|
||||
|
||||
HEADERS += ../include/*.h \
|
||||
../../../common/geometryutils.h
|
||||
|
||||
SOURCES += *.cpp \
|
||||
../../../common/geometryutils.cpp
|
||||
|
||||
|
||||
|
||||
OBJECTS_DIR = ../obj
|
||||
DESTDIR = ../bin
|
||||
CONFIG += qt \
|
||||
debug_and_release
|
||||
DEFINES += QT_DLL
|
||||
|
||||
CONFIG(debug, debug|release){
|
||||
LIBS += -L$$PWD/../../../Bin -lOSGDataModeld
|
||||
LIBS += -L$$PWD/../../../Bin -lBaseFund
|
||||
LIBS += -L$$PWD/../../../Bin -lslfiod
|
||||
LIBS += -L$$PWD/../../../Bin -lWellLogUId
|
||||
LIBS += -L$$PWD/../../../Bin -lConvertorManagerd
|
||||
} else {
|
||||
LIBS += -L$$PWD/../../../BinR -lOSGDataModel
|
||||
LIBS += -L$$PWD/../../../BinR -lBaseFun
|
||||
LIBS += -L$$PWD/../../../BinR -lslfio
|
||||
LIBS += -L$$PWD/../../../BinR -lWellLogUI
|
||||
LIBS += -L$$PWD/../../../BinR -lConvertorManager
|
||||
}
|
||||
#include(../../OSGParts/src/osg.LibInfo)
|
||||
|
||||
#LIBS += -lOSGParts \
|
||||
# -L../../OSGParts/bin
|
||||
|
||||
#LIBS += -lOSGFramework \
|
||||
# -L../../OSGFramework/bin
|
||||
|
||||
#LIBS += -L$$(PAI_HOME)/lib -lOSGDataModel
|
||||
|
||||
#LIBS += -L$$(PAI_HOME)/lib -lConvertorManager
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#RESOURCES +=
|
||||
#QMAKE_POST_LINK = cp ../bin/*.* /opt/pi/bin
|
||||
#QMAKE_POST_LINK = cp ../bin/*.so $(PAI_HOME)/lib/
|
||||
|
||||
CONFIG(debug, debug|release){
|
||||
DESTDIR = $$PWD/../../../Bin/convertor
|
||||
TARGET = $$join(TARGET,,,d) #为debug版本生成的文件增加d的后缀
|
||||
} else {
|
||||
DESTDIR = $$PWD/../../../BinR/convertor
|
||||
TARGET = $$join(TARGET,,,)
|
||||
}
|
||||
|
||||
1361
tran/LISConvertor/src/sub.cpp
Normal file
1361
tran/LISConvertor/src/sub.cpp
Normal file
File diff suppressed because it is too large
Load Diff
28
tran/LISConvertor/src/sub.h
Normal file
28
tran/LISConvertor/src/sub.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include "MemRdWt.h"/*..\..\Slfio\*/
|
||||
#include "BaseFun.h"
|
||||
#include "math.h"
|
||||
|
||||
void Test(char *FileName);
|
||||
void lrcls(unsigned char ctype,int *idrt,int *lrtype) ;
|
||||
void pratr(unsigned char chatr1,unsigned char chatr2,int *pmatr);
|
||||
void rdbufp(FILE *fp,unsigned char *buff,int lbuff,int lrtype,int istats,int maxrl,int nbyte,int ngpbyte);
|
||||
//
|
||||
//- read a logical record length from disk file.
|
||||
void rdbuf(FILE *fp,unsigned char *buff,int *lbuff,int *lrtype,int *istats,int maxrl,int *nbyte,int ngpbyte);
|
||||
CString reelhd(char *buff);
|
||||
CString tapehd(char *buff);
|
||||
CString filehd(char *buff,int *maxrl);
|
||||
float unitfactor(char *depunit,int len);
|
||||
CString formsp(char *buff,int lbuff,int iswitab);
|
||||
void convrt(float *value,unsigned char *buff,int lbuff,int ips,int irecod,int nsamp);
|
||||
CString infrec(char *buff,int lbuff,int iswitab);
|
||||
int lbytes(int ircode);
|
||||
int lwbytes(int ircode);
|
||||
int idtype(int ircode);
|
||||
void scdtype(char *cdtype,int ircode);
|
||||
void fsinglc(char *cha,float value,int *nbyte);
|
||||
void fsinglb(char *cha,float *value,int npoints,int *nbyte);
|
||||
void snormb(char *cha,short *ivalue,int npoints,int *nbyte);
|
||||
void snormb(uchar *cha,ushort *ivalue,int npoints,int *nbyte);
|
||||
void slongb(char *cha,int *ivalue,int npoints,int *nbyte);
|
||||
CString CharToCstring(char *buf,int len);
|
||||
Loading…
Reference in New Issue
Block a user