diff --git a/BaseFun/src/wvst.cpp b/BaseFun/src/wvst.cpp index b87d755..dc9189d 100644 --- a/BaseFun/src/wvst.cpp +++ b/BaseFun/src/wvst.cpp @@ -894,15 +894,15 @@ int dft(double *in_buffer,int *wave_len,int array_num,int eq_1,int eq_0)//int * // mov var_1C, 2 var_20=1; var_1C=2; -char p1[8]={0x54,0x41,0x17,0x44,0x40,0x19,0x21,0xFB}; -char p2[8]={0x66,0x81,0x15,0x1E,0x3F,0xE6,0xA0,0x9E}; -char p3[8]={0xFE,0xFA,0x39,0xEF,0x3F,0xE6,0x2E,0x42}; -char p4[8]={0xFE,0xFA,0x39,0xEF,0x3F,0xF6,0x2E,0x42}; +unsigned char p1[8]={0x54,0x41,0x17,0x44,0x40,0x19,0x21,0xFB}; +unsigned char p2[8]={0x66,0x81,0x15,0x1E,0x3F,0xE6,0xA0,0x9E}; +unsigned char p3[8]={0xFE,0xFA,0x39,0xEF,0x3F,0xE6,0x2E,0x42}; +unsigned char p4[8]={0xFE,0xFA,0x39,0xEF,0x3F,0xF6,0x2E,0x42}; -char p10[8]={0x40,0x19,0x21,0xFB,0x54,0x41,0x17,0x44}; -char p20[8]={0x3F,0xE6,0xA0,0x9E,0x66,0x81,0x15,0x1E}; -char p30[8]={0x3F,0xE6,0x2E,0x42,0xFE,0xFA,0x39,0xEF}; -char p40[8]={0x3F,0xF6,0x2E,0x42,0xFE,0xFA,0x39,0xEF}; +unsigned char p10[8]={0x40,0x19,0x21,0xFB,0x54,0x41,0x17,0x44}; +unsigned char p20[8]={0x3F,0xE6,0xA0,0x9E,0x66,0x81,0x15,0x1E}; +unsigned char p30[8]={0x3F,0xE6,0x2E,0x42,0xFE,0xFA,0x39,0xEF}; +unsigned char p40[8]={0x3F,0xF6,0x2E,0x42,0xFE,0xFA,0x39,0xEF}; for(int i0=0;i0<8;i0++) { p1[i0]=p10[7-i0]; diff --git a/ConvertorManager/include/ConvertorExport.h b/ConvertorManager/include/ConvertorExport.h index 17eef75..b81f283 100644 --- a/ConvertorManager/include/ConvertorExport.h +++ b/ConvertorManager/include/ConvertorExport.h @@ -1,15 +1,15 @@ -#ifdef WIN32 - #ifdef CONVERTOR_LIB - #define CONVERTOR_EXPORT __declspec(dllexport) - #else - #define CONVERTOR_EXPORT __declspec(dllimport) - #endif -#else - #define CONVERTOR_EXPORT -#endif -#include "OSGFramework.h" - - - - - +#ifdef WIN32 + #ifdef CONVERTOR_LIB + #define CONVERTOR_EXPORT __declspec(dllexport) + #else + #define CONVERTOR_EXPORT __declspec(dllimport) + #endif +#else + #define CONVERTOR_EXPORT +#endif +#include "OSGFramework.h" + + + + + diff --git a/ConvertorManager/include/ConvertorManager.h b/ConvertorManager/include/ConvertorManager.h index ef9c302..f539fef 100644 --- a/ConvertorManager/include/ConvertorManager.h +++ b/ConvertorManager/include/ConvertorManager.h @@ -1,106 +1,106 @@ -/** -* @file ConvertorManager.h -* @brief 格式转换器管理器 -* @date 2014-7-29 -* @author: ZhouWenfei -*/ -#ifndef PAI_FRAME_CONVERTORMANAGER_H__ -#define PAI_FRAME_CONVERTORMANAGER_H__ - -#pragma warning( push ,0) - -#include -#include -#include -#include -#include "QList" -#include -#include -#include -#include -#include "DepthProgress.h" -#include "ConvertorExport.h" -#include "IConvertor.h" -#include "geometryutils.h" -//#include "BaseObject.h" -//#include "ObjWelllogRound.h" -#include "ObjectIDDescription.h" - -#pragma execution_character_set("utf-8") - -#pragma warning( pop ) -BEGIN_OSGGRAPHICS_NAMESPACE; -class CONVERTOR_EXPORT ConvertorManager -{ - -public: - int all; - ~ConvertorManager(); - /** - * @brief 获取类单一实例 - */ - static ConvertorManager&GetInstance() - { - static ConvertorManager Instance; - return Instance; - } - -public: - - /** - * @brief 加载系统中的所有格式转换控制器 - * @param[in]convtorTypeName 转换器类型 - */ - void LoadAllConvertorPlugin(); - void UnLoadAllConvertorPlugin(); - - /** - * @brief 获取能解析指定文件的所有转换器 - * @param[in]filename 文件名 - * @return QVector 指定文件的所有转换器的vector - */ - - QVectorGetSupportConvertors(const QString &filename,DiDepthProgress *pDepthProgress); - - /** - * @brief 有格式转换器能支持文件的后缀名 - * @return QVector support filename all convertor vector - */ - QVectorGetSupportFileExtensions(); - /** - * @brief 获取所有的格式转换器 - * @return QVector all convertor vector - */ - QVectorGetAllConvertors(); - -private: - - ConvertorManager(); - -private: - - /** - * @brief 统计所有的格式转换器 - */ - void StatisticalAllConvertors(); - - /** - * @brief 所有的格式转换器 - */ - QVectorm_vAllConvertors; - - /** - * @brief 所有格式转换器能支持文件的后缀名 - */ - QVectorm_vAllSuffixFileName; - - - /** - * @brief 文件名支持的所有格式转换器 - */ - QVectorm_vFileNameSupportConvertor; - QStringList m_vConvertorNames; -}; -END_OSGGRAPHICS_NAMESPACE -using namespace pai::graphics; -#endif +/** +* @file ConvertorManager.h +* @brief 格式转换器管理器 +* @date 2014-7-29 +* @author: ZhouWenfei +*/ +#ifndef PAI_FRAME_CONVERTORMANAGER_H__ +#define PAI_FRAME_CONVERTORMANAGER_H__ + +#pragma warning( push ,0) + +#include +#include +#include +#include +#include "QList" +#include +#include +#include +#include +#include "DepthProgress.h" +#include "ConvertorExport.h" +#include "IConvertor.h" +#include "geometryutils.h" +//#include "BaseObject.h" +//#include "ObjWelllogRound.h" +#include "ObjectIDDescription.h" + +#pragma execution_character_set("utf-8") + +#pragma warning( pop ) +BEGIN_OSGGRAPHICS_NAMESPACE; +class CONVERTOR_EXPORT ConvertorManager +{ + +public: + int all; + ~ConvertorManager(); + /** + * @brief 获取类单一实例 + */ + static ConvertorManager&GetInstance() + { + static ConvertorManager Instance; + return Instance; + } + +public: + + /** + * @brief 加载系统中的所有格式转换控制器 + * @param[in]convtorTypeName 转换器类型 + */ + void LoadAllConvertorPlugin(); + void UnLoadAllConvertorPlugin(); + + /** + * @brief 获取能解析指定文件的所有转换器 + * @param[in]filename 文件名 + * @return QVector 指定文件的所有转换器的vector + */ + + QVectorGetSupportConvertors(const QString &filename,DiDepthProgress *pDepthProgress); + + /** + * @brief 有格式转换器能支持文件的后缀名 + * @return QVector support filename all convertor vector + */ + QVectorGetSupportFileExtensions(); + /** + * @brief 获取所有的格式转换器 + * @return QVector all convertor vector + */ + QVectorGetAllConvertors(); + +private: + + ConvertorManager(); + +private: + + /** + * @brief 统计所有的格式转换器 + */ + void StatisticalAllConvertors(); + + /** + * @brief 所有的格式转换器 + */ + QVectorm_vAllConvertors; + + /** + * @brief 所有格式转换器能支持文件的后缀名 + */ + QVectorm_vAllSuffixFileName; + + + /** + * @brief 文件名支持的所有格式转换器 + */ + QVectorm_vFileNameSupportConvertor; + QStringList m_vConvertorNames; +}; +END_OSGGRAPHICS_NAMESPACE +using namespace pai::graphics; +#endif diff --git a/ConvertorManager/include/DataImport.h b/ConvertorManager/include/DataImport.h index d05efa5..52e8d2a 100644 --- a/ConvertorManager/include/DataImport.h +++ b/ConvertorManager/include/DataImport.h @@ -1,75 +1,75 @@ -#ifndef PAI_FRAME_COSGDataImport_H -#define PAI_FRAME_COSGDataImport_H -#pragma warning( push ,0) -#include -// #include "OSGWindowShared.h" -#include "ObjWell.h" -#include "ObjWelllog.h" -// #include "VecSceneManager.h" -//#include "ConvertorManager.h" -#include "DepthProgress.h" -#include "ConvertorManager.h" -#pragma warning( pop ) -#pragma execution_character_set("utf-8") - -// class QUuid; -// class QString; -// using namespace pai::datamodel; - -// BEGIN_OSGGRAPHICS_NAMESPACE; -// class ConvertorManager; -// class CVecWindow; -// class CTestDialog; -// class CCompositeWindow; - -// void /*OSGWINDOWSHARED_EXPORT*/ slotImportSingleWellLogData(CVecViewCommand &viewCommand,QUuid /*e*/,bool bShow); - -class CONVERTOR_EXPORT CDataImport -{ -public: - static bool m_bImportByFolder; - - // //把Well 加入到OSGSceneManager - // static void AddWellNode( CVecSceneManager *pSceneManager,CObjWell *pWell,CObjWell *pWellInsertPos ); - - // //把Well log 加入到OSGSceneManager - // static void AddWellLogNode( CVecSceneManager *pSceneManager,CObjWellLog *pWellLog,CObjWellLog *pWellLogInsertPos ); - static void ImporttoTree(QString slfFileName,CLogIO *logio,CObjWell *pWell,CObjWelllogRound* pWelllogRound,char *curvename); - - //import well path object to project - static QList ImportWellTrajectorys(bool IsDir); - - //import bitmap object to project - static void ImportBitmaps(); - - static QList CDataImport::ImportWells(QString path,QStringList &wellfs,int *pNum=NULL,bool IsTran=true); - static QList CDataImport::ImportWells(QString path,QStringList &wellfs,char *pSuffix,int *pNum=NULL,bool IsTran=true); - - //import core image to project - static void ImportCoreImage(); - static void LoadLayers(QStringList &listFiles); - - //根据well name查找或新建一Well - static CObjWell * GetWellByName( QString strWellName ); - static void ImportConvertorWellLogFiles(QString wellname="",QString wellroundname=""); - static void ImportGeoStraData(); - static void OutPutGeoStraData(); - static void ImportWellXYCoordinate(); - static void OutPutWellXYCoordinate(); - - static int chakan(QList &wells,QString path,QStringList &wellfs,int &num,bool GetNum=false,DiDepthProgress *DepthProgress=NULL,char *pSuffix=NULL); - static QStringList GetFileNames(const QString &caption = QString(), const QString &filter = QString(),QFileDialog::FileMode filemode=QFileDialog::ExistingFiles); - static CObjWell *ChangetoSlf(QString wellFile,DiDepthProgress *DepthProgress=NULL); - //whp change 2019.12.12 - static QString ConvertorWellLogFiles(ConvertorManager &pManager,QString wellname,DiDepthProgress *DepthProgress=NULL); - static QString m_prjname; - static int flag1; - static int flag_check; - static int m_flag; - //whp add 2020.2.28 for 检查井名文件名是否存在,若存在,获取井次全路径文件名 - static QString CDataImport::GetOutName(QString wellname,QString filename); - static CObjWell *ChangetoSlf(QString wellFile1,DiDepthProgress *pDepthProgress,bool IsTran); -}; - -// END_OSGGRAPHICS_NAMESPACE -#endif +#ifndef PAI_FRAME_COSGDataImport_H +#define PAI_FRAME_COSGDataImport_H +#pragma warning( push ,0) +#include +// #include "OSGWindowShared.h" +#include "ObjWell.h" +#include "ObjWelllog.h" +// #include "VecSceneManager.h" +//#include "ConvertorManager.h" +#include "DepthProgress.h" +#include "ConvertorManager.h" +#pragma warning( pop ) +#pragma execution_character_set("utf-8") + +// class QUuid; +// class QString; +// using namespace pai::datamodel; + +// BEGIN_OSGGRAPHICS_NAMESPACE; +// class ConvertorManager; +// class CVecWindow; +// class CTestDialog; +// class CCompositeWindow; + +// void /*OSGWINDOWSHARED_EXPORT*/ slotImportSingleWellLogData(CVecViewCommand &viewCommand,QUuid /*e*/,bool bShow); + +class CONVERTOR_EXPORT CDataImport +{ +public: + static bool m_bImportByFolder; + + // //把Well 加入到OSGSceneManager + // static void AddWellNode( CVecSceneManager *pSceneManager,CObjWell *pWell,CObjWell *pWellInsertPos ); + + // //把Well log 加入到OSGSceneManager + // static void AddWellLogNode( CVecSceneManager *pSceneManager,CObjWellLog *pWellLog,CObjWellLog *pWellLogInsertPos ); + static void ImporttoTree(QString slfFileName,CLogIO *logio,CObjWell *pWell,CObjWelllogRound* pWelllogRound,char *curvename); + + //import well path object to project + static QList ImportWellTrajectorys(bool IsDir); + + //import bitmap object to project + static void ImportBitmaps(); + + static QList ImportWells(QString path,QStringList &wellfs,int *pNum=NULL,bool IsTran=true); + static QList ImportWells(QString path,QStringList &wellfs,char *pSuffix,int *pNum=NULL,bool IsTran=true); + + //import core image to project + static void ImportCoreImage(); + static void LoadLayers(QStringList &listFiles); + + //根据well name查找或新建一Well + static CObjWell * GetWellByName( QString strWellName ); + static void ImportConvertorWellLogFiles(QString wellname="",QString wellroundname=""); + static void ImportGeoStraData(); + static void OutPutGeoStraData(); + static void ImportWellXYCoordinate(); + static void OutPutWellXYCoordinate(); + + static int chakan(QList &wells,QString path,QStringList &wellfs,int &num,bool GetNum=false,DiDepthProgress *DepthProgress=NULL,char *pSuffix=NULL); + static QStringList GetFileNames(const QString &caption = QString(), const QString &filter = QString(),QFileDialog::FileMode filemode=QFileDialog::ExistingFiles); + static CObjWell *ChangetoSlf(QString wellFile,DiDepthProgress *DepthProgress=NULL); + //whp change 2019.12.12 + static QString ConvertorWellLogFiles(ConvertorManager &pManager,QString wellname,DiDepthProgress *DepthProgress=NULL); + static QString m_prjname; + static int flag1; + static int flag_check; + static int m_flag; + //whp add 2020.2.28 for 检查井名文件名是否存在,若存在,获取井次全路径文件名 + static QString GetOutName(QString wellname,QString filename); + static CObjWell *ChangetoSlf(QString wellFile1,DiDepthProgress *pDepthProgress,bool IsTran); +}; + +// END_OSGGRAPHICS_NAMESPACE +#endif diff --git a/ConvertorManager/include/IConvertor.h b/ConvertorManager/include/IConvertor.h index 9c20abc..cd4bb89 100644 --- a/ConvertorManager/include/IConvertor.h +++ b/ConvertorManager/include/IConvertor.h @@ -1,156 +1,156 @@ -/** -* @file IConvertor.h -* @brief 格式解析器抽象类 -* @date 2014-7-29 -* @author: ZhouWenfei -*/ - -#ifndef PAI_FRAME_ICONVERTOR_H__ -#define PAI_FRAME_ICONVERTOR_H__ - -#pragma warning( push ,0) - -#include -#include - -#include "ConvertorExport.h" -#include "ObjectGenralFactory.h" -#include "ObjWell.h" -#include "ObjWelllog.h" -#include "MyWelllogRound.h" -#include "DepthProgress.h" - -#pragma execution_character_set("utf-8") - -#pragma warning( pop ) - -BEGIN_OSGGRAPHICS_NAMESPACE; - -struct CONVERTOR_EXPORT sConvertorKey -{ -public: - - sConvertorKey(); - - sConvertorKey(QUuid ConvertorTypeClassIDTmp,QString strConvertorTypeName); - - bool operator !=( const sConvertorKey& s ); - - bool operator< ( const sConvertorKey& s ) const; - -public: - - QUuid m_ConvertorTypeClassID; // Convertor type ID - QString m_strConvertorTypeName; // Convertor type name -}; - -class CONVERTOR_EXPORT IConvertor -{ - -public: - - IConvertor(); - - virtual ~IConvertor(); - -public: - /** - * 本接口仅供测试模块使用,请勿使用 - */ - virtual bool OnlyForTest(){return false;}; - virtual bool Init() - { - m_WellInfo->Init(); - m_WellLogRoundInfo->Init(); - // memset(&m_WellInfo,0,sizeof(m_WellInfo)); - // memset(&m_WellLogRoundInfo,0,sizeof(m_WellLogRoundInfo)); - return true; - }; - /** - * @brief 文件是否支持这种格式 - * @param[in]filename 文件名 - * @return if true support filename else not - */ - virtual bool IsSupport(const QString &filename) - { - Init(); - return 0; - }; - - - /** - * @brief 该格式解析器支持的文件后缀名 - * @return QVector this convertor support all suffix file - */ - virtual QVectorGetSupportFileExtensions()=0; - virtual void InitFormatSuffixName(); - QString m_thisModuleName; - - /** - * @brief 指定文件的解编出来的文件头内容 - * @param[in]filename 文件名 - * @return QString file content - */ - virtual QString GetFileContent(const QString &filename)=0; - virtual QStringList &GetListHead(){ - return m_FileHead; - }; - virtual void SetListHead(QStringList FileHead){ - m_FileHead=FileHead; - }; - - virtual void SetDepthProgress(DiDepthProgress *pDepthProgress) - { - m_pDepthProgress=pDepthProgress; - } - - /** - * @brief 指定文件的测井曲线的元数据 - * @param[in]filename 文件名 - * @return QVector file contains all welllog curve - */ - //virtual QList GetWellLogList(const QString &filename)=0; - - /** - * @brief 获取井信息 - * @return well - */ - - pai::ios::welllog::Well *GetWellInfo(); - - /** - * @brief 获取井次 - * @return WelllogRound 井次 - */ - MyWelllogRound *GetWellLogRoundInfo(); - - static pai::datamodel::CObjectGenralFactory& GetFatory(); - - void SetConvertorTypeName(QString TypeName) {m_ConvertorTypeName=TypeName;}; - - QString GetConvertorTypeName(){ return m_ConvertorTypeName;} - int m_ColumnCount; - -protected: - - pai::ios::welllog::Well* m_WellInfo; - DiDepthProgress *m_pDepthProgress; - QStringList m_FileHead; - MyWelllogRound* m_WellLogRoundInfo; - QString m_ConvertorTypeName; -}; - -/** -* @brief 成图窗口插件注册宏 -*/ -#define BEGIN_REGISTER_ICONVERTOR(className) BEGIN_REGISTER(sConvertorKey,IConvertor,className) -#define END_REGISTER_ICONVERTOR(className) END_REGISTER( sConvertorKey,IConvertor,className ) - -/** -* @brief 格式转换器插件工厂 -*/ -typedef pai::datamodel::CObjectGenralFactory IConvertorFactory; - -END_OSGGRAPHICS_NAMESPACE -// using namespace pai::graphics; -#endif +/** +* @file IConvertor.h +* @brief 格式解析器抽象类 +* @date 2014-7-29 +* @author: ZhouWenfei +*/ + +#ifndef PAI_FRAME_ICONVERTOR_H__ +#define PAI_FRAME_ICONVERTOR_H__ + +#pragma warning( push ,0) + +#include +#include + +#include "ConvertorExport.h" +#include "ObjectGenralFactory.h" +#include "ObjWell.h" +#include "ObjWelllog.h" +#include "MyWelllogRound.h" +#include "DepthProgress.h" + +#pragma execution_character_set("utf-8") + +#pragma warning( pop ) + +BEGIN_OSGGRAPHICS_NAMESPACE; + +struct CONVERTOR_EXPORT sConvertorKey +{ +public: + + sConvertorKey(); + + sConvertorKey(QUuid ConvertorTypeClassIDTmp,QString strConvertorTypeName); + + bool operator !=( const sConvertorKey& s ); + + bool operator< ( const sConvertorKey& s ) const; + +public: + + QUuid m_ConvertorTypeClassID; // Convertor type ID + QString m_strConvertorTypeName; // Convertor type name +}; + +class CONVERTOR_EXPORT IConvertor +{ + +public: + + IConvertor(); + + virtual ~IConvertor(); + +public: + /** + * 本接口仅供测试模块使用,请勿使用 + */ + virtual bool OnlyForTest(){return false;}; + virtual bool Init() + { + m_WellInfo->Init(); + m_WellLogRoundInfo->Init(); + // memset(&m_WellInfo,0,sizeof(m_WellInfo)); + // memset(&m_WellLogRoundInfo,0,sizeof(m_WellLogRoundInfo)); + return true; + }; + /** + * @brief 文件是否支持这种格式 + * @param[in]filename 文件名 + * @return if true support filename else not + */ + virtual bool IsSupport(const QString &filename) + { + Init(); + return 0; + }; + + + /** + * @brief 该格式解析器支持的文件后缀名 + * @return QVector this convertor support all suffix file + */ + virtual QVectorGetSupportFileExtensions()=0; + virtual void InitFormatSuffixName(); + QString m_thisModuleName; + + /** + * @brief 指定文件的解编出来的文件头内容 + * @param[in]filename 文件名 + * @return QString file content + */ + virtual QString GetFileContent(const QString &filename)=0; + virtual QStringList &GetListHead(){ + return m_FileHead; + }; + virtual void SetListHead(QStringList FileHead){ + m_FileHead=FileHead; + }; + + virtual void SetDepthProgress(DiDepthProgress *pDepthProgress) + { + m_pDepthProgress=pDepthProgress; + } + + /** + * @brief 指定文件的测井曲线的元数据 + * @param[in]filename 文件名 + * @return QVector file contains all welllog curve + */ + //virtual QList GetWellLogList(const QString &filename)=0; + + /** + * @brief 获取井信息 + * @return well + */ + + pai::ios::welllog::Well *GetWellInfo(); + + /** + * @brief 获取井次 + * @return WelllogRound 井次 + */ + MyWelllogRound *GetWellLogRoundInfo(); + + static pai::datamodel::CObjectGenralFactory& GetFatory(); + + void SetConvertorTypeName(QString TypeName) {m_ConvertorTypeName=TypeName;}; + + QString GetConvertorTypeName(){ return m_ConvertorTypeName;} + int m_ColumnCount; + +protected: + + pai::ios::welllog::Well* m_WellInfo; + DiDepthProgress *m_pDepthProgress; + QStringList m_FileHead; + MyWelllogRound* m_WellLogRoundInfo; + QString m_ConvertorTypeName; +}; + +/** +* @brief 成图窗口插件注册宏 +*/ +#define BEGIN_REGISTER_ICONVERTOR(className) BEGIN_REGISTER(sConvertorKey,IConvertor,className) +#define END_REGISTER_ICONVERTOR(className) END_REGISTER( sConvertorKey,IConvertor,className ) + +/** +* @brief 格式转换器插件工厂 +*/ +typedef pai::datamodel::CObjectGenralFactory IConvertorFactory; + +END_OSGGRAPHICS_NAMESPACE +// using namespace pai::graphics; +#endif diff --git a/ConvertorManager/include/ImportdataDialog.h b/ConvertorManager/include/ImportdataDialog.h index e281899..8449ac1 100644 --- a/ConvertorManager/include/ImportdataDialog.h +++ b/ConvertorManager/include/ImportdataDialog.h @@ -1,144 +1,144 @@ -/** -* @file ImportDataDialog.h -* @brief 测井数据导入界面 -* @date 2014-8-8 -* @author: ZhouWenfei -*/ -#ifndef IMPORTDATA_H -#define IMPORTDATA_H -#pragma warning( push ,0) -#include -//#include "ObjectFolder.h" -//#include "ObjProject.h" -#include -#include "ConvertorManager.h" -#include "InterfaceWidget.h" -#include "ConvertorExport.h" - -//#include "ObjWell.h" -//#include "Family.h" - -//#include "ProjectCommand.h" - -#pragma execution_character_set("utf-8") - -#pragma warning( pop ) - -namespace Ui -{ - class ImportData ; -} -BEGIN_OSGGRAPHICS_NAMESPACE; -//用于在表格中解析曲线类型Family -class FamilyDelegate : public QItemDelegate -{ - Q_OBJECT -public: - FamilyDelegate(QObject *parent = 0): QItemDelegate(parent) { } - QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, - const QModelIndex &index) const - { - QComboBox *editor = new QComboBox(parent); - // static std::vector familys;//避免多次从数据库加载 - // if(familys.size()<=0){ - // Family afa; - // afa.GetFamily(familys); - // } - // for(int i=0;iaddItem(QString::fromStdString(familys[i].GetFamilyType())); - // } - return editor; - } - void setEditorData(QWidget *editor, const QModelIndex &index) const - { - QString text = index.model()->data(index, Qt::EditRole).toString(); - QComboBox *comboBox = static_cast(editor); - int tindex = comboBox->findText(text); - comboBox->setCurrentIndex(tindex); - } - void setModelData(QWidget *editor, QAbstractItemModel *model, - const QModelIndex &index) const - { - QComboBox *comboBox = static_cast(editor); - QString text = comboBox->currentText(); - model->setData(index, text, Qt::EditRole); - } - void updateEditorGeometry(QWidget *editor, - const QStyleOptionViewItem &option, const QModelIndex &index) const - { - editor->setGeometry(option.rect); - } - -}; -class CONVERTOR_EXPORT ImportDataDialog : public QDialog -{ - Q_OBJECT - -public: - ImportDataDialog(QWidget *parent = 0,QString wellname="",QString wellroundname=""); - - ~ImportDataDialog(); - QString m_CurrentWellName; - QString m_CurrentWellRoundName; -public: - - /** - * @brief 展示主界面数据 - * @param[in]ConvertorVector 所有转换器 - * @param[in]filePath 文件路径 - */ - void DisplayFileInformationAreaData( const QVectorConvertorVector,const QString filePath); - bool IsHaveSameCurve(int NumLog,vector &OutCurveNo,vector &OutCurve); - void SetProjectname(const QString projectname){m_projectname = projectname;} - int CheckExistCurve(QString outputfilename,int NumLog,vector& OutCurveNo,vector& OutCurve); -private: - - /** - * @brief 选择区数据展示 - * @param[in]pInterface 主界面UI - * @param[in]fileHead 表头 - * @param[in]CurverName 曲线名 - * @param[in]pConvertor 转换器 - */ - void DisplaySelectAreaData( InterfaceWidget *pInterface,const QStringList fileHead, IConvertor *pConvertor); - -private slots: - - /** - * @brief 确定按钮曲线上树信号槽 - */ - virtual void AcceptOK(); - //whp add 2019.10.12 - void SelAll(); - void NotSelAll(); - void ReverseSel(); -private: - -// CObjWell * GetWellBaseName(IConvertor *pConvertor,const std::string strWellName); - - bool SelectAndDeleteWellLog(int row,/* QList&vOSGWellLog,*/InterfaceWidget *pCurrentInterfaceWidget, int ColumnCount,IConvertor *pConvertor);//, CBaseObject *pWellTime); - - void InitWell(InterfaceWidget *pInterfaceWidget,IConvertor*pConvertor); - - void InitWellLogRound(InterfaceWidget *pInterfaceWidget,IConvertor*pConvertor); - - void UpdateWell(InterfaceWidget *pInterfaceWidget,IConvertor *pConvertor); - - void UpdateWellLogRound(InterfaceWidget *pInterfaceWidget,IConvertor *pConvertor); -private: - //内部数据采用slf格式处理,尤其是wave\table类数据,需要自动生成slf文件名 - QString GenerateSlfFileName(InterfaceWidget *pCurrentInterfaceWidget); - QVectorm_vConvertorVector; - std::mapm_TabInterWidget; -// std::map >m_ConvertorWellLog; - Ui::ImportData *m_pImportDataUI; - QString m_FilePath; - bool m_ExistSameWellName; - bool m_ExistSameWellRoundName; - QString m_projectname; -}; - -END_OSGGRAPHICS_NAMESPACE; -using namespace pai::graphics; -#endif // IMPORTDATA_H +/** +* @file ImportDataDialog.h +* @brief 测井数据导入界面 +* @date 2014-8-8 +* @author: ZhouWenfei +*/ +#ifndef IMPORTDATA_H +#define IMPORTDATA_H +#pragma warning( push ,0) +#include +//#include "ObjectFolder.h" +//#include "ObjProject.h" +#include +#include "ConvertorManager.h" +#include "InterfaceWidget.h" +#include "ConvertorExport.h" + +//#include "ObjWell.h" +//#include "Family.h" + +//#include "ProjectCommand.h" + +#pragma execution_character_set("utf-8") + +#pragma warning( pop ) + +namespace Ui +{ + class ImportData ; +} +BEGIN_OSGGRAPHICS_NAMESPACE; +//用于在表格中解析曲线类型Family +class FamilyDelegate : public QItemDelegate +{ + Q_OBJECT +public: + FamilyDelegate(QObject *parent = 0): QItemDelegate(parent) { } + QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, + const QModelIndex &index) const + { + QComboBox *editor = new QComboBox(parent); + // static std::vector familys;//避免多次从数据库加载 + // if(familys.size()<=0){ + // Family afa; + // afa.GetFamily(familys); + // } + // for(int i=0;iaddItem(QString::fromStdString(familys[i].GetFamilyType())); + // } + return editor; + } + void setEditorData(QWidget *editor, const QModelIndex &index) const + { + QString text = index.model()->data(index, Qt::EditRole).toString(); + QComboBox *comboBox = static_cast(editor); + int tindex = comboBox->findText(text); + comboBox->setCurrentIndex(tindex); + } + void setModelData(QWidget *editor, QAbstractItemModel *model, + const QModelIndex &index) const + { + QComboBox *comboBox = static_cast(editor); + QString text = comboBox->currentText(); + model->setData(index, text, Qt::EditRole); + } + void updateEditorGeometry(QWidget *editor, + const QStyleOptionViewItem &option, const QModelIndex &index) const + { + editor->setGeometry(option.rect); + } + +}; +class CONVERTOR_EXPORT ImportDataDialog : public QDialog +{ + Q_OBJECT + +public: + ImportDataDialog(QWidget *parent = 0,QString wellname="",QString wellroundname=""); + + ~ImportDataDialog(); + QString m_CurrentWellName; + QString m_CurrentWellRoundName; +public: + + /** + * @brief 展示主界面数据 + * @param[in]ConvertorVector 所有转换器 + * @param[in]filePath 文件路径 + */ + void DisplayFileInformationAreaData( const QVectorConvertorVector,const QString filePath); + bool IsHaveSameCurve(int NumLog,vector &OutCurveNo,vector &OutCurve); + void SetProjectname(const QString projectname){m_projectname = projectname;} + int CheckExistCurve(QString outputfilename,int NumLog,vector& OutCurveNo,vector& OutCurve); +private: + + /** + * @brief 选择区数据展示 + * @param[in]pInterface 主界面UI + * @param[in]fileHead 表头 + * @param[in]CurverName 曲线名 + * @param[in]pConvertor 转换器 + */ + void DisplaySelectAreaData( InterfaceWidget *pInterface,const QStringList fileHead, IConvertor *pConvertor); + +private slots: + + /** + * @brief 确定按钮曲线上树信号槽 + */ + virtual void AcceptOK(); + //whp add 2019.10.12 + void SelAll(); + void NotSelAll(); + void ReverseSel(); +private: + +// CObjWell * GetWellBaseName(IConvertor *pConvertor,const std::string strWellName); + + bool SelectAndDeleteWellLog(int row,/* QList&vOSGWellLog,*/InterfaceWidget *pCurrentInterfaceWidget, int ColumnCount,IConvertor *pConvertor);//, CBaseObject *pWellTime); + + void InitWell(InterfaceWidget *pInterfaceWidget,IConvertor*pConvertor); + + void InitWellLogRound(InterfaceWidget *pInterfaceWidget,IConvertor*pConvertor); + + void UpdateWell(InterfaceWidget *pInterfaceWidget,IConvertor *pConvertor); + + void UpdateWellLogRound(InterfaceWidget *pInterfaceWidget,IConvertor *pConvertor); +private: + //内部数据采用slf格式处理,尤其是wave\table类数据,需要自动生成slf文件名 + QString GenerateSlfFileName(InterfaceWidget *pCurrentInterfaceWidget); + QVectorm_vConvertorVector; + std::mapm_TabInterWidget; +// std::map >m_ConvertorWellLog; + Ui::ImportData *m_pImportDataUI; + QString m_FilePath; + bool m_ExistSameWellName; + bool m_ExistSameWellRoundName; + QString m_projectname; +}; + +END_OSGGRAPHICS_NAMESPACE; +using namespace pai::graphics; +#endif // IMPORTDATA_H diff --git a/ConvertorManager/include/InterIConvertor.h b/ConvertorManager/include/InterIConvertor.h index 824f2c0..f7b9183 100644 --- a/ConvertorManager/include/InterIConvertor.h +++ b/ConvertorManager/include/InterIConvertor.h @@ -1,187 +1,187 @@ -/** -* @file InterIConvertor.h -* @brief 格式解析器 -* @date 2014-10-10 -* @author: ZhouWenfei -*/ -#ifndef PAI_FRAME_INTERICONVERTOR_H__ -#define PAI_FRAME_INTERICONVERTOR_H__ - -#pragma warning( push ,0) - -#include -#include -#include -#include -#include "CStringType.h" -#include "IConvertor.h" -#include "ConvertorExport.h" -#include "ObjectGenralFactory.h" -//#include "ObjWell.h" -//#include "ObjWelllog.h" -#include "DepthProgress.h" -#include "LogIO.h" - -#pragma warning( pop ) - - - -BEGIN_OSGGRAPHICS_NAMESPACE; - -//曲线关键信息结构体 -struct WellCurve -{ - int Curve_Num; - float Curve_Step; - float Curve_StartDepth; - float Curver_EndDepth; - int Curver_MaxDim; -}; - -class CONVERTOR_EXPORT InterIConvertor:public IConvertor -{ - -public: - - InterIConvertor(); - - virtual ~InterIConvertor(); - - virtual bool Init(); - /** - * @brief 文件是否支持这种格式 - * @param[in]filename 文件名 - * @return if true support filename else not - */ - virtual bool IsSupport(const QString &filename); - virtual QVectorGetSupportFileExtensions(); - /** - * @brief 指定文件的测井曲线的元数据并初始化井和井次信息 - * @param[in]filename 文件名 - * @return QVector file contains all welllog curve - */ - - virtual QList GetWellLogList(const QString &filename); - - /** - * @brief 指定文件的解编出来的文件头内容 - * @param[in]filename 文件名 - * @return QString file content - */ - virtual QString GetFileContent( const QString &filename ); - /** - *本接口是旧接口,请勿使用 - * @brief 读取文件基本信息和文件是否读取成功 - * @param[FileName]FileName 文件名 - * @param[Message]Message 文件头基本信息 - * @param[CurveName]CurveName 各个曲线名 - * @param[_Curve]_Curve 曲线结构体 - * @return int 读取曲线条数 - */ - virtual int ScanLogFile(char *FileName,char *Message,char **CurveName,char **CurveUnit,QList&DimCurvesList){return 0;}; - - /** - *本接口是旧接口,请勿使用 - * @brief 读取文件中曲线的属性值和深度值 - * @param[filename]filename 文件名 - * @param[Depth]Depth 井深度值 - * @param[Property]Property 曲线属性值 - * @param[vMutiDimensionProperty] 多维数据 - * @return bool 读取文件是否正确 - */ - virtual bool Transfer(char *filename,float *&Depth,float **Property){return false;}; - /** - * ScanDiskData 对待转换文件进行扫描,提取测井曲线元数据 - * @param FileName 待转换文件名 - * @param Message 转换中提示信息 - * @param CurveName 文件中所包含的曲线名 - * @param CurveUnit 文件中所包含的曲线单位 - * @return 返回曲线条数,如果文件格式无法识别,返回0或者-1 - */ - virtual int ScanLogFile(char *FileName,char *Message,char **CurveName,char **CurveUnit){return 0;}; - /** - * Tran 对文件中的测井曲线进行读取 - * @param vars 待转换文件名、x、y坐标、输出深度段 以\0分割 - * @param outfile 输出文件名 - * @param OutCurveNo 输出曲线号,-1标定该曲线不输出 - * @param OutCurve 输出曲线名 - * @param strChineseName 输出曲线别名 - * @param strUnit 输出曲线单位 - * @return 是否成功输出 - */ - virtual bool Transfer(char *vars,char *outfile,int *OutCurveNo,char **OutCurve,char **strChineseName,char **strUnit,int dCurveNum){return false;}; - - vector &GetCurveNames() - { - return m_vCurverName; - } - - vector &GetCurveUnits() - { - return m_vCurverUnit; - } - - WellCurve & GetWellCurves() - { - return m_CurveData; - } - char * GetfileMessage() - { - return m_fileMessage; - } -public: - QString m_TableName; - WELL_DYNAMIC_INFO WellDynamicInfo; - Slf_FILE_MESSAGE FILE_MESSAGE; - WELL_STATIC_INFO WellStaticInfo; -//private: - - /** - * @brief 指定文件的测井曲线的所有数据 - * @param[in]strWellLogPath curvefile path - * @param[out]vWellLog file contains all wellog curves - */ -// void GetWellLogObjects( QList &vWellLog, QString strWellLogPath); - - /** - * @brief 指定文件的测井曲线的元数据 - * @param[in]strWellLogPath curvefile path - * @param[out]vWellLog file contains all wellog curves - */ -// void GetWellLogMetas( QList &vWellLog, QString strWellLogPath); - /** - * @brief 初始化井基本信息 - * @param[in]wellInfo - * @param[in]filename - */ - void InitWellInfo(const QString &filename); - - /** - * @brief 初始化井次基本信息 - * @param[in]welllogRoundInfo - */ - void InitWelllogRoundInfo(QString FileName); - -protected: - - static QString GetfilePath(const char *FileName); - vectorm_vCurverName; - vectorm_vCurverUnit;//ww - char *m_fileMessage; - - WellCurve m_CurveData; - - int m_DepthLength; - - QListm_vWellLogCurve; - - //多维曲线 - QListm_DimCurvesList; - //多维曲线保存路径 - QString m_DimCurvefilePath; -}; - -END_OSGGRAPHICS_NAMESPACE -using namespace pai::graphics; - #endif - +/** +* @file InterIConvertor.h +* @brief 格式解析器 +* @date 2014-10-10 +* @author: ZhouWenfei +*/ +#ifndef PAI_FRAME_INTERICONVERTOR_H__ +#define PAI_FRAME_INTERICONVERTOR_H__ + +#pragma warning( push ,0) + +#include +#include +#include +#include +#include "CStringType.h" +#include "IConvertor.h" +#include "ConvertorExport.h" +#include "ObjectGenralFactory.h" +//#include "ObjWell.h" +//#include "ObjWelllog.h" +#include "DepthProgress.h" +#include "LogIO.h" + +#pragma warning( pop ) + + + +BEGIN_OSGGRAPHICS_NAMESPACE; + +//曲线关键信息结构体 +struct WellCurve +{ + int Curve_Num; + float Curve_Step; + float Curve_StartDepth; + float Curver_EndDepth; + int Curver_MaxDim; +}; + +class CONVERTOR_EXPORT InterIConvertor:public IConvertor +{ + +public: + + InterIConvertor(); + + virtual ~InterIConvertor(); + + virtual bool Init(); + /** + * @brief 文件是否支持这种格式 + * @param[in]filename 文件名 + * @return if true support filename else not + */ + virtual bool IsSupport(const QString &filename); + virtual QVectorGetSupportFileExtensions(); + /** + * @brief 指定文件的测井曲线的元数据并初始化井和井次信息 + * @param[in]filename 文件名 + * @return QVector file contains all welllog curve + */ + + virtual QList GetWellLogList(const QString &filename); + + /** + * @brief 指定文件的解编出来的文件头内容 + * @param[in]filename 文件名 + * @return QString file content + */ + virtual QString GetFileContent( const QString &filename ); + /** + *本接口是旧接口,请勿使用 + * @brief 读取文件基本信息和文件是否读取成功 + * @param[FileName]FileName 文件名 + * @param[Message]Message 文件头基本信息 + * @param[CurveName]CurveName 各个曲线名 + * @param[_Curve]_Curve 曲线结构体 + * @return int 读取曲线条数 + */ + virtual int ScanLogFile(char *FileName,char *Message,char **CurveName,char **CurveUnit,QList&DimCurvesList){return 0;}; + + /** + *本接口是旧接口,请勿使用 + * @brief 读取文件中曲线的属性值和深度值 + * @param[filename]filename 文件名 + * @param[Depth]Depth 井深度值 + * @param[Property]Property 曲线属性值 + * @param[vMutiDimensionProperty] 多维数据 + * @return bool 读取文件是否正确 + */ + virtual bool Transfer(char *filename,float *&Depth,float **Property){return false;}; + /** + * ScanDiskData 对待转换文件进行扫描,提取测井曲线元数据 + * @param FileName 待转换文件名 + * @param Message 转换中提示信息 + * @param CurveName 文件中所包含的曲线名 + * @param CurveUnit 文件中所包含的曲线单位 + * @return 返回曲线条数,如果文件格式无法识别,返回0或者-1 + */ + virtual int ScanLogFile(char *FileName,char *Message,char **CurveName,char **CurveUnit){return 0;}; + /** + * Tran 对文件中的测井曲线进行读取 + * @param vars 待转换文件名、x、y坐标、输出深度段 以\0分割 + * @param outfile 输出文件名 + * @param OutCurveNo 输出曲线号,-1标定该曲线不输出 + * @param OutCurve 输出曲线名 + * @param strChineseName 输出曲线别名 + * @param strUnit 输出曲线单位 + * @return 是否成功输出 + */ + virtual bool Transfer(char *vars,char *outfile,int *OutCurveNo,char **OutCurve,char **strChineseName,char **strUnit,int dCurveNum){return false;}; + + vector &GetCurveNames() + { + return m_vCurverName; + } + + vector &GetCurveUnits() + { + return m_vCurverUnit; + } + + WellCurve & GetWellCurves() + { + return m_CurveData; + } + char * GetfileMessage() + { + return m_fileMessage; + } +public: + QString m_TableName; + WELL_DYNAMIC_INFO WellDynamicInfo; + Slf_FILE_MESSAGE FILE_MESSAGE; + WELL_STATIC_INFO WellStaticInfo; +//private: + + /** + * @brief 指定文件的测井曲线的所有数据 + * @param[in]strWellLogPath curvefile path + * @param[out]vWellLog file contains all wellog curves + */ +// void GetWellLogObjects( QList &vWellLog, QString strWellLogPath); + + /** + * @brief 指定文件的测井曲线的元数据 + * @param[in]strWellLogPath curvefile path + * @param[out]vWellLog file contains all wellog curves + */ +// void GetWellLogMetas( QList &vWellLog, QString strWellLogPath); + /** + * @brief 初始化井基本信息 + * @param[in]wellInfo + * @param[in]filename + */ + void InitWellInfo(const QString &filename); + + /** + * @brief 初始化井次基本信息 + * @param[in]welllogRoundInfo + */ + void InitWelllogRoundInfo(QString FileName); + +protected: + + static QString GetfilePath(const char *FileName); + vectorm_vCurverName; + vectorm_vCurverUnit;//ww + char *m_fileMessage; + + WellCurve m_CurveData; + + int m_DepthLength; + + QListm_vWellLogCurve; + + //多维曲线 + QListm_DimCurvesList; + //多维曲线保存路径 + QString m_DimCurvefilePath; +}; + +END_OSGGRAPHICS_NAMESPACE +using namespace pai::graphics; + #endif + diff --git a/ConvertorManager/include/InterfaceWidget.h b/ConvertorManager/include/InterfaceWidget.h index fe0cc01..61d3a25 100644 --- a/ConvertorManager/include/InterfaceWidget.h +++ b/ConvertorManager/include/InterfaceWidget.h @@ -1,135 +1,135 @@ -/** -* @file Interface.h -* @brief convertor interface Qwidget -* @date 2014-8-8 -* @author: ZhouWenfei -*/ -#ifndef INTERFACE_H -#define INTERFACE_H - -#pragma warning( push ,0) -#include -#include -#include -#include -#include -#include -#include -#include "IConvertor.h" -#include -#pragma warning( pop ) - -#pragma execution_character_set("utf-8") - -namespace Ui -{ - class Interface; -} -BEGIN_OSGGRAPHICS_NAMESPACE; - -class InterfaceWidget : public QWidget -{ - Q_OBJECT -public: - friend class ImportDataDialog; - InterfaceWidget(QWidget *parent = 0); - - ~InterfaceWidget(); - -public: - /** - * @brief 返回数据选择区UI - */ - - QTableWidget*GetDataSelectAreaWidget(); - - /** - * @brief 返回LOG曲线基本信息UI - */ - - //QTabWidget*GetLogInformation(); - /** - * @brief 返回数据预览区UI - */ - QTextEdit *GetDataPreviewArea(); - - /** - * @brief 返回确定按钮UI - */ - - QPushButton*GetOK(); - - /** - * @brief 返回取消按钮UI - */ - QPushButton *GetCancel(); - - //井信息 - QLineEdit * GetWellNameLineEdit(); - QLineEdit * GetWellCompanyNameLineEdit(); - QLineEdit * GetWellAreaNameLineEdit(); - QLineEdit * GetWellCodeLineEdit(); - QLineEdit * GetXCodeLineEdit(); - QLineEdit * GetYCodeLineEdit(); - QComboBox * GetWellTypeComboBox(); - QLineEdit * GetAslLineEdit(); - QLineEdit * GetBslLineEdit(); - QDateEdit * GerSDrillDateEdit(); - QDateEdit * GerEDrillDateEdit(); - QDateEdit * GerCompleteDateEdit(); - QLineEdit * GetCWMethodLineEdit(); - QLineEdit * GetBit1ProgLineEdit(); - QLineEdit * GetBit2ProgLineEdit(); - QLineEdit * GetBit3ProgLineEdit(); - QLineEdit * GetBit4ProgLineEdit(); - QLineEdit * GetBit5ProgLineEdit(); - QLineEdit * GetCas1ProgLineEdit(); - QLineEdit * GetCas2ProgLineEdit(); - QLineEdit * GetCas3ProgLineEdit(); - QLineEdit * GetCas4ProgLineEdit(); - QLineEdit * GetCas5ProgLineEdit(); - QLineEdit * GetCas1ShotLineEdit(); - QLineEdit * GetCas2ShotLineEdit(); - QLineEdit * GetSC1SDepLineEdit(); - QLineEdit * GetSC1EDepLineEdit(); - QLineEdit * GetSC2SDepLineEdit(); - QLineEdit * GetSC2EDepLineEdit(); - - //井次信息 - QLineEdit * GetCompanyNameLineEdit(); - QLineEdit * GetTeamLineEdit(); - QLineEdit * GetOperatorLineEdit(); - QDateEdit * GerDateEdit(); - QComboBox * GetSerialComboBox(); - QComboBox * GetItemComboBox(); - QLineEdit * GetProfileLineEdit(); - QComboBox *GetMudTypeComboBox(); - QLineEdit * GetMudViscosityLineEdit(); - QLineEdit * GetWaterLossLineEdit(); - QLineEdit * GetDensityLineEdit(); - QLineEdit * GetResiLineEdit(); - QLineEdit * GetTempLineEdit(); - QLineEdit * GetINTLogLineEdit(); - QLineEdit * GetTempBotLineEdit(); - QLineEdit * GetNITINTLineEdit(); - QLineEdit * GetIntProgLineEdit(); - QLineEdit * GetInteDressLineEdit(); - QLineEdit * GetAuditLineEdit(); - QTextEdit * GetRemarkTextEdit(); - QLineEdit * GetWellRoundNameLineEdit(); - QLineEdit * GetEditBottomDepth(); - QLineEdit * GetEditTopDepth(); - QLineEdit * GetEditFileSDepth(); - QLineEdit * GetEditFileEDepth(); - - IConvertor* m_pConvertor; -protected: - void showEvent(QShowEvent *); -private: - - Ui::Interface *m_pInterfaceUI; -}; -END_OSGGRAPHICS_NAMESPACE; -using namespace pai::graphics; - -#endif // INTERFACE_H +/** +* @file Interface.h +* @brief convertor interface Qwidget +* @date 2014-8-8 +* @author: ZhouWenfei +*/ +#ifndef INTERFACE_H +#define INTERFACE_H + +#pragma warning( push ,0) +#include +#include +#include +#include +#include +#include +#include +#include "IConvertor.h" +#include +#pragma warning( pop ) + +#pragma execution_character_set("utf-8") + +namespace Ui +{ + class Interface; +} +BEGIN_OSGGRAPHICS_NAMESPACE; + +class InterfaceWidget : public QWidget +{ + Q_OBJECT +public: + friend class ImportDataDialog; + InterfaceWidget(QWidget *parent = 0); + + ~InterfaceWidget(); + +public: + /** + * @brief 返回数据选择区UI + */ + + QTableWidget*GetDataSelectAreaWidget(); + + /** + * @brief 返回LOG曲线基本信息UI + */ + + //QTabWidget*GetLogInformation(); + /** + * @brief 返回数据预览区UI + */ + QTextEdit *GetDataPreviewArea(); + + /** + * @brief 返回确定按钮UI + */ + + QPushButton*GetOK(); + + /** + * @brief 返回取消按钮UI + */ + QPushButton *GetCancel(); + + //井信息 + QLineEdit * GetWellNameLineEdit(); + QLineEdit * GetWellCompanyNameLineEdit(); + QLineEdit * GetWellAreaNameLineEdit(); + QLineEdit * GetWellCodeLineEdit(); + QLineEdit * GetXCodeLineEdit(); + QLineEdit * GetYCodeLineEdit(); + QComboBox * GetWellTypeComboBox(); + QLineEdit * GetAslLineEdit(); + QLineEdit * GetBslLineEdit(); + QDateEdit * GerSDrillDateEdit(); + QDateEdit * GerEDrillDateEdit(); + QDateEdit * GerCompleteDateEdit(); + QLineEdit * GetCWMethodLineEdit(); + QLineEdit * GetBit1ProgLineEdit(); + QLineEdit * GetBit2ProgLineEdit(); + QLineEdit * GetBit3ProgLineEdit(); + QLineEdit * GetBit4ProgLineEdit(); + QLineEdit * GetBit5ProgLineEdit(); + QLineEdit * GetCas1ProgLineEdit(); + QLineEdit * GetCas2ProgLineEdit(); + QLineEdit * GetCas3ProgLineEdit(); + QLineEdit * GetCas4ProgLineEdit(); + QLineEdit * GetCas5ProgLineEdit(); + QLineEdit * GetCas1ShotLineEdit(); + QLineEdit * GetCas2ShotLineEdit(); + QLineEdit * GetSC1SDepLineEdit(); + QLineEdit * GetSC1EDepLineEdit(); + QLineEdit * GetSC2SDepLineEdit(); + QLineEdit * GetSC2EDepLineEdit(); + + //井次信息 + QLineEdit * GetCompanyNameLineEdit(); + QLineEdit * GetTeamLineEdit(); + QLineEdit * GetOperatorLineEdit(); + QDateEdit * GerDateEdit(); + QComboBox * GetSerialComboBox(); + QComboBox * GetItemComboBox(); + QLineEdit * GetProfileLineEdit(); + QComboBox *GetMudTypeComboBox(); + QLineEdit * GetMudViscosityLineEdit(); + QLineEdit * GetWaterLossLineEdit(); + QLineEdit * GetDensityLineEdit(); + QLineEdit * GetResiLineEdit(); + QLineEdit * GetTempLineEdit(); + QLineEdit * GetINTLogLineEdit(); + QLineEdit * GetTempBotLineEdit(); + QLineEdit * GetNITINTLineEdit(); + QLineEdit * GetIntProgLineEdit(); + QLineEdit * GetInteDressLineEdit(); + QLineEdit * GetAuditLineEdit(); + QTextEdit * GetRemarkTextEdit(); + QLineEdit * GetWellRoundNameLineEdit(); + QLineEdit * GetEditBottomDepth(); + QLineEdit * GetEditTopDepth(); + QLineEdit * GetEditFileSDepth(); + QLineEdit * GetEditFileEDepth(); + + IConvertor* m_pConvertor; +protected: + void showEvent(QShowEvent *); +private: + + Ui::Interface *m_pInterfaceUI; +}; +END_OSGGRAPHICS_NAMESPACE; +using namespace pai::graphics; + +#endif // INTERFACE_H diff --git a/ConvertorManager/include/WisTableTran.h b/ConvertorManager/include/WisTableTran.h index 0c71719..6eae98d 100644 --- a/ConvertorManager/include/WisTableTran.h +++ b/ConvertorManager/include/WisTableTran.h @@ -1,77 +1,77 @@ -#pragma once -#include "MemRdWt.h" -//#include "BaseFun.h" -#include "geometryutils.h" -#include "ConvertorExport.h" - -#include -#include -#include - -#pragma execution_character_set("utf-8") - -//#include -/*struct INFORMATION -{ - char Name[80]; - int index; -};*/ -//whp add 2020.7.10 for 数据表自动匹配和转换 -/*struct DEFAULTTABLE -{ - QString TableName; - int ZdNum; - Slf_TABLE_FIELD *tinfo; -};*/ -struct DEFAULTTABLE -{ -public: - QString TableName; - QString TableAliasName; - int ZdNum; - Slf_OBJECT_FIELD tinfo[50];//*tinfo; - QString menuinfo[50]; - QString toName[50]; -}; -//whp add 2020.7.10 for 数据表自动匹配和转换 -struct ZdInf -{ - QString OutZd,InZd,ZdType,ZdLen,ZdAlias; -}; -struct TRANTABLEINF -{ - QString OutName,InName,AliasName; - int ZdNum; - ZdInf *tinfo; - //输入字段名列表,如果没有字段运算,应该就是tinfo.InZd集合 - //如果有字段运算(如BTMDEP-THICK,EDEP-SDEP),则需要提取字段名,集合到InNameList中 - QStringList InNameList; -}; -struct OUTINF -{ - char OutName[64];//slf字段名 - int CodeType,CodeLen,Pos; - int CodeType2,CodeLen2,Pos2; - char InName1[64],InName2[64];//wis字段名 - QString Sep; -}; -class CONVERTOR_EXPORT WisTableTran -{ -public: - WisTableTran(); - ~WisTableTran(); - int m_TranNum;//用户定义的需要匹配和转换的表数 - TRANTABLEINF *m_TTI;//m_TranTableInf;//用户定义的需要匹配和转换的表信息 - DEFAULTTABLE *WisDefTable; - DEFAULTTABLE *SlfDefTable; - void GetTTI(TRANTABLEINF &m_TTI,QStringList temp); - DEFAULTTABLE SetTableInf(QString TableName,QString TableHzName,int num,QStringList ZdName,QStringList HzName,QStringList ZdUnit,QStringList ZdType,QStringList ZdLen,QStringList ZdRes,QString*); - bool GetTranTableInf(); - bool HaveTranTable(QString wistype="");//QStringList TableList); - int GetTranTableNo(QString TableName,int fieldNum,Slf_TABLE_FIELD* tableFieldInfo,bool IsS2W); - OUTINF *outinf; - void GetOutInf(int TranTable); - bool ReadDefTable(DEFAULTTABLE *&table,QString table_inf); - //void InitDefauleTable(QString fileName,DEFAULTTABLE *DefauleTable); - void InitDefauleTable(bool isWis); -}; +#pragma once +#include "MemRdWt.h" +//#include "BaseFun.h" +#include "geometryutils.h" +#include "ConvertorExport.h" + +#include +#include +#include + +#pragma execution_character_set("utf-8") + +//#include +/*struct INFORMATION +{ + char Name[80]; + int index; +};*/ +//whp add 2020.7.10 for 数据表自动匹配和转换 +/*struct DEFAULTTABLE +{ + QString TableName; + int ZdNum; + Slf_TABLE_FIELD *tinfo; +};*/ +struct DEFAULTTABLE +{ +public: + QString TableName; + QString TableAliasName; + int ZdNum; + Slf_OBJECT_FIELD tinfo[50];//*tinfo; + QString menuinfo[50]; + QString toName[50]; +}; +//whp add 2020.7.10 for 数据表自动匹配和转换 +struct ZdInf +{ + QString OutZd,InZd,ZdType,ZdLen,ZdAlias; +}; +struct TRANTABLEINF +{ + QString OutName,InName,AliasName; + int ZdNum; + ZdInf *tinfo; + //输入字段名列表,如果没有字段运算,应该就是tinfo.InZd集合 + //如果有字段运算(如BTMDEP-THICK,EDEP-SDEP),则需要提取字段名,集合到InNameList中 + QStringList InNameList; +}; +struct OUTINF +{ + char OutName[64];//slf字段名 + int CodeType,CodeLen,Pos; + int CodeType2,CodeLen2,Pos2; + char InName1[64],InName2[64];//wis字段名 + QString Sep; +}; +class CONVERTOR_EXPORT WisTableTran +{ +public: + WisTableTran(); + ~WisTableTran(); + int m_TranNum;//用户定义的需要匹配和转换的表数 + TRANTABLEINF *m_TTI;//m_TranTableInf;//用户定义的需要匹配和转换的表信息 + DEFAULTTABLE *WisDefTable; + DEFAULTTABLE *SlfDefTable; + void GetTTI(TRANTABLEINF &m_TTI,QStringList temp); + DEFAULTTABLE SetTableInf(QString TableName,QString TableHzName,int num,QStringList ZdName,QStringList HzName,QStringList ZdUnit,QStringList ZdType,QStringList ZdLen,QStringList ZdRes,QString*); + bool GetTranTableInf(); + bool HaveTranTable(QString wistype="");//QStringList TableList); + int GetTranTableNo(QString TableName,int fieldNum,Slf_TABLE_FIELD* tableFieldInfo,bool IsS2W); + OUTINF *outinf; + void GetOutInf(int TranTable); + bool ReadDefTable(DEFAULTTABLE *&table,QString table_inf); + //void InitDefauleTable(QString fileName,DEFAULTTABLE *DefauleTable); + void InitDefauleTable(bool isWis); +}; diff --git a/ConvertorManager/src/CStringType.cpp b/ConvertorManager/src/CStringType.cpp index efbe49f..70913cf 100644 --- a/ConvertorManager/src/CStringType.cpp +++ b/ConvertorManager/src/CStringType.cpp @@ -1,326 +1,326 @@ -#include "CStringType.h" -#include -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(nposStrVector; - int left=0; - for (int i=0;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; -//} +#include "CStringType.h" +#include +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(nposStrVector; + int left=0; + for (int i=0;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; +//} diff --git a/ConvertorManager/src/CStringType.h b/ConvertorManager/src/CStringType.h index 657dda7..bf6b072 100644 --- a/ConvertorManager/src/CStringType.h +++ b/ConvertorManager/src/CStringType.h @@ -1,169 +1,169 @@ -/** -* @file CStringTyle.h -* @brief CString数据自定义、井以及井次结构体 -* @date 2014-10-10 -* @author: ZhouWenfei -*/ - -#ifndef PAI_FRAME_CSTRING_H__ -#define PAI_FRAME_CSTRING_H__ -#pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#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; -typedef unsigned char byte; -typedef bool BOOL; -#endif -typedef unsigned char BYTE; -typedef char* LPSTR; -typedef void* LPVOID; - -class CString; -typedef QList CStringList; - -using namespace std; - - -#pragma execution_character_set("utf-8") - -//#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 - +/** +* @file CStringTyle.h +* @brief CString数据自定义、井以及井次结构体 +* @date 2014-10-10 +* @author: ZhouWenfei +*/ + +#ifndef PAI_FRAME_CSTRING_H__ +#define PAI_FRAME_CSTRING_H__ +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#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; +typedef unsigned char byte; +typedef bool BOOL; +#endif +typedef unsigned char BYTE; +typedef char* LPSTR; +typedef void* LPVOID; + +class CString; +typedef QList CStringList; + +using namespace std; + + +#pragma execution_character_set("utf-8") + +//#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 + diff --git a/ConvertorManager/src/ConvertorManager.cpp b/ConvertorManager/src/ConvertorManager.cpp index 13fe6a6..1c16dab 100644 --- a/ConvertorManager/src/ConvertorManager.cpp +++ b/ConvertorManager/src/ConvertorManager.cpp @@ -1,165 +1,165 @@ -#include "ConvertorManager.h" -//#include "ConsoleOutputWidget.h" -#include -//#include "Geometry.h" -//#include "Log.h" -#include "ObjectGenralFactory.h" -// #include "SLFAsciiConvertor.h" -//void OSGFRAMEWORK_EXPORT AppendConsole(pai::log::Priority priority,const QString &output); -BEGIN_OSGGRAPHICS_NAMESPACE; -//CONST QString FORMAT_NOT_SUPPORT=QObject::tr("该文件编译器不支持,文件格式错误!"); -ConvertorManager::ConvertorManager() -{ - all=0; -} - -ConvertorManager::~ConvertorManager() -{ - qDeleteAll(m_vAllConvertors.begin(),m_vAllConvertors.end()); - m_vAllConvertors.clear(); -} - -void ConvertorManager::LoadAllConvertorPlugin() -{ - // //AppendConsole(pai::log::PAI_INFO,QObject::tr("格式转换模块加载中...")); - m_vConvertorNames=pai::datamodel::LoadAllPlugin("convertor"); - StatisticalAllConvertors(); - // //AppendConsole(pai::log::PAI_INFO,QObject::tr("格式转换模块加载完成")); -} -void ConvertorManager::UnLoadAllConvertorPlugin() -{ - qDeleteAll(m_vAllConvertors.begin(),m_vAllConvertors.end()); - m_vAllConvertors.clear(); -} - -QVector ConvertorManager::GetSupportConvertors( const QString &filename,DiDepthProgress *pDepthProgress) -{ - m_vFileNameSupportConvertor.clear(); - bool isInvalid=IsInvalidString(filename); - if(isInvalid) return m_vFileNameSupportConvertor; - QFileInfo currentfile(filename); - QVector::iterator it=m_vAllConvertors.begin(); - for (;it!=m_vAllConvertors.end();it++) - { - (*it)->Init(); - //第一步判断是否满足后缀过滤的要求 - QVector supportedFileExt=(*it)->GetSupportFileExtensions(); - bool fileExtIsOk=false; - for(int i=0;i-1) { - int flag=0; - QString sx=currentfile.suffix().toUpper(); - QString s1j=s1[j].toUpper(); - if(sx.size()>=s1j.size()) { - for(int n=0;nSetDepthProgress(pDepthProgress); - bool bSupport=(*it)->IsSupport(filename); - (*it)->SetDepthProgress(0); - if (!bSupport) continue ; - m_vFileNameSupportConvertor.push_back(*it); - } - if (m_vFileNameSupportConvertor.isEmpty()&&isInvalid) - { - if(all==0||all==QMessageBox::No||all==QMessageBox::Yes) - { - all=QMessageBox::information(NULL,filename,"没有合适的转换模块!是否强制转换?",QMessageBox::Yes|QMessageBox::No|QMessageBox::NoAll|QMessageBox::YesAll); - } - if(all==QMessageBox::NoAll||all==QMessageBox::No) return m_vFileNameSupportConvertor; - it=m_vAllConvertors.begin(); - for (;it!=m_vAllConvertors.end();it++) - { - //第一步判断是否满足后缀过滤的要求 - bool bSupport=(*it)->IsSupport(filename); - if (!bSupport)continue ; - m_vFileNameSupportConvertor.push_back(*it); - break; - } - if (m_vFileNameSupportConvertor.isEmpty()) { -// AppendConsole(pai::log::PAI_WARN,QObject::tr("该文件解编器不支持,文件格式错误!")); - QMessageBox::about(NULL, QObject::tr("警告"), QObject::tr("该文件解编器不支持,文件格式错误!")); - } - } - return m_vFileNameSupportConvertor; -} - -QVectorConvertorManager::GetSupportFileExtensions() -{ - if(m_vAllSuffixFileName.size()) return m_vAllSuffixFileName; - else { - QVector::iterator itor=m_vAllConvertors.begin(); - int j=0; - for (;itor!=m_vAllConvertors.end();itor++) - { - QVectorvSupportFileExtensionsConvertor=(*itor)->GetSupportFileExtensions(); - for (int i=0;i::iterator itor=std::find(m_vAllSuffixFileName.begin(),m_vAllSuffixFileName.end(),vSupportFileExtensionsConvertor[i]); - if (itor==m_vAllSuffixFileName.end())//没有重复 - { - m_vAllSuffixFileName.push_back(vSupportFileExtensionsConvertor[i]); - } - } - j++; - } - return m_vAllSuffixFileName; - } -} - -QVectorConvertorManager::GetAllConvertors() -{ - return m_vAllConvertors; -} -void ConvertorManager::StatisticalAllConvertors() -{ - m_vAllConvertors.clear(); - std::map&mapConvertorType=IConvertor::GetFatory().m_map; - { - std::map::iterator it=mapConvertorType.begin(); - for (;it!=mapConvertorType.end();++it) - { - IConvertor*pConvertor=IConvertor::GetFatory().CreateObject(it->first); - if(!pConvertor) { - continue ; - } - pConvertor->SetConvertorTypeName(it->first.m_strConvertorTypeName); -// AppendConsole(pai::log::PAI_INFO,("格式转换模块加载完成:"+it->first.m_strConvertorTypeName)); - m_vAllConvertors.push_back(pConvertor); - } - } - // sConvertorKey convertorKey(/*GetSLFAsciiConvertorTypeID()*/"{BB64AD58-A7F7-4AF7-956F-518372C298D2}","SLFAscii Well Log Convertor"); - // CSLFAsciiConvertor* pSLFAConvertor= new CSLFAsciiConvertor(); - // IConvertor* pConvertor= dynamic_cast(pSLFAConvertor); - // if(!pConvertor) { - // return; - // } - // pConvertor->SetConvertorTypeName(convertorKey.m_strConvertorTypeName); - // m_vAllConvertors.push_back(pConvertor); -} -END_OSGGRAPHICS_NAMESPACE; +#include "ConvertorManager.h" +//#include "ConsoleOutputWidget.h" +#include +//#include "Geometry.h" +//#include "Log.h" +#include "ObjectGenralFactory.h" +// #include "SLFAsciiConvertor.h" +//void OSGFRAMEWORK_EXPORT AppendConsole(pai::log::Priority priority,const QString &output); +BEGIN_OSGGRAPHICS_NAMESPACE; +//CONST QString FORMAT_NOT_SUPPORT=QObject::tr("该文件编译器不支持,文件格式错误!"); +ConvertorManager::ConvertorManager() +{ + all=0; +} + +ConvertorManager::~ConvertorManager() +{ + qDeleteAll(m_vAllConvertors.begin(),m_vAllConvertors.end()); + m_vAllConvertors.clear(); +} + +void ConvertorManager::LoadAllConvertorPlugin() +{ + // //AppendConsole(pai::log::PAI_INFO,QObject::tr("格式转换模块加载中...")); + m_vConvertorNames=pai::datamodel::LoadAllPlugin("convertor"); + StatisticalAllConvertors(); + // //AppendConsole(pai::log::PAI_INFO,QObject::tr("格式转换模块加载完成")); +} +void ConvertorManager::UnLoadAllConvertorPlugin() +{ + qDeleteAll(m_vAllConvertors.begin(),m_vAllConvertors.end()); + m_vAllConvertors.clear(); +} + +QVector ConvertorManager::GetSupportConvertors( const QString &filename,DiDepthProgress *pDepthProgress) +{ + m_vFileNameSupportConvertor.clear(); + bool isInvalid=IsInvalidString(filename); + if(isInvalid) return m_vFileNameSupportConvertor; + QFileInfo currentfile(filename); + QVector::iterator it=m_vAllConvertors.begin(); + for (;it!=m_vAllConvertors.end();it++) + { + (*it)->Init(); + //第一步判断是否满足后缀过滤的要求 + QVector supportedFileExt=(*it)->GetSupportFileExtensions(); + bool fileExtIsOk=false; + for(int i=0;i-1) { + int flag=0; + QString sx=currentfile.suffix().toUpper(); + QString s1j=s1[j].toUpper(); + if(sx.size()>=s1j.size()) { + for(int n=0;nSetDepthProgress(pDepthProgress); + bool bSupport=(*it)->IsSupport(filename); + (*it)->SetDepthProgress(0); + if (!bSupport) continue ; + m_vFileNameSupportConvertor.push_back(*it); + } + if (m_vFileNameSupportConvertor.isEmpty()&&isInvalid) + { + if(all==0||all==QMessageBox::No||all==QMessageBox::Yes) + { + all=QMessageBox::information(NULL,filename,"没有合适的转换模块!是否强制转换?",QMessageBox::Yes|QMessageBox::No|QMessageBox::NoAll|QMessageBox::YesAll); + } + if(all==QMessageBox::NoAll||all==QMessageBox::No) return m_vFileNameSupportConvertor; + it=m_vAllConvertors.begin(); + for (;it!=m_vAllConvertors.end();it++) + { + //第一步判断是否满足后缀过滤的要求 + bool bSupport=(*it)->IsSupport(filename); + if (!bSupport)continue ; + m_vFileNameSupportConvertor.push_back(*it); + break; + } + if (m_vFileNameSupportConvertor.isEmpty()) { +// AppendConsole(pai::log::PAI_WARN,QObject::tr("该文件解编器不支持,文件格式错误!")); + QMessageBox::about(NULL, QObject::tr("警告"), QObject::tr("该文件解编器不支持,文件格式错误!")); + } + } + return m_vFileNameSupportConvertor; +} + +QVectorConvertorManager::GetSupportFileExtensions() +{ + if(m_vAllSuffixFileName.size()) return m_vAllSuffixFileName; + else { + QVector::iterator itor=m_vAllConvertors.begin(); + int j=0; + for (;itor!=m_vAllConvertors.end();itor++) + { + QVectorvSupportFileExtensionsConvertor=(*itor)->GetSupportFileExtensions(); + for (int i=0;i::iterator itor=std::find(m_vAllSuffixFileName.begin(),m_vAllSuffixFileName.end(),vSupportFileExtensionsConvertor[i]); + if (itor==m_vAllSuffixFileName.end())//没有重复 + { + m_vAllSuffixFileName.push_back(vSupportFileExtensionsConvertor[i]); + } + } + j++; + } + return m_vAllSuffixFileName; + } +} + +QVectorConvertorManager::GetAllConvertors() +{ + return m_vAllConvertors; +} +void ConvertorManager::StatisticalAllConvertors() +{ + m_vAllConvertors.clear(); + std::map&mapConvertorType=IConvertor::GetFatory().m_map; + { + std::map::iterator it=mapConvertorType.begin(); + for (;it!=mapConvertorType.end();++it) + { + IConvertor*pConvertor=IConvertor::GetFatory().CreateObject(it->first); + if(!pConvertor) { + continue ; + } + pConvertor->SetConvertorTypeName(it->first.m_strConvertorTypeName); +// AppendConsole(pai::log::PAI_INFO,("格式转换模块加载完成:"+it->first.m_strConvertorTypeName)); + m_vAllConvertors.push_back(pConvertor); + } + } + // sConvertorKey convertorKey(/*GetSLFAsciiConvertorTypeID()*/"{BB64AD58-A7F7-4AF7-956F-518372C298D2}","SLFAscii Well Log Convertor"); + // CSLFAsciiConvertor* pSLFAConvertor= new CSLFAsciiConvertor(); + // IConvertor* pConvertor= dynamic_cast(pSLFAConvertor); + // if(!pConvertor) { + // return; + // } + // pConvertor->SetConvertorTypeName(convertorKey.m_strConvertorTypeName); + // m_vAllConvertors.push_back(pConvertor); +} +END_OSGGRAPHICS_NAMESPACE; diff --git a/ConvertorManager/src/ConvertorManager.pro b/ConvertorManager/src/ConvertorManager.pro index 6081ef2..8271288 100644 --- a/ConvertorManager/src/ConvertorManager.pro +++ b/ConvertorManager/src/ConvertorManager.pro @@ -1,97 +1,99 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2024-07-11T18:44:51 -# -#------------------------------------------------- - -QT += core gui widgets - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -TARGET = ConvertorManager -TEMPLATE = lib - -# The following define makes your compiler emit warnings if you use -# any feature of Qt which has been marked as deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS -DEFINES += _WINDOWS -DEFINES += CONVERTOR_LIB -DEFINES += _TIMESPEC_DEFINED - -# You can also make your code fail to compile if you use deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -CONFIG += console \ - # static \ - c++11 \ - shared\ - dll - - -# Default rules for deployment. -qnx: target.path = /tmp/$${TARGET}/bin -else: unix:!android: target.path = /opt/$${TARGET}/bin -!isEmpty(target.path): INSTALLS += target - -CONFIG(debug, debug|release){ - DESTDIR = $$PWD/../../Bin - TARGET = $$join(TARGET,,,d) #为debug版本生成的文件增加d的后缀 -} else { - DESTDIR = $$PWD/../../BinR - TARGET = $$join(TARGET,,,) -} - - -FORMS += \ - importdata.ui \ - importdataDialog.ui \ - interface.ui \ - interfaceWidget.ui \ - tishidialog.ui - -HEADERS += \ - ../../common/geometryutils.h \ - ../include/ConvertorExport.h \ - ../include/ConvertorManager.h \ - ../include/DataImport.h \ - ../include/IConvertor.h \ - ../include/ImportdataDialog.h \ - ../include/InterfaceWidget.h \ - ../include/WisTableTran.h \ - tishidialog.h - -SOURCES += *.cpp \ - ../../common/geometryutils.cpp -INCLUDEPATH += $(OSGHOME)/include \ - ../include \ - ../../OSGParts/include \ - ../../OSGFramework/include \ - ../../OSGWindowShared/include \ - ../../OSGDataModel/include\ - ../../BaseFun/include\ - ./GeneratedFiles - -INCLUDEPATH += ../../common -INCLUDEPATH += ../../Slfio/include -INCLUDEPATH += ../../WellLogUI/include -INCLUDEPATH += ../../BaseFun/include -INCLUDEPATH += ../../Workflow/include -INCLUDEPATH += ../../Workflow/WFCrystal/SysUtility/utils/include -INCLUDEPATH += ../../Workflow/WFEngine/ObjectModel/ObjectModelBase/include -INCLUDEPATH += ../../Workflow/WFEngine/IOService/include - -CONFIG(debug, debug|release){ - LIBS += -L$$PWD/../../Bin -lOSGDataModeld - LIBS += -L$$PWD/../../Bin -lBaseFund - LIBS += -L$$PWD/../../Bin -lslfiod - LIBS += -L$$PWD/../../Bin -lWFEngined -} else { - LIBS += -L$$PWD/../../BinR -lOSGDataModel - LIBS += -L$$PWD/../../BinR -lBaseFun - LIBS += -L$$PWD/../../BinR -lslfio - LIBS += -L$$PWD/../../Bin -lWFEngine -} +#------------------------------------------------- +# +# Project created by QtCreator 2024-07-11T18:44:51 +# +#------------------------------------------------- + +QT += core gui widgets + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = ConvertorManager +TEMPLATE = lib + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which has been marked as deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS +DEFINES += _WINDOWS +DEFINES += CONVERTOR_LIB +DEFINES += _TIMESPEC_DEFINED + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +CONFIG += console \ + # static \ + c++11 \ + shared\ + dll + + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target + +CONFIG(debug, debug|release){ + DESTDIR = $$PWD/../../Bin + TARGET = $$join(TARGET,,,d) #为debug版本生成的文件增加d的后缀 +} else { + DESTDIR = $$PWD/../../BinR + TARGET = $$join(TARGET,,,) +} + + +FORMS += \ + importdata.ui \ + importdataDialog.ui \ + interface.ui \ + interfaceWidget.ui \ + tishidialog.ui + +HEADERS += \ + ../../common/geometryutils.h \ + ../include/ConvertorExport.h \ + ../include/ConvertorManager.h \ + ../include/DataImport.h \ + ../include/IConvertor.h \ + ../include/ImportdataDialog.h \ + ../include/InterfaceWidget.h \ + ../include/WisTableTran.h \ + tishidialog.h + +SOURCES += *.cpp \ + ../../common/geometryutils.cpp +INCLUDEPATH += $(OSGHOME)/include \ + ../include \ + ../../OSGParts/include \ + ../../OSGFramework/include \ + ../../OSGWindowShared/include \ + ../../OSGDataModel/include\ + ../../BaseFun/include\ + ./GeneratedFiles + +INCLUDEPATH += ../../common +INCLUDEPATH += ../../Slfio/include +INCLUDEPATH += ../../WellLogUI/include +INCLUDEPATH += ../../BaseFun/include +win32 { + INCLUDEPATH += ../../Workflow/include +} +INCLUDEPATH += ../../Workflow/WFCrystal/SysUtility/utils/include +INCLUDEPATH += ../../Workflow/WFEngine/ObjectModel/ObjectModelBase/include +INCLUDEPATH += ../../Workflow/WFEngine/IOService/include + +CONFIG(debug, debug|release){ + LIBS += -L$$PWD/../../Bin -lOSGDataModeld + LIBS += -L$$PWD/../../Bin -lBaseFund + LIBS += -L$$PWD/../../Bin -lslfiod + LIBS += -L$$PWD/../../Bin -lWFEngined +} else { + LIBS += -L$$PWD/../../BinR -lOSGDataModel + LIBS += -L$$PWD/../../BinR -lBaseFun + LIBS += -L$$PWD/../../BinR -lslfio + LIBS += -L$$PWD/../../Bin -lWFEngine +} diff --git a/ConvertorManager/src/ConvertorManager.pro.user b/ConvertorManager/src/ConvertorManager.pro.user new file mode 100644 index 0000000..11bf2d3 --- /dev/null +++ b/ConvertorManager/src/ConvertorManager.pro.user @@ -0,0 +1,227 @@ + + + + + + EnvironmentId + {b6aced14-228a-4a04-b357-4d18ec1a3aad} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + true + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 0 + 80 + true + true + 1 + 0 + false + true + false + 2 + true + true + 0 + 8 + true + false + 1 + true + true + true + *.md, *.MD, Makefile + false + true + true + + + + ProjectExplorer.Project.PluginSettings + + + true + false + true + true + true + true + + false + + + 0 + true + + true + true + Builtin.DefaultTidyAndClazy + 10 + true + + + + true + + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop Qt 5.13.0 MSVC2017 64bit + Desktop Qt 5.13.0 MSVC2017 64bit + {b0d37dc0-4759-4799-8369-0bb44b3e17ec} + 1 + 0 + 0 + + 0 + E:\ALogplus\logplus\build\ConvertorManager_Qt_5_13_0_msvc2017_64-Debug + E:/ALogplus/logplus/build/ConvertorManager_Qt_5_13_0_msvc2017_64-Debug + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + 构建 + 构建 + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + 清除 + 清除 + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + E:\ALogplus\logplus\build\ConvertorManager_Qt_5_13_0_msvc2017_64-Release + E:/ALogplus/logplus/build/ConvertorManager_Qt_5_13_0_msvc2017_64-Release + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + 构建 + 构建 + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + 清除 + 清除 + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + + 2 + + + 0 + 部署 + 部署 + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + 0 + true + + 2 + + false + -e cpu-cycles --call-graph "dwarf,4096" -F 250 + + ProjectExplorer.CustomExecutableRunConfiguration + + false + true + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/ConvertorManager/src/DataImport.cpp b/ConvertorManager/src/DataImport.cpp index 950a02b..a17d30d 100644 --- a/ConvertorManager/src/DataImport.cpp +++ b/ConvertorManager/src/DataImport.cpp @@ -1,2101 +1,2101 @@ -/////////////////////// -/// -/// wangwei change part:ImportWellTrajectorys() for add read wis、slf,table、dev - -#pragma warning( push ,0) -#include -#include -#include -#include -// #include "BaseFun.h" -#include -#include "MemRdWt.h" -#include -// #include "ObjGeoLayerData.h" -#include "DepthProgress.h" -#include -// #include "ObjectEvent.h" -// #include "VecSceneManager.h" -#include "ConvertorManager.h" -// #include "ObjDiscreteWellLog.h" -#include "DataImport.h" - -#include "geometryutils.h" -// #include "CoreImageConfigDialog.h" -#include "ObjWell.h" -#include "ObjWelllog.h" -// #include "ObjWellTrajectory.h" -// #include "ObjBitmap.h" -// #include "ObjCrossplot.h" -// #include "VecDisplayObjectCommand.h" -// #include "ObjProject.h" -#include "ConvertorManager.h" -#include "IConvertor.h" -#include "ImportdataDialog.h" -// #include "ObjWellLogTrack.h" -#include "ObjWelllogRound.h" -// #include "ObjWellTrack.h" -// #include "ConsoleOutputWidget.h" - -// #include "ObjGeostratums.h" -#include "ObjWelllogWavefile.h" -// #include "ObjWelllogBIN.h" -#include "ObjWelllogINP.h" -// #include "ObjWelllogFMT.h" -// #include "ObjWelllogTDT.h" -#include "ObjWelllogTABLE.h" -#include "InterIConvertor.h" -#include //2020.2.20 whp add -// #include "DataTree.h" -// #include "VecWindowCommand.h" -// #include "cdialog.h"//whp add 2020.3.17 -#include "tishidialog.h" -// #include "Log.h" - -#pragma warning( pop ) -// void OSGFRAMEWORK_EXPORT AppendConsole(pai::log::Priority priority,const QString &output); - -// BEGIN_OSGGRAPHICS_NAMESPACE; -QString CDataImport::m_prjname; -int CDataImport::flag1=-1; -int CDataImport::m_flag=-1; -int CDataImport::flag_check=0; -bool CDataImport::m_bImportByFolder = false; - -void CreateWellFile(CLogIO *logio,Slf_FILE_MESSAGE &mssage,QString wellFile,CObjWell *pWell) -{ - if(logio) { - CLogIO * logiowell=new CLogIO(); - Slf_FILE_MESSAGE ms=mssage; - strcpy(ms.Item,"井基本信息"); - logiowell->Open(wellFile.toStdString().c_str(),CSlfIO::modeWrite); - logiowell->SetFileMessage(ms); - QStringList azims=GetSimilarCurves("AZIM"); - int iAZIM=-1; - QString AZIM; - foreach(QString cname,azims) - { - iAZIM=logio->FindObjectName((char *)cname.toStdString().c_str()); - if(iAZIM>-1) { - AZIM=cname; - break; - } - } - int iDev=-1; - QStringList devis=GetSimilarCurves("DEVI"); - QString DEV; - foreach(QString cname,devis) - { - iDev=logio->FindObjectName((char *)cname.toStdString().c_str()); - if(iDev>-1) { - DEV=cname; - break; - } - } -// if(logio->FindObjectIndex("井基本信息")>-1) { -// logiowell->CopyFromFile((CSlfIO &)(*logio),"井基本信息"); -// } - if(iAZIM>-1)logiowell->CopyFromFile((CSlfIO &)(*logio),(char *)AZIM.toStdString().c_str()); - if(iDev>-1)logiowell->CopyFromFile((CSlfIO &)(*logio),(char *)DEV.toStdString().c_str()); - delete logiowell; - if(iDev>-1&&iAZIM>-1) { - pWell->ComputeTrajectory(pWell,wellFile); - } - } -} -// CObjWell * CDataImport::GetWellByName( QString strWellName ) -// { -// //得到或创建well -// CObjWell *pWell = NULL; -// if( GetProject() ) -// { -// PaiObject *pP=GetProject()->GetObjectByName( strWellName,GetClassID_Well()); -// pWell = dynamic_cast(pP); -// } - -// if( !pWell ) -// { -// pWell = new CObjWell(); -// pWell->SetName( strWellName ); -// if( GetProject() ) -// { -// GetProject()->GetWellsFolder(true)->AddChild( pWell ); -// } -// } -// return pWell; -// } - -// void CDataImport::AddWellNode(CVecSceneManager *pSceneManager,CObjWell *pWell,CObjWell *pWellInsertPos ) -// { -// if( !pWell ) return; -// QUuid ID = pWellInsertPos ? pWellInsertPos->GetID(): QUuid(); -// pSceneManager->AddObject( pWell,&ID ); - -// QListlistChild; -// pWell->GetChildren( listChild); -// for( long i = 0 ; i < listChild.size();++i ) -// { -// AddWellLogNode( pSceneManager,dynamic_cast( listChild[i] ),NULL ); -// } -// } - -// void CDataImport::AddWellLogNode(CVecSceneManager * pSceneManager,CObjWellLog *pWellLog,CObjWellLog *pWellLogInsertPos ) -// { -// QUuid ID = pWellLogInsertPos ? pWellLogInsertPos->GetID() : QUuid(); -// pSceneManager->AddObject( pWellLog,&ID ); -// } -int CDataImport::chakan(QList &wells,QString path,QStringList &wellfs,int &num,bool GetNum,DiDepthProgress *DepthProgress,char *pSuffix) -{ - QDir dir(path); - foreach(QFileInfo mfi ,dir.entryInfoList()) - { - if(mfi.isFile()) - { - if(pSuffix) { - if(mfi.fileName().lastIndexOf(pSuffix,-1,Qt::CaseInsensitive)==-1) continue; - } - else { - if(mfi.fileName().endsWith(".well",Qt::CaseInsensitive)) continue; - } - num++; - if(IsInvalidString(mfi.fileName())) { - wellfs.append(mfi.absoluteFilePath()); - continue; - } - if(GetNum) continue; - QString aa= mfi.completeBaseName()+"导入中"; - DepthProgress->SetShowName(aa.toStdString().c_str(),0); - DepthProgress->SetDepth(num,0); - CObjWell *pWell=ChangetoSlf(mfi.absoluteFilePath(),DepthProgress); - if(!pSuffix) { - if(pWell) wells.push_back(pWell); - else wellfs.append(mfi.absoluteFilePath()); - } - }else - { - if(mfi.fileName()=="." || mfi.fileName() == "..")continue; - chakan(wells,mfi.absoluteFilePath(),wellfs,num,GetNum,DepthProgress,pSuffix); - } - } - return num; -} -QList CDataImport::ImportWellTrajectorys(bool IsDir) -{ - CDataImport::flag_check=0; - CDataImport::flag1=-1; - CDataImport::m_flag=-1; - QList wells; - QString path; - if(IsDir) - { - static QString path1=::GetDataPath(); - path1=QFileDialog::getExistingDirectory(NULL,"选择目录",path1,QFileDialog::ShowDirsOnly); - if(path1.isEmpty()) return wells; - path=path1; - } - else { - // ConvertorManager::GetInstance().LoadAllConvertorPlugin(); - ConvertorManager &pManager=ConvertorManager::GetInstance(); - pManager.all=0; - QVectorvSuffix=pManager.GetSupportFileExtensions(); - QString fileSuffix("数据文件("); - for (int i=0;iGetObjectByType(GetClassID_WellsFolder()); - // if(pObj) { - // CBaseObject * pBaseObject = dynamic_cast(pObj); - // if(pBaseObject) { - // CDataTree *pDatatree=(CDataTree *)::GetProject()->m_pDataTree; - // if(pDatatree) { - // QTreeWidgetItem* pItem=pDatatree->GetTreeItem(pBaseObject); - // pDatatree->ClickObjectCommand(pItem); - // } - // pBaseObject->SetCheckState(Qt::Checked); - // CVecWindow *pWindow=CVecWindowCommand::GetCurrentWindow(); - // CVecDisplayObjectCommand::ClickObjectCommand( pBaseObject->GetPaiObject(),pWindow); - // } - // } - // } - QStringList lpsFile; - if(wellfs.size()) - { - for(int nIndex =0;nIndexsetMessage("成功导入"+QString::number(wells.size())+"个井次文件,"+QString::number(wellfs.size())+"个文件无法识别:\r\n"+wellfs.join("\r\n")); - // m_dialog->setTitle("提示"); - // m_dialog->exec(); - // delete m_dialog; - } - else { - // AfxMessageBox(QString::number(num)+"个文件全部导入成功!"); - QMessageBox::information(NULL, "提示",QString::number(num)+"个文件全部导入成功!"); - } - QList wells1; - return wells1; -} -QList CDataImport::ImportWells(QString path,QStringList &wellfs,int *pNum,bool IsTran) -{ - char szTemp[64]; - strcpy(szTemp, ".well"); - ImportWells(path,wellfs,szTemp,NULL,IsTran); - wellfs.clear(); - return ImportWells(path,wellfs,(char*)NULL,pNum,IsTran); -} -QString GetWellFileFromDir(QString path,QString &WellName,char *pSuffix) -{ - QDir dir(path); - foreach(QFileInfo mfi ,dir.entryInfoList()) - { - if(mfi.isFile()) - { - QString tem=mfi.absoluteFilePath(); - if(tem.endsWith(pSuffix,Qt::CaseInsensitive)) { - CLogIO tf; - if(tf.Open(tem.toStdString().c_str(),CSlfIO::OpenFlags::modeRead)) { - Slf_FILE_MESSAGE mess; - tf.GetFileMessage(mess); - WellName=mess.WellName; - return tem; - } - } - } - else - { - if(mfi.fileName()=="." || mfi.fileName() == "..")continue; - QString tt=GetWellFileFromDir(mfi.absoluteFilePath(),WellName,pSuffix); - if(tt.isEmpty()) return tt; - } - } - return ""; -} -QString GetWellFileFromCurrentDir(QString path,QString WellName,char *pSuffix) -{ - QDir dir(path); - foreach(QFileInfo mfi ,dir.entryInfoList()) - { - if(mfi.isFile()) - { - QString tem=mfi.absoluteFilePath(); - if(tem.endsWith(pSuffix,Qt::CaseInsensitive)) { - return tem; - } - } - else - { - if(mfi.fileName()=="." || mfi.fileName() == "..")continue; - QString tt=GetWellFileFromCurrentDir(mfi.absoluteFilePath(),WellName,pSuffix); - if(tt.isEmpty()) return tt; - } - } - return ""; -} -QList CDataImport::ImportWells(QString path,QStringList &wellfs,char *pSuffix,int *pNum,bool IsTran) -{ -////////////////////////// -// FIRST is dir - QList wells; - if(path.isEmpty()) return wells; - int num=0; - QStringList listFiles; - QFileInfo mfi(path); - if(!mfi.isDir()) { - if(!mfi.isFile()) return wells; - listFiles.append(path); - if(pSuffix) { - CObjWell *pWell=NULL; - foreach(QString filename,listFiles) - { - QString WellName; - if(filename.endsWith(".slf",Qt::CaseInsensitive)) - { - QString wellname1,path1; - GetWellNameAndPath(filename,wellname1,path1); - QString path2=GetLogdataPath(); - if(path1.indexOf(path2)<0) { - int a=1; - } - CLogIO tem; - if(tem.Open(filename.toStdString().c_str(),CSlfIO::OpenFlags::modeRead)){ - Slf_FILE_MESSAGE mess; - tem.GetFileMessage(mess); - WellName=mess.WellName; - } - } - if(WellName.isEmpty()) continue; - QString wellname,path1; - GetWellNameAndPath(filename,wellname,path1); - QString stem=path1+"\\"; - stem+=wellname; - stem+=pSuffix; - QDir ft(stem); - if(ft.exists()) { - pWell=ChangetoSlf(stem,NULL,IsTran); - continue; - } - path1=GetWellFileFromDir(filename,WellName,pSuffix); - if(path1.isEmpty()) continue; - pWell=ChangetoSlf(path1,NULL,IsTran); - } - return wells; - } - num=listFiles.size(); - } - else { - QString fileSuffix("数据文件("); - ConvertorManager &pManager=ConvertorManager::GetInstance(); - pManager.all=0; - if(pSuffix) { - QString sSuffix="*."; - sSuffix+=pSuffix; - fileSuffix.append(sSuffix); - } - else { - // ConvertorManager::GetInstance().LoadAllConvertorPlugin(); - QVectorvSuffix=pManager.GetSupportFileExtensions(); - for (int i=0;i=0) - { - listFiles.append(absolute_file_path); - } - else { - if(!pSuffix)wellfs.append(absolute_file_path); - } - } - } - if(listFiles.size()<1) return wells; - num=chakan(wells,path,wellfs,num,true,NULL,pSuffix); - if(num<1) return wells; - } - DiDepthProgress DepthProgress; - int progress=0; - QString sname="批量加载数据...";// - if(pSuffix) sname="遍历工区井.."; - DepthProgress.CreatProgress(0,num,sname.toStdString().c_str()); - foreach( QString wellFile,listFiles ) - { - QFileInfo w(wellFile); - if(w.isDir()) { - chakan(wells,wellFile,wellfs,progress,0,&DepthProgress,pSuffix); - } - else { - sname=w.completeBaseName()+"数据导入中"; - DepthProgress.SetShowName(sname.toStdString().c_str(),0); - DepthProgress.SetDepth(progress++,0); - // QString strCh(wellFile); // 汉字路径转换 - CObjWell *pWell=ChangetoSlf(wellFile/*strCh.toLocal8Bit()*/,&DepthProgress,IsTran); - if(!pSuffix) { - if(pWell) { - wells.push_back(pWell); - } - else wellfs.append(wellFile); - } - } - } - DepthProgress.DelProgress(); - if(pNum) *pNum=num; - return wells; -} -void CDataImport::LoadLayers(QStringList &listFiles) -{ - // CObjProject *pProj=::GetProject(); - // if(!pProj) return; - // if(!listFiles.size()) - // { - // QString path=GetLogdataPath();//GetProjectFolder() - // if(pProj) path=path+pProj->GetName(); - // QDir dir(path); - // if(!dir.exists()) - // { - // return; - // } - // dir.setFilter(QDir::NoDotAndDotDot |QDir::Files | QDir::NoSymLinks); - // QFileInfoList list = dir.entryInfoList(); - - // int file_count = list.count(); - // if(file_count <= 0) - // { - // return; - // } - // QStringList fileSuffix; - // fileSuffix.append("Layer"); - // QStringList string_list; - // listFiles.clear(); - // for(int i=0; i=0) - // { - // QString absolute_file_path = file_info.absoluteFilePath(); - // listFiles.append(absolute_file_path); - // } - // } - // } - // CBaseObject *pOSGObject =pProj->GetFolderObjectByClassID(GetClassID_GeoModelFolder(),true); - // PaiObject * pParentObject= pOSGObject->GetPaiObject(); - // QListlists; - // pParentObject->GetChildren(lists); - // for(int i=0;i(lists[i]); - // pParentObject->RemoveChild(pGeoLayerObj,true); - // } - // foreach( QString wellFile,listFiles ) { - // CObjGeoLayerData * pGeoLayerObj=new CObjGeoLayerData; - // QString sectionName,path0; - // GetWellNameAndPath(wellFile,sectionName,path0); - // if(!sectionName.isEmpty())pGeoLayerObj->SetName(sectionName); - // else pGeoLayerObj->SetName(wellFile); - // pParentObject->AddChild(pGeoLayerObj); - // } -} -void CDataImport::ImporttoTree(QString slfFileName,CLogIO *logio1,CObjWell *pWell,CObjWelllogRound* pWelllogRound,char *curvename) -{ -// // if(!pWelllogRound) return; -// CLogIO *logio=logio1; -// if(!logio) { -// logio=new CLogIO(); -// if(!logio->Open(slfFileName.toStdString().c_str(),CSlfIO::modeRead)) -// { -// delete logio; -// AppendConsole(pai::log::PAI_ERROR,"SLF文件打开失败,请检查!"); -// return; -// } -// } -// int i=logio->FindObjectName(curvename); -// if(i<0) { -// if(!logio1){ -// delete logio; -// } -// return; -// } - -// char aliasname[65]; -// aliasname[64]='\0'; -// logio->GetObjectName(i,curvename,NULL,aliasname); -// CObjWellLog * acurve; -// if(pWelllogRound) acurve=dynamic_cast(pWelllogRound->GetObjectByName(curvename)); -// else acurve=dynamic_cast(pWell->GetObjectByName(curvename)); -// if(dynamic_cast(acurve)) acurve=NULL; -// short curvetype=logio->GetObjectType(i); -// short Attribute=0,SubAttribute=0; -// logio->GetObjectAttribute(i,&Attribute,&SubAttribute); - -// if(acurve) { -// PaiObject *pP=acurve->GetParent(); -// if(dynamic_cast(pP)|| -// dynamic_cast(pP) -// ) acurve=NULL; -// else{ -// CDataTree *pTree=dynamic_cast(::GetProject()->m_pDataTree); -// if(pTree&&pTree->GetTreeItem(acurve)) -// { -// if(!logio1){ -// delete logio; -// } -// return; -// } -// } -// } - - -// PaiObject*pPai=NULL; -// if(curvetype==CURVE_OBJECT) -// { -// Slf_CURVE acurveinfo; -// logio->GetCurveInfo(i,&acurveinfo); -// int curveindex=logio->OpenCurve(curvename); -// if(curveindex<0) -// { -// if(!logio1){ -// delete logio; -// } -// return; -// } -// CObjWellLog * acurve=NULL; -// QStringList cnames=GetSimilarCurves("Trajectory"); -// if(!pWelllogRound&&cnames.contains(curvename)) { -// acurve=(CObjWellLog *) new CObjWellTrajectory(); -// } -// else { -// acurve=new CObjWellLog(); -// acurve->acurveinfo=acurveinfo; -// } -// acurve->m_ObjectType=CURVE_OBJECT; -// acurve->SetSlfFileName(slfFileName); -// acurve->SetName(QString::fromStdString(curvename)); -// acurve->SetAliasName(QString::fromStdString(aliasname)); -// acurve->SetUnit(QString::fromStdString(acurveinfo.Unit)); -// acurve->SetAliasUnit(QString::fromStdString(acurveinfo.AliasUnit)); -// acurve->SetDepthUnit(QString::fromStdString(acurveinfo.DepthUnit)); -// acurve->SetDepthAliasUnit(QString::fromStdString(acurveinfo.DepthHZUnit)); -// acurve->SetpropertyMin(acurveinfo.MinValue); -// acurve->SetpropertyMax(acurveinfo.MaxValue); -// acurve->SetRlev(acurveinfo.DepLevel); -// acurve->SetTopDepth(acurveinfo.StartDepth); -// acurve->SetBottomDepth(acurveinfo.EndDepth); -// acurve->GetLogCurve().SetCurveAlias(acurveinfo.AliasName); -// acurve->GetLogCurve().SetUnit(acurveinfo.Unit); -// acurve->GetLogCurve().SetSampleInterval(acurveinfo.DepLevel); -// acurve->AutoMatchFamily(); -// if(pWelllogRound)pWelllogRound->AddChild(acurve); -// else pWell->AddChild(acurve); -// pPai=acurve; -// } -// else if(curvetype==WAVE_OBJECT) -// { -// Slf_WAVE acurveinfo; -// logio->GetWaveInfo(i,&acurveinfo); -// CObjWellLog * acurve=new CObjWellLogWavefile(); -// acurve->m_ObjectType=WAVE_OBJECT; -// acurve->SetName(QString::fromStdString(curvename)); -// acurve->SetAliasName(QString::fromStdString(aliasname)); -// acurve->SetUnit(QString::fromStdString(acurveinfo.Unit)); -// acurve->SetAliasUnit(QString::fromStdString(acurveinfo.AliasUnit)); -// acurve->SetDepthUnit(QString::fromStdString(acurveinfo.DepthUnit)); -// acurve->SetDepthAliasUnit(QString::fromStdString(acurveinfo.DepthHZUnit)); -// acurve->SetSlfFileName(slfFileName); -// acurve->SetTopDepth(acurveinfo.StartDepth); -// acurve->SetBottomDepth(acurveinfo.EndDepth); -// acurve->SetRlev(acurveinfo.DepLevel); -// acurve->GetLogCurve().SetSampleInterval(acurveinfo.DepLevel); -// if(pWelllogRound)pWelllogRound->AddChild(acurve); -// else pWell->AddChild(acurve); -// pPai=acurve; -// } -// else if(curvetype==CARD_OBJECT) -// { -// if(SubAttribute==PARA_OBJECT) { -// CObjWellLog * acurve=new CObjWellLogINP(); -// acurve->m_ObjectType=CARD_OBJECT; -// acurve->SetName(QString::fromStdString(curvename)); -// acurve->SetAliasName(QString::fromStdString(aliasname)); -// acurve->SetSlfFileName(slfFileName); -// if(pWelllogRound)pWelllogRound->AddChild(acurve); -// else pWell->AddChild(acurve); -// } -// else { -// CObjWellLog * acurve=new CObjWellLogBIN(); -// acurve->m_ObjectType=CARD_OBJECT; -// acurve->SetName(QString::fromStdString(curvename)); -// acurve->SetAliasName(QString::fromStdString(aliasname)); -// acurve->SetSlfFileName(slfFileName); -// if(pWelllogRound)pWelllogRound->AddChild(acurve); -// else pWell->AddChild(acurve); -// } -// pPai=acurve; -// } -// else if(curvetype==FMT_OBJECT) -// { -// CObjWellLog * acurve=new CObjWellLogFMT(); -// acurve->m_ObjectType=FMT_OBJECT; -// acurve->SetName(QString::fromStdString(curvename)); -// acurve->SetAliasName(QString::fromStdString(aliasname)); -// acurve->SetSlfFileName(slfFileName); -// if(pWelllogRound)pWelllogRound->AddChild(acurve); -// else pWell->AddChild(acurve); -// pPai=acurve; -// } -// else if(curvetype==TDT_OBJECT) -// { -// CObjWellLog * acurve=new CObjWellLogTDT(); -// acurve->m_ObjectType=TDT_OBJECT; -// acurve->SetName(QString::fromStdString(curvename)); -// acurve->SetAliasName(QString::fromStdString(aliasname)); -// acurve->SetSlfFileName(slfFileName); -// if(pWelllogRound)pWelllogRound->AddChild(acurve); -// else pWell->AddChild(acurve); -// pPai=acurve; -// } -// else if(curvetype>CARD_OBJECT||curvetype==0) -// { -// if(pWelllogRound&&strcmp(curvename,"井基本信息")==0) return; -// CObjWellLog * acurve=new CObjWellLogTABLE(); -// acurve->m_ObjectType=TABLEE_OBJECT; -// acurve->SetName(QString::fromStdString(curvename)); -// acurve->SetAliasName(QString::fromStdString(aliasname)); -// acurve->SetSlfFileName(slfFileName); -// if(pWelllogRound)pWelllogRound->AddChild(acurve); -// else pWell->AddChild(acurve); -// pPai=acurve; -// } -// CObjWellLog *pLog=dynamic_cast(pPai); -// if(pLog) pLog->SetWell(pWell); -// if(!logio1){ -// delete logio; -// } -// return; -} -CObjWell *CDataImport::ChangetoSlf(QString wellFile1,DiDepthProgress *pDepthProgress) -{ - return ChangetoSlf(wellFile1,pDepthProgress,true); -} -CObjWell *CDataImport::ChangetoSlf(QString wellFile1,DiDepthProgress *pDepthProgress,bool IsTran) -{ - static QString temp = ::GetConfPath()+"data.ini"; - QSettings settings(temp,QSettings::IniFormat,0); - settings.setIniCodec(QTextCodec::codecForName("UTF-8")); - QStringList serials=settings.value("wellType",0).toStringList(); - CObjWell *pWell(NULL); - if(pDepthProgress) pDepthProgress->DelProgress(1); - - QString filename=wellFile1; - QString slffilename=filename; - -/////////////////// -//识别是否为系统格式,否则启动转换模块转换为系统格式 - if(!filename.endsWith(".slf",Qt::CaseInsensitive)&& - !filename.endsWith(".well",Qt::CaseInsensitive)&&IsTran) - { - QString logdata=GetLogdataPath()+m_prjname/*::GetProject()->GetName()*/; - logdata.replace('\\','/'); - logdata.replace("//","/"); - filename.replace("//","/"); - filename.replace("\\","/"); - if(filename.indexOf(logdata,0,Qt::CaseInsensitive)>-1) return pWell; - ConvertorManager &pManager=ConvertorManager::GetInstance(); - //按目录加载原始数据时解编入口 - // QString strCh(filename); // 汉字路径转换 - QString slfName=ConvertorWellLogFiles(pManager,filename/*strCh.toLocal8Bit().data()*/,pDepthProgress); - if(slfName!=""&&slfName!="abandoned"){//2020.3.19 放弃加载的文件名如何加入到提示中 - pWell=ChangetoSlf(slfName,pDepthProgress);//whp add 2019.12.12 - } - return pWell; - } - else { - QString wellname1,path1; - // QString strCh(filename); // 汉字路径转换 - GetWellNameAndPath(filename/*strCh.toLocal8Bit().data()*/,wellname1,path1); - QString prjname = m_prjname; - // if(GetProject()) prjname=GetProject()->GetName(); - QString path2="LogData\\"+prjname; - QString path3="LogData/"+prjname; - path1=path1.replace("\\\\","\\"); - path1=path1.replace("//","/"); - int a=path1.indexOf(path2,0,Qt::CaseInsensitive); - int b=path1.indexOf(path3,0,Qt::CaseInsensitive); - if(a<0&&b<0) { - QFile dd; - path2=GetLogdataPath(); - path2+=prjname+"\\#"+wellname1; - CreateDir((char *)path2.toStdString().c_str()); - path2+="\\"+wellname1+".slf"; - dd.copy(filename,path2); - slffilename=path2; - filename=path2; - } - - int iX=-1,iY=-1,iZ=-1; - CObjWelllogRound* pWelllogRound=NULL; - ///从文件内部读取井名 - CLogIO * logio=new CLogIO(); - if(!logio->Open(slffilename.toStdString().c_str(),CSlfIO::modeRead)) - { - delete logio; - QString aa=slffilename+"文件打开失败,请检查!"; - // AppendConsole(pai::log::PAI_ERROR,aa); - return pWell; - } - //说明从项目或者井节点发起attachSLF,需要读取slf获得井名和井次信息 - QString wellname=""; - QString wellRoundname=""; - Slf_FILE_MESSAGE mssage; - logio->GetFileMessage(mssage); - wellname=mssage.WellName; - wellname=wellname.toUpper(); - //辨别井名是否有效,无效则采用文件名 - QFileInfo fileInfo(filename); - QString strWellName = fileInfo.completeBaseName(); - strWellName=strWellName.toUpper(); - if (wellname.isEmpty()||wellname.length()>64||wellname.indexOf('&')>-1) - { - wellname=strWellName.toStdString().c_str(); - int len=strlen(strWellName.toStdString().c_str()); - if(len>sizeof(mssage.WellName)) len=sizeof(mssage.WellName); - strncpy(mssage.WellName,strWellName.toStdString().c_str(),len); - mssage.WellName[len]=0; - logio->SetFileMessage(mssage); - } - wellname=wellname.toUpper(); - // if(!GetProject() ) { - // delete logio; - // return NULL; - // } - // //挂接到树 - // PaiObject *pObject=GetProject()->GetObjectByName( wellname,2);//GetClassID_Well()); - // pWell = dynamic_cast( pObject ); - // if(!pWell) { - // CObjWellTrack *pWellTrack = dynamic_cast( pObject); - // if(pWellTrack&&pWellTrack->GetWelllogRound()) { - // pWell=pWellTrack->GetWelllogRound()->GetWell(); - // } - // } - if(!pWell) { - // pWell = CDataImport::GetWellByName(wellname); - // CDataTree *pTree=(CDataTree *)GetDataTree(); - // if(pTree) { - // PaiObject *pJ=GetProject()->GetObjectByType(GetClassID_WellsFolder()); - // QTreeWidgetItem* pItemF=pTree->GetTreeItem(dynamic_cast(pJ)); - // QTreeWidgetItem* pItem=pTree->GetTreeItem(pWell ); - // QTreeWidgetItem* pItemF1=NULL; - // if(pItem)pItemF1=pItem->parent(); - // if(pItemF1!=pItemF) { - // if(pItemF1)pItemF1->removeChild(pItem); - // if(pItemF)pItemF->addChild(pItem); - // } - // } - // if(!pWell) { - // delete logio; - // return NULL; - // } - - if( !pWell ) - { - pWell = new CObjWell(); - pWell->SetName( strWellName ); - } - - QString welln; - if(filename.endsWith(".slf",Qt::CaseInsensitive)) - { - QString dirpath=GetLogdataPath()+m_prjname/*GetProject()->GetName()*/; - - char szTemp[64]; - strcpy(szTemp, ".well"); - welln=GetWellFileFromDir(dirpath,wellname, szTemp); - if(welln.isEmpty()||(!pWell->GetName().isEmpty()&&wellname!=pWell->GetName())) { - wellname=pWell->GetName(); - int index=filename.lastIndexOf("\\"); - int index1=filename.lastIndexOf("/"); - if(index1>index) index=index1; - welln=GetWellFileFromCurrentDir(filename.left(index+1),wellname,szTemp); - if(welln.isEmpty()) { - welln=filename.left(index+1)+wellname+".well"; - CreateWellFile(logio,mssage,welln,pWell); - // CDataTree::SetTree(welln,pWell,NULL,(DepthProgress *)pDepthProgress,1); - } - } - } - else if(filename.endsWith(".well",Qt::CaseInsensitive))welln=filename; - pWell->SetWellFileName(welln); - } - wellRoundname=strWellName; - //查找是否已经存在该井和井次 - int isrefress=0; - if(!filename.endsWith(".well",Qt::CaseInsensitive)) { - pWelllogRound=dynamic_cast( pWell->GetObjectByName(wellRoundname,GetClassID_WellLogRound())); - if(pWelllogRound) - { - QString cs=pWelllogRound->GetSlfFileName(); - cs.replace('\\','/'); - cs.replace("//","/"); - QString cs1=filename; - cs1.replace('\\','/'); - cs1.replace("//","/"); - if(cs1.compare(cs,Qt::CaseInsensitive)!=0) { - QString cs2=cs+"\n"; - cs2+=cs1+"为同一井次文件!\n"; - cs2+="按重名文件加载!"; - // AppendConsole(pai::log::PAI_ERROR,cs2); - wellRoundname+="_重名文件"; - strcpy(mssage.Item,wellRoundname.toStdString().c_str()); - pWelllogRound=NULL;//return 0; - } - } - if(!pWelllogRound) - { - // pWelllogRound=new CObjWelllogRound(); - // pWelllogRound->SetWell(pWell); - // pWell->AddChild(pWelllogRound); - - // pWell->SetCurrentObjWellRound(pWelllogRound); - if(strstr(mssage.Item,"常规")) { - strncpy(mssage.Item,wellRoundname.toStdString().c_str(),sizeof(mssage.Item)); - mssage.Item[strlen(wellRoundname.toStdString().c_str())]=0; - } - if(strlen(mssage.Item)) { - wellRoundname=mssage.Item; - } - else { - int len=strlen(wellRoundname.toStdString().c_str()); - if(len>sizeof(mssage.Item)) len=sizeof(mssage.Item); - strncpy(mssage.Item,wellRoundname.toStdString().c_str(),len); - mssage.Item[len]=0; - logio->SetFileMessage(mssage); - } - // wellRoundname=wellRoundname.toUpper(); - // pWelllogRound->SetName(wellRoundname); - // pWelllogRound->SetSlfFileName(filename); - } - else { - isrefress=true; - } - } - QString temp = ::GetConfPath()+"data.ini"; - QSettings settings(temp,QSettings::IniFormat,0); - settings.setIniCodec(QTextCodec::codecForName("UTF-8")); - QStringList serials=settings.value("wellType",0).toStringList(); - int type=serials.indexOf(mssage.WellType); - - if(type>-1) pWell->SetWellSymbol("well" + QString::number(type) + ".png"); - - //else isrefress=true; - float Altitude=mssage.Altitude; - float X_COORDINATE=mssage.Xcoor; - float Y_COORDINATE=mssage.Ycoor;//井斜x,y坐标 - WellHead &mWellHead=pWell->GetWellHead(); - if(mssage.Kelly==9999999) mssage.Kelly=0; - if(mssage.Kelly==-9999) mssage.Kelly=0; - if(mssage.Kelly==-99999) mssage.Kelly=0; - if(mssage.azca) mWellHead.azca=mssage.azca; - if(mssage.Kelly)mWellHead.dEle=ConvertDataByFloat(mssage.Kelly).toFloat(); - if(mssage.WellName[0])mWellHead.wellName=mssage.WellName; - if(X_COORDINATE)mWellHead.x=X_COORDINATE; - if(Y_COORDINATE)mWellHead.y=Y_COORDINATE; - if(Altitude)mWellHead.earthEle=Altitude; - if(mssage.X0)mWellHead.dxe=mssage.X0; - if(mssage.Y0)mWellHead.dyn=mssage.Y0; - if(mssage.TVD)mWellHead.tvd=mssage.TVD; - Slf_CURVE acurveinfo; - memset(&acurveinfo,0,sizeof(Slf_CURVE)); - int curveCount=logio->GetObjectCount(); - if(isrefress) { - logio->DiscardObject("X"); - logio->DiscardObject("Y"); - logio->DiscardObject("Z"); - logio->DiscardObject("TVD"); - } - iX=logio->OpenCurve("X"); - iY=logio->OpenCurve("Y"); - iZ=logio->OpenCurve("Z"); - if(iX>-1) logio->GetCurveInfo(iX,&acurveinfo); - - mWellHead.depth=acurveinfo.StartDepth; - if(mWellHead.tvd==0&&acurveinfo.StartDepth!=0)mWellHead.tvd=acurveinfo.StartDepth; - mWellHead.z=mWellHead.earthEle-mWellHead.tvd+mWellHead.dEle; - mWellHead.startDepth=acurveinfo.StartDepth; - mWellHead.endDepth=acurveinfo.EndDepth; - mWellHead.rlev=acurveinfo.DepLevel; - int iDepth=-1; - iDepth=logio->OpenCurve("TVD"); - if(iX>=0&&iY>=0&&iZ>=0&&iDepth>=0) { - logio->GetCurveInfo(iX,&acurveinfo); - if(acurveinfo.DepLevel==0) { - logio->DiscardObject(iX); - logio->DiscardObject(iY); - logio->DiscardObject(iZ); - logio->DiscardObject(iDepth); - delete logio; - pWell->ComputeTrajectory(pWell,filename); - } else { - delete logio; - pWell->SetDepth(pWell); - } - } - else { - delete logio; - pWell->ComputeTrajectory(pWell,slffilename); - } - logio=new CLogIO(); - if(!logio->Open(slffilename.toStdString().c_str(),CSlfIO::modeRead)) - { - delete logio; - QString aa=slffilename+"文件打开失败,请检查!"; - // AppendConsole(pai::log::PAI_ERROR,aa); - return pWell; - } - curveCount=logio->GetObjectCount(); - char* curvename=new char[65]; - curvename[64]='\0'; - char* aliasname=new char[65]; - aliasname[64]='\0'; - for(int i=0;iGetObjectName(i,curvename,NULL,aliasname); - if(!logio->IsObject(i)) { - logio->DiscardObject(i); - continue; - }; - if(logio->GetObjectStatus(i)!=OBJECT_NORMAL) continue; - short curvetype=logio->GetObjectType(i); - short Attribute=0,SubAttribute=0; - logio->GetObjectAttribute(i,&Attribute,&SubAttribute); - if(curvetype==CURVE_OBJECT) - { - Slf_CURVE acurveinfo; - logio->GetCurveInfo(i,&acurveinfo); - if(acurveinfo.DepLevel!=0&&(acurveinfo.EndDepth-acurveinfo.StartDepth>0)) - { - if(acurveinfo.MaxValue==acurveinfo.MinValue||acurveinfo.MaxValue==-99999||acurveinfo.MaxValue==-9999||acurveinfo.MinValue==999999||acurveinfo.MinValue==999999||acurveinfo.MinValue==99999||acurveinfo.MinValue==99999||acurveinfo.MinValue==-9999){ - int curveindex=logio->OpenSlfTable(i,-1); - if(curveindex>-1) - { - MyDataTypeEnum vVdl; - DWORD count=(acurveinfo.EndDepth-acurveinfo.StartDepth)/acurveinfo.DepLevel+1.5; - DWORD len=count*acurveinfo.CodeLen; - acurveinfo.MinValue=99999999; - acurveinfo.MaxValue=-99999999; - if(acurveinfo.CodeLen==8) acurveinfo.MinValue=99999999; - vVdl.vchar=new char[len]; - len=logio->ReadCurve(curveindex, acurveinfo.StartDepth,count,(void *)vVdl.vchar); - if(!len) { - QString cs; - char buf[1000]; - sprintf(buf,"%s %f-%f",acurveinfo.Name,acurveinfo.StartDepth,acurveinfo.EndDepth); - cs=buf; - int flag = QMessageBox::warning(NULL,"提示",QString(cs+"\n曲线信息异常!删除该曲线可能需要较长时间,建议复制正常曲线等信息到新文件,然后删除此文件。是否此时直接将该曲线删除?"),QMessageBox::Yes,QMessageBox::No); - if(flag==QMessageBox::Yes) logio->DiscardObject(i); - delete vVdl.vchar; - continue; - } - for(int kk=0;kkGetData(acurveinfo.RepCode,&vVdl.vchar[kk*acurveinfo.CodeLen],buf); - if(_isnan(temp)||!_finite(temp)) continue; - - if(acurveinfo.MaxValuetemp) if(temp!=-9999.0&&temp!=-999.25&&temp!=-99999.0)acurveinfo.MinValue=temp; - } - logio->SetCurveInfo(curveindex,&acurveinfo); - delete vVdl.vchar; - } - } - } - else if(acurveinfo.DepLevel==0||acurveinfo.StartDepth<-100000||acurveinfo.StartDepth>100000) - { - QString cs; - char buf[1000]; - sprintf(buf,"%s %f-%f",acurveinfo.Name,acurveinfo.StartDepth,acurveinfo.EndDepth); - cs=buf; - int flag = QMessageBox::warning(NULL,"提示",QString(cs+"\n曲线信息异常!删除该曲线可能需要较长时间,建议复制正常曲线等信息到新文件,然后删除此文件。是否此时直接将该曲线删除?"),QMessageBox::Yes,QMessageBox::No); - if(flag==QMessageBox::Yes) logio->DiscardObject(i); - continue; - } - } - } - delete []curvename; - delete []aliasname; - DepthProgress *pd=new DepthProgress; - pd->CreatProgress(0,2,"正在整理数据..."); - pd->SetDepth(1); - delete logio; - delete pd; -///////////////////// - pai::ios::welllog::Well& topwell=pWell->GetDBWell(); - topwell.SetTopDepth(pWell->GetTopWellLogDepth()); - topwell.SetBottomDepth(pWell->GetBottomWellLogDepth()); - if(X_COORDINATE)topwell.SetXCode(X_COORDINATE); - if(Y_COORDINATE)topwell.SetYCode(Y_COORDINATE); - if(mssage.Altitude)topwell.SetAsl(mssage.Altitude); - if(mssage.Kelly)topwell.SetBsl(ConvertDataByFloat(mssage.Kelly).toFloat()); - // topwell.SetItem(mssage.Item); - - ///////////// - topwell.LoadMeesge(filename); - // if(pWelllogRound&&pWelllogRound->GetChildrenCount()>2) { - // isrefress=1; - // } - // if(isrefress) { - // QString slfFileName=filename; - // CDataTree::SetTree(slfFileName,pWell,pWelllogRound,(DepthProgress *)pDepthProgress,1); - // } - } - - return pWell; -} -void CDataImport::ImportCoreImage() -{ - // QStringList listFiles=GetFileNames("选择文件","图片文件(*.jpg)"); - // CObjCoreImage* pCoreImage = new CObjCoreImage(); - - // std::vectorvCoreImage; - // foreach( QString imageFile,listFiles ) - // { - // //得到或创建well - // QFileInfo fileInfo(imageFile); - // QString strWellName = fileInfo.completeBaseName(); - - - // CoreImage coreImage; - - // LinePro linePro; - // linePro.lineColor = QColor(Qt::black); - // linePro.lineWidth = 1; - // linePro.lineStyle = Qt::SolidLine; - - // coreImage.m_imageFile = imageFile; - // coreImage.m_startDepth = 0; - // coreImage.m_endDDepth = 0; - // coreImage.m_leftDepth = 0; - // coreImage.m_rightDepth = 0; - // coreImage.m_border = linePro ; - // //pCoreImage->m_childrenItems.push_back(coreImage); - // vCoreImage.push_back(coreImage); - - // } - // pCoreImage->SetImageObjects( vCoreImage ); - - // if(listFiles.size() > 0) - // { - // pai::gui::CoreImageConfigDialog* pDialog = new pai::gui::CoreImageConfigDialog(); - // pDialog->SetCoreImages( pCoreImage ); - // if(pDialog->exec() == QDialog::Accepted) - // { - // //TODO这里要找到当前曲线,不可写死 - // CObjWell *pWell = CDataImport::GetWellByName( "A10" ); - // pWell->AddChild( pCoreImage ); - // } - // } -} - -void CDataImport::ImportBitmaps() -{ - // QStringList listFiles=GetFileNames("选择文件","图片文件(*.jpg)"); - // qsrand(qrand()); - // foreach( QString imageFile,listFiles ) - // { - - // // create Image object - // int nWidth = qBound( 0,qrand(),1000 ); - // int nHeight = nWidth ; - // CObjBitmap *pImageObject = new CObjBitmap( QRectF( qBound( 0,qrand(),1000 ),qBound( 0,qrand(),1000 ), - // nWidth,nHeight ),imageFile ); - - // // set name - // QFileInfo fileInfo( imageFile ); - // pImageObject->SetName( fileInfo.completeBaseName() ); - - // // add to project - // if( ::GetProject() ) - // { - // ::GetProject()->AddChild( pImageObject ); - // } - // } -} - -void CDataImport::ImportConvertorWellLogFiles(QString wellname,QString wellroundname) -{ -// AppendConsole(pai::log::PAI_INFO,QObject::tr("解编模块启动中...")); -// ConvertorManager &pManager=ConvertorManager::GetInstance(); -// QVectorvSuffix=pManager.GetSupportFileExtensions(); -// // if (vSuffix.empty()) -// // return; -// QString fileSuffix("数据文件("); -// for (int i=0;i1) { -// DepthProgress.CreatProgress(0,listFiles.size(),"数据加载",0); -// int progress=0; -// char aa[1000]; -// //whp change 2019.12.08 for 输出成功加载的文件个数 -// int errNum=0,okNum=0,abandonedNum=0;//2020.3.19 放弃加载; -// QStringList errFile,abandonedFile;//2020.3.19 -// //whp add 2020.3.19 -// CDataImport::flag1=-1; -// CDataImport::m_flag=-1; -// CDataImport::flag_check=0;// -// foreach(QString iFile,listFiles ) { -// progress++; -// sprintf(aa,"待加载数据文件%d个,当前正在加载:%s",listFiles.size(),iFile.toStdString().c_str()); -// DepthProgress.SetShowName(aa,0); -// DepthProgress.SetDepth(progress,0); -// //多个测井数据加载时解编入口 -// QString slfName=ConvertorWellLogFiles(pManager,iFile,&DepthProgress); -// if(slfName=="") -// { -// errNum++; -// errFile.append(iFile); -// } -// else if(slfName=="abandoned")//2020.3.19 放弃加载 -// { -// abandonedNum++; -// abandonedFile.append(iFile); -// } -// else -// { -// CObjWell* pWell=ChangetoSlf(slfName,&DepthProgress);//whp add 2019.12.12 -// if(!pWell) { -// errNum++; -// errFile+=iFile; -// errFile+="\r\n"; -// } -// } -// } -// DepthProgress.DelProgress(); -// CObjProject *pPrj=::GetProject(); -// if(pPrj) { -// PaiObject *pObj=pPrj->GetObjectByType(GetClassID_WellsFolder()); -// if(pObj) { -// CBaseObject * pBaseObject = dynamic_cast(pObj); -// if(pBaseObject) { -// CDataTree *pDatatree=(CDataTree *)::GetProject()->m_pDataTree; -// if(pDatatree) { -// QTreeWidgetItem* pItem=pDatatree->GetTreeItem(pBaseObject); -// pDatatree->ClickObjectCommand(pItem); -// } -// pBaseObject->SetCheckState(Qt::Checked); -// CVecWindow *pWindow=CVecWindowCommand::GetCurrentWindow(); -// CVecDisplayObjectCommand::ClickObjectCommand( pBaseObject->GetPaiObject(),pWindow); -// } -// } -// } - -// //2020.3.17需要修改 -// QString mes=""; -// if(errNum||abandonedNum) -// { -// mes="成功导入"+QString::number(listFiles.size()-errNum-abandonedNum)+"个文件;"; -// if(abandonedNum) mes+="放弃导入"+QString::number(abandonedNum)+"个数据文件;"; -// if(errNum)mes+="\r\n"+QString::number(errNum)+"个数据文件无法识别:\r\n"+errFile.join("\r\n"); -// CDialog* m_dialog=new CDialog(); -// m_dialog->setMessage(mes); -// m_dialog->setTitle("提示"); -// m_dialog->exec(); -// delete m_dialog; -// } -// else { -// mes=QString::number(listFiles.size())+"个文件全部导入成功!"; -// QMessageBox::about(NULL,"提示",mes); -// } -// } -// else { -// DepthProgress.CreatProgress(0,1,"数据加载",0); -// DepthProgress.SetDepth(1,0); -// QString us=listFiles[0].toLower(); -// QFileInfo currentfile(us); -// us=currentfile.suffix(); -// // if(us.indexOf("slf")>-1||us.indexOf("wis")>-1) { -// //whp add 2019.12.09 for .well -// if(us.indexOf("slf")>-1||us.indexOf("well")>-1) { -// ChangetoSlf(listFiles[0]); -// QString message=listFiles[0]+"解编结束"; -// AppendConsole(pai::log::PAI_INFO,QObject::tr(message.toStdString().c_str())); -// return; -// } -// DepthProgress.SetShowName("类型识别",0); -// QVector vConvertor=pManager.GetSupportConvertors(listFiles[0],&DepthProgress); -// // if (vConvertor.empty()) return ; -// if (vConvertor.empty()) -// { -// QMessageBox::information(NULL,"无法识别的文件",listFiles[0]); -// return ; -// } -// ImportDataDialog *pDialog = new ImportDataDialog(NULL,wellname,wellroundname); -// pDialog->DisplayFileInformationAreaData(vConvertor,listFiles[0]); -// ::GetObjectEvent().OnActiveConvertorWindow( pDialog ); -// } -// AppendConsole(pai::log::PAI_INFO,QObject::tr("解编模块解编结束")); -} -//whp change 2019.12.08 for 输出成功加载的文件个数 -//void -//bool -//whp add 2020.2.28 for 检查井名文件名是否存在,若存在,获取井次全路径文件名 -QString CDataImport::GetOutName(QString wellname,QString filename) -{ - // CObjProject *pPrj=::GetProject(); - // PaiObject *pObj=pPrj->GetObjectByType(GetClassID_WellsFolder()); - // QList childs; - // pObj->GetChildren(childs); - // int wellnum=childs.count(); - // foreach(PaiObject *pChild,childs) - // { - // CObjWell *pWell=dynamic_cast(pChild); - // if(pWell) - // { - // QString well=pWell->GetName().toUpper(); - // if(well==wellname.toUpper()) - // { - // QList childsRound; - // pChild->GetChildren(childsRound); - // foreach(PaiObject *pChildRound,childsRound) - // { - // CObjWelllogRound *pWellRound=dynamic_cast(pChildRound); - // if(pWellRound) - // { - // QString file=pWellRound->GetName().toUpper(); - // if(file==filename.toUpper()) - // { - // QString outname=pWellRound->GetSlfFileName(); - // return outname; - // } - // } - // } - // } - // } - // } - return ""; - } -////whp change 2020.2.28 for 检查井名、文件名是否存在,若存在,使用已存在的输出路径(主要针对更名后的井文件) -QString CDataImport::ConvertorWellLogFiles(ConvertorManager &pManager,QString wellname,DiDepthProgress *DepthProgress) -{ - QString iFile=wellname; - QString us1=iFile.toLower(); - QFileInfo currentfile(us1); - QString us=currentfile.suffix(); - //whp add 2019.12.09 for .well - if(us.indexOf("slf")>-1||us.indexOf("well")>-1) { - //ChangetoSlf(iFile,DepthProgress); - //return 1; - return iFile;//whp change 2019.12.12 - } - QVector vConvertor=pManager.GetSupportConvertors(iFile,DepthProgress); - if(vConvertor.size()>1) { - QString s=iFile+"解编模块不唯一,无法批量解编!"; - // AppendConsole(pai::log::PAI_INFO,s); - return "";//0;//whp change 2019.12.12 - } - if(vConvertor.size()==0) { - QString s=iFile+"无法识别数据类型,无法解编!"; - // AppendConsole(pai::log::PAI_INFO,s); - return "";//0;//whp change 2019.12.12 - } - InterIConvertor *v=(InterIConvertor *)vConvertor[0]; - QList ObjWellLogs= v->GetWellLogList(iFile); - int c=ObjWellLogs.size(); - for(int i=0;iGetWellInfo(); - MyWelllogRound* r=v->GetWellLogRoundInfo(); - QString WellName=well->GetName().c_str();//取的谁的名字?跟踪遇见的都是空 - - // if(WellName==""){//应用当前选中井名 - // QAction* ImportConvertorWellLogDataAct= ::GetGlobalCommand().GetAction(GetCmdID_ImportConvertorWellLogData(),true) ; - // WellName = ImportConvertorWellLogDataAct->property("CurrentWellName").value(); - // } - - //whp change 2020.2.18 for 汉字井名转换有乱码 - if(WellName=="") WellName=QString(QString::fromLocal8Bit(v->FILE_MESSAGE.WellName)); //QLatin1String(v->FILE_MESSAGE.WellName);//for 带有井名信息的原始数据,如ASCII - //该语句不可用,发现clis文件中的井名 - //add end - if(WellName=="") WellName=r->GetName().c_str(); - QString strWellName; - // CObjProject *pProject = ::GetProject(); - // if(pProject != NULL) - // { - // strWellName = pProject->GetName(); - // } - strWellName = m_prjname; - QString dir0,dir=::GetLogdataPath();//whp add 2020.2.19 for 非法井名,无法产生井目录 - QDir w; - if(!strWellName.isEmpty()) { - dir=dir+strWellName; - bool ok=w.mkdir(dir); - dir+=QDir::separator(); - } - QString tempWellName; - QString filename=r->GetName().c_str(); - if(filename=="") filename=WellName; - //whp add 2020.3.3 删除井名中的空格 - WellName.replace(" ",""); - WellName=WellName.toUpper(); - //whp add 2020.3.3 删除".zh"之类的后缀之类的后缀 - QFileInfo temDir(WellName); - WellName=temDir.baseName(); - -////// - char *pmessage=v->GetfileMessage(); - if(pmessage) { - char *p=pmessage; - p+=strlen(p)+1; - if(strlen(p)>0&&strlen(p)<20) { - p+=strlen(p)+1; - p+=strlen(p)+1; - tempWellName=p; - } - else tempWellName=""; - } - //whp change 2020.2.18 for 文件名中有一个以上的“."时,如3Oq.ZH.716 - //QFileInfo temDir(filename); - //if(tempWellName=="") tempWellName=temDir.completeBaseName(); - if(tempWellName=="") tempWellName=filename; - QString outputfilename=GetOutName(WellName,tempWellName); - if(outputfilename=="") - { - dir0=dir;//whp add 2020.2.19 for 非法井名,无法产生井目录 - dir+="#"+WellName; - bool ok=w.mkdir(dir); - //whp add 2020.2.19 for 非法井名,无法产生井目录 - QDir mdir(dir); - if(mdir.exists())ok=1; - if(!ok) - { - dir=dir0; - QFileInfo temDir(iFile); - WellName=temDir.completeBaseName(); - outputfilename=GetOutName(WellName,tempWellName); - if(outputfilename=="") - { - dir+="#"+WellName; - ok=w.mkdir(dir); - if(!ok) - { - QString mes="解编"+iFile+"文件时,产生井文件目录失败:\r\n井文件目录:"+dir; - QMessageBox::about(NULL, QObject::tr("警告"), mes); - return ""; - } - outputfilename=dir; - outputfilename+=QDir::separator(); - outputfilename+=tempWellName; - outputfilename+=".slf"; - } - } - else outputfilename=dir+QDir::separator()+tempWellName+".slf"; - } - char *outfile = new char[outputfilename.toStdString().size()+200]; - strcpy(outfile, outputfilename.toStdString().c_str()); - -/* //whp add 2019.12.10 for 如果文件存在,提示是否覆盖 - QFileInfo mfi(outfile); - //2020.3.19 - if(mfi.isFile()) - { - - if(CDataImport::flag_check)//&&CDataImport::flag1!=-1) - { - if(CDataImport::flag1==QMessageBox::Cancel)return "abandoned";//放弃加载 - else if(CDataImport::flag1==QMessageBox::No){ - QDir ss;ss.remove(outfile); - } - } - else //if(mfi.isFile()) - {//whp change 2020.2.28 - QMessageBox box(QMessageBox::Warning,"提示","输出文件"+QString::fromLocal8Bit(outfile)+"已存在!"); - //box.setStandardButtons (QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel|QMessageBox::YesAll|QMessageBox::NoAll|QMessageBox::Apply); - box.setStandardButtons (QMessageBox::Yes|QMessageBox::Cancel|QMessageBox::YesAll|QMessageBox::Apply); - box.setButtonText (QMessageBox::Yes,QString("覆盖当前"));//\r\n已存在文件")); - // box.setButtonText (QMessageBox::No,QString("重建\r\n当前文件")); - box.setButtonText (QMessageBox::YesAll,QString("覆盖所有"));//\r\n已存在文件")); - // box.setButtonText (QMessageBox::NoAll,QString("全部\r\n执行重建")); - box.setButtonText (QMessageBox::Cancel,QString("放弃当前"));//\r\n文件解编")); - box.setButtonText (QMessageBox::Apply,QString("放弃所有"));//\r\n已存在文件解编")); - int ret=box.exec(); - if(ret==QMessageBox::YesAll||ret==QMessageBox::Yes) CDataImport::flag1 =QMessageBox::Yes; - //if(ret==QMessageBox::NoAll||ret==QMessageBox::No) CDataImport::flag1 =QMessageBox::No; - if(ret==QMessageBox::Cancel||ret==QMessageBox::Apply) CDataImport::flag1 =QMessageBox::Cancel; - //if(ret==QMessageBox::NoAll||ret==QMessageBox::YesAll||ret==QMessageBox::Apply) CDataImport::flag_check=1; - if(ret==QMessageBox::YesAll||ret==QMessageBox::Apply) CDataImport::flag_check=1; - if(CDataImport::flag1==QMessageBox::Cancel)return "abandoned";//放弃加载 - //else if(CDataImport::flag1==QMessageBox::No)QDir ss;ss.remove(outfile); - } - } - //add end*/ - char *logfilename = new char[iFile.toStdString().size()+1]; - - strcpy(logfilename, iFile.toStdString().c_str()); - - int l=strlen(outfile)+1; - double x=well->GetXCode(); - strcpy(&outfile[l],QString::number(x).toStdString().c_str());//x坐标 - double y=well->GetYCode(); - l+=strlen(&outfile[l])+1; - strcpy(&outfile[l],QString::number(y).toStdString().c_str());//y坐标 - - QString top="-99999.";//QString::number(r->GetTopDepth()); - l+=strlen(&outfile[l])+1; - strcpy(&outfile[l],top.toStdString().c_str());//y坐标 - - QString bottom="-99999.";//QString::number(r->GetBottomDepth()); - l+=strlen(&outfile[l])+1; - strcpy(&outfile[l],bottom.toStdString().c_str());//y坐标 - l+=strlen(&outfile[l])+1; - int iRow=v->GetWellCurves().Curve_Num; - *(int *)&outfile[l]=iRow; - //TODO - vector OutCurveNo; - vector OutCurve=v->GetCurveNames(); - vector strChineseName=v->GetCurveNames(); - vector strUnit=v->GetCurveUnits(); - for(int i=0;i ExistCurveNo; - vector ExistCurve; - int ExistCurveNum=0; - logio->Open(qss.toStdString().c_str(),CSlfIO::modeRead); - for(int i=0;iFindObjectName(OutCurve[i]); - if(logio->FindObjectName(OutCurve[i],-1,-1,OBJECT_NORMAL)<0)continue; - ExistCurve.push_back(OutCurve[i]); - ExistCurveNo.push_back(i); - } - if(ExistCurve.size()>0)//输出对象是否存在 - { - if(!CDataImport::flag_check) - { - QString name=qss; - int index=name.lastIndexOf("/"); - int index1=name.lastIndexOf("\\"); - if(index1>index)index=index1; - name=name.mid(index+1); - name=name.left(name.lastIndexOf(".")); - Slf_FILE_MESSAGE mes; - logio->GetFileMessage(mes); - QString m_WellAndRound=QString::fromLocal8Bit(mes.WellName)+"井"+name; - TiShiDialog *dlg=new TiShiDialog(NULL); - dlg->init(ExistCurve,m_WellAndRound);//qss); - - if(dlg->exec()==QDialog::Accepted) - { - CDataImport::flag1=dlg->flag; - CDataImport::m_flag=dlg->flag; - CDataImport::flag_check=dlg->check; - } - } - int mflag=CDataImport::m_flag; - if(mflag==0)//跳过 - { - for(int i=0;iDiscardObject(ExistCurve[i]); - } - } - else if(mflag==3)//另存 - { - QStringList OutCurveList; - for(int i=0;iGetObjectCount();i++) - { - char name[64]; - if(logio->GetObjectStatus(i)!=OBJECT_NORMAL)continue; - logio->GetObjectName(i,name); - OutCurveList.append(QString(name)); - } - for(int i=0;iClose(); - } -// bool CheckExistCurve(QString outputfilename,int NumLog,vector& OutCurveNo,vector& OutCurve); - - - if(logio->Open(UTF8ToGBK(qss).data()/*qss.toStdString().c_str()*/,CSlfIO::modeRead)) - { - Slf_FILE_MESSAGE FILE_MESSAGE=v->FILE_MESSAGE; - logio->GetFileMessage(v->FILE_MESSAGE); - - if(v->FILE_MESSAGE.Xcoor!=FILE_MESSAGE.Xcoor) { - if(FILE_MESSAGE.Xcoor!=0) v->FILE_MESSAGE.Xcoor=FILE_MESSAGE.Xcoor; - } - if(v->FILE_MESSAGE.Ycoor!=FILE_MESSAGE.Ycoor) { - if(FILE_MESSAGE.Ycoor!=0) v->FILE_MESSAGE.Ycoor=FILE_MESSAGE.Ycoor; - } - if(v->FILE_MESSAGE.Altitude!=FILE_MESSAGE.Altitude) { - if(FILE_MESSAGE.Altitude!=0) v->FILE_MESSAGE.Altitude=FILE_MESSAGE.Altitude; - } - if(v->FILE_MESSAGE.Kelly!=FILE_MESSAGE.Kelly) { - if(FILE_MESSAGE.Kelly!=0) v->FILE_MESSAGE.Kelly=FILE_MESSAGE.Kelly; - } - if(v->FILE_MESSAGE.TVD!=FILE_MESSAGE.TVD) { - if(FILE_MESSAGE.TVD!=0) v->FILE_MESSAGE.TVD=FILE_MESSAGE.TVD; - } - if(v->FILE_MESSAGE.X0!=FILE_MESSAGE.X0) { - if(FILE_MESSAGE.X0!=0) v->FILE_MESSAGE.X0=FILE_MESSAGE.X0; - } - if(v->FILE_MESSAGE.Y0!=FILE_MESSAGE.Y0) { - if(FILE_MESSAGE.Y0!=0) v->FILE_MESSAGE.Y0=FILE_MESSAGE.Y0; - } - if(v->FILE_MESSAGE.Z0!=FILE_MESSAGE.Z0) { - if(FILE_MESSAGE.Z0!=0) v->FILE_MESSAGE.Z0=FILE_MESSAGE.Z0; - } - int indexSTable=-1; - int indexDTable=-1; - if(logio->FindObjectIndex("井基本信息")>-1) { - WELL_STATIC_INFO WellStaticInfo=v->WellStaticInfo; - - indexSTable=logio->OpenSTATIC("井基本信息"); - logio->ReadTable(indexSTable,1,&v->WellStaticInfo);//inf); - if(v->WellStaticInfo.XCoor!=WellStaticInfo.XCoor) { - if(WellStaticInfo.XCoor!=0) v->WellStaticInfo.XCoor=WellStaticInfo.XCoor; - } - if(v->WellStaticInfo.YCoor!=WellStaticInfo.YCoor) { - if(WellStaticInfo.YCoor!=0) v->WellStaticInfo.YCoor=WellStaticInfo.YCoor; - } - if(v->WellStaticInfo.As1!=WellStaticInfo.As1) { - if(WellStaticInfo.As1!=0) v->WellStaticInfo.As1=WellStaticInfo.As1; - } - if(v->WellStaticInfo.Bs1!=WellStaticInfo.Bs1) { - if(WellStaticInfo.Bs1!=0) v->WellStaticInfo.Bs1=WellStaticInfo.Bs1; - } - logio->CloseTable(indexSTable); - } - if(logio->FindObjectIndex("测井信息")>-1) { - WELL_DYNAMIC_INFO WellDynamicInfo; - indexDTable=logio->OpenDYNAMIC("测井信息"); - logio->ReadTable(indexDTable,1,&v->WellDynamicInfo);//inf); - logio->CloseTable(indexDTable); - } - } - delete logio; - //v->Transfer(logfilename,outfile,&OutCurveNo[0],&OutCurve[0],&strChineseName[0],&strUnit[0],iRow); - //whp change 2019.12.10 for写入井名 - // QString strCh(logfilename); // 汉字路径转换 - if(v->Transfer(/*strCh.toLocal8Bit().data()*/UTF8ToGBK(logfilename).data(),outfile,&OutCurveNo[0],&OutCurve[0],&strChineseName[0],&strUnit[0],iRow)) - { - CLogIO * logio=new CLogIO(); - logio->Open(outfile/*UTF8ToGBK(outfile).data()*/,CSlfIO::modeReadWrite); - Slf_FILE_MESSAGE mssage; - logio->GetFileMessage(mssage); - strcpy(mssage.WellName,UTF8ToGBK(WellName).data()/*WellName.toStdString().c_str()*/); - logio->SetFileMessage(mssage); - delete logio; - } - else return "";//whp add 2019.12.12 - //whp change 2020.2.18 for 汉字井名转换有乱码 - QString slfname=outfile;//QString(QString::fromLocal8Bit(outfile));//QString(QLatin1String(outfile)); - delete []logfilename; - delete []outfile; - //return 1;////whp add 2019.12.08 for 输出成功加载的文件个数 - return slfname;//whp change 2019.12.12 -} -QStringList CDataImport::GetFileNames(const QString &caption , const QString &filter,QFileDialog::FileMode filemode ) -{ - static QString path=::GetDataPath(); - QStringList sts=QFileDialog::getOpenFileNames(NULL,caption,path,filter); - if(sts.size()) path=sts[0]; - return sts; -// QFileDialog * fileDlg=new QFileDialog(); -// fileDlg->setFileMode(filemode); -// QStringList listFiles; -// if(fileDlg->exec()==QFileDialog::Accepted) -// { -// listFiles=fileDlg->selectedFiles(); -// } -// delete fileDlg; -// return listFiles; -} -void CDataImport::OutPutWellXYCoordinate() -{ - // //井名 磁偏角 南北(小) 东西(大) 测量深度 地面海拔 补心高 TVD 东西位移 南北位移 - // //a 0 4394427.9 19308473.9 0 1446.9 0 0 0 0 - // //b 0 4394427.9 19308473.9 0 1446.9 0 0 0 0 - // //c 0 4398164.3 19306076.3 0 1436.5 0 0 0 0 - // //d 0 4398270.1 19311098.4 0 1437.5 0 0 0 0 - // //e 0 4392057.3 19305209.1 0 1461.3 0 0 0 0 - // QString strFileName =QFileDialog::getSaveFileName( NULL,"导出工区井坐标为TXT",::GetOutDataPath(),"文件(*.txt)"); - // FILE *fp=fopen(strFileName.toStdString().c_str(),"wt"); - // if(!fp) return; - // fprintf(fp,"磁偏角 南北(小) 东西(大) 测量深度 地面海拔 补心高 TVD 东西位移 南北位移\m"); - // int flag=0; - // CObjProject *pPrj=::GetProject(); - // if(!pPrj) return; - // PaiObject *pObj=pPrj->GetObjectByType(GetClassID_WellsFolder()); - // if(!pObj) return; - // QList childs; - // pObj->GetChildren(childs); - // std::vector wellnames; - // foreach(PaiObject *pChild,childs) { - // CObjWell *pWell=dynamic_cast(pChild); - // if(pWell) - // { - // QString ss=pWell->GetWellFileName(); - // QString wellname,path; - // GetWellNameAndPath(ss,wellname,path); - // WellHead &hd=pWell->GetWellHead(); - // fprintf(fp,"%s\t%10.3f\t%10.3f\t%10.3f\t%10.3f\t%10.3f\t%10.3f\t%10.3f\t%10.3f\t%10.3f\t\n", - // hd.wellName.toStdString().c_str(), - // //井名 磁偏角 南北(小) 东西(大) 测量深度 地面海拔 补心高 TVD 东西位移 南北位移 - // hd.azca, - // hd.x, - // hd.y, - // hd.depth, - // hd.earthEle, - // hd.dEle, - // hd.tvd, - // hd._HorizBoreXE, - // hd._HorizBoreYN); - // } - // } - // fclose(fp); - // QMessageBox::warning(NULL,"提示",QString("井位信息保存完成!")); -} - -void CDataImport::ImportWellXYCoordinate() -{ -// //井名 磁偏角 南北(小) 东西(大) 测量深度 地面海拔 补心高 TVD 东西位移 南北位移 -// //a 0 4394427.9 19308473.9 0 1446.9 0 0 0 0 -// //b 0 4394427.9 19308473.9 0 1446.9 0 0 0 0 -// //c 0 4398164.3 19306076.3 0 1436.5 0 0 0 0 -// //d 0 4398270.1 19311098.4 0 1437.5 0 0 0 0 -// //e 0 4392057.3 19305209.1 0 1461.3 0 0 0 0 - - -// QStringList listFiles=GetFileNames("选择工区井井位信息","数据文件(*.prn;*.txt)"); -// if(!listFiles.size()) -// { -// return; -// } -// int flag=0; -// foreach(QString strFileName, listFiles) -// { -// QFile file(strFileName); -// if (!file.open(QIODevice::ReadOnly )) -// { -// continue; -// } -// flag=0; -// QTextStream in(&file); -// QString lineString = in.readLine(); -// QStringList LineStringList = lineString.split(","); -// if(LineStringList.size()==1) LineStringList = lineString.split(" "); -// if(LineStringList.size()==1) LineStringList = lineString.split(" "); -// LineStringList.removeAll(""); -// LineStringList.removeAll(" "); -// for (int i=0;i-1) LineStringList[i]=LineStringList[i].replace("\t",""); -// LineStringList[i]=LineStringList[i].trimmed(); -// } -// QString strWellName=LineStringList[0]; -// if(strWellName.indexOf("wellname",0,Qt::CaseInsensitive)>=0|| -// strWellName.indexOf("井名",0,Qt::CaseInsensitive)>=0 -// ) { -// flag=1; -// } -// while ( !in.atEnd() ) -// { -// lineString = in.readLine(); -// if(lineString.isEmpty()) continue; -// LineStringList = lineString.split(","); -// if(LineStringList.size()==1) LineStringList = lineString.split(" "); -// if(LineStringList.size()==1) LineStringList = lineString.split(" "); -// LineStringList.removeAll(""); -// LineStringList.removeAll(" "); -// for (int i=0;i-1) LineStringList[i]=LineStringList[i].replace("\t",""); -// LineStringList[i]=LineStringList[i].trimmed(); -// } -// if(LineStringList.size()<1) continue; -// LineStringList.replaceInStrings("-9999.0","0"); -// LineStringList.replaceInStrings("-9999","0"); -// if(flag) { -// CObjWell * pWell = CDataImport::GetWellByName(LineStringList[0]); -// if(!pWell) continue; -// //井名 磁偏角 南北(小) 东西(大) 测量深度 地面海拔 补心高 TVD 东西位移 南北位移 -// // 0 1 2 3 4 5 6 7 8 9 -// WellHead &wh=pWell->GetWellHead(); -// if(LineStringList.size()>1)wh.azca=LineStringList[1].toDouble(); -// if(LineStringList.size()>2)wh.y=LineStringList[2].toDouble(); -// if(LineStringList.size()>3)wh.x=LineStringList[3].toDouble(); -// if(LineStringList.size()>4)wh.depth=LineStringList[4].toDouble(); -// if(LineStringList.size()>5)wh.earthEle=LineStringList[5].toDouble(); -// if(LineStringList.size()>6){ -// wh.dEle=LineStringList[6].toDouble(); -// if(wh.dEle==-9999) wh.dEle=0; -// } -// if(LineStringList.size()>7)wh.tvd=LineStringList[7].toDouble(); -// if(LineStringList.size()>8)wh.dyn=LineStringList[8].toDouble(); -// if(LineStringList.size()>9)wh.dxe=LineStringList[9].toDouble(); -// wh.z=wh.earthEle-wh.tvd+wh.dEle; -// if(pWell->GetWellFileName().isEmpty()) { -// QString fi=GetLogdataPath()+GetProject()->GetName()+"\\#"+LineStringList[0]; -// CreateDir((char *)fi.toStdString().c_str()); -// fi+="\\"+LineStringList[0]+".slf"; -// pWell->SetWellFileName(fi); -// } -// pWell->SaveWellHead(pWell->GetWellFileName()); -// QList wellroundchildren; -// int count=pWell->GetAllWellRound(wellroundchildren); -// for(int i=0;i(wellroundchildren[i]); -// pWell->SaveWellHead(pWR->GetSlfFileName()); -// } -// } -// else { -// } -// } -// } -// AfxMessageBox("导入完成!"); -} -void CDataImport::ImportGeoStraData() -{ - // QStringList listFiles=GetFileNames("选择工区层位数据","数据文件(*.prn;*.txt)"); - // if(listFiles.size()<1) return; - // int flag=0; - // std::vector wellNameVec; - // QList layerNameVec; - // std::vector topDetphVec; - // std::vector bottomDepthVec; - // foreach(QString strFileName, listFiles) - // { - // QFile file(strFileName); - // if (!file.open(QIODevice::ReadOnly )) - // { - // continue; - // } - // flag=0; - // QTextStream in(&file); - // QString lineString = in.readLine(); - // QStringList LineStringList = lineString.split(","); - // if(LineStringList.size()==1) LineStringList = lineString.split(" "); - // if(LineStringList.size()==1) LineStringList = lineString.split(" "); - // LineStringList.removeAll(""); - // LineStringList.removeAll(" "); - // for (int i=0;i-1) LineStringList[i]=LineStringList[i].replace("\t",""); - // LineStringList[i]=LineStringList[i].trimmed(); - // } - // if(LineStringList.size()<1) continue; - // QString strWellName = LineStringList[0] ; - // if(strWellName.indexOf("wellname",0,Qt::CaseInsensitive)>=0|| - // strWellName.indexOf("井名",0,Qt::CaseInsensitive)>=0 - // ) { - // flag=1; - // for(int i=1;i-1) { - // flag=2; - // continue; - // } - // layerNameVec.push_back(LineStringList[i]); - // } - // } - // while ( !in.atEnd() ) - // { - // lineString = in.readLine(); - // LineStringList = lineString.split(","); - // if(LineStringList.size()==1) LineStringList = lineString.split(" "); - // if(LineStringList.size()==1) LineStringList = lineString.split(" "); - // LineStringList.removeAll(" "); - // LineStringList.removeAll(""); - // for (int i=0;i-1) LineStringList[i]=LineStringList[i].replace("\t",""); - // LineStringList[i]=LineStringList[i].trimmed(); - // } - // if(LineStringList.size()<1) continue; - // if(flag) { - // wellNameVec.push_back(LineStringList[0]); - // if(flag==1) { - // for(int i=2;iGetWellFileName().isEmpty()) { - // QString fi=GetLogdataPath()+GetProject()->GetName()+"\\#"+wellNameVec[i]; - // CreateDir((char *)fi.toStdString().c_str()); - // fi+="\\"+wellNameVec[i]+".slf"; - // pWell->SetWellFileName(fi); - // } - // CObjGeostratums* pGeostratum = dynamic_cast(pWell->GetObjectByType(GetClassID_OGGeostratums(), 2)); - // if(!pGeostratum) { - // pGeostratum = new CObjGeostratums(); - // pGeostratum->SetName("LAYER_DATA"); - // pWell->AddChild( pGeostratum ); - // } - // if (flag1==QMessageBox::Yes) { - // pGeostratum->ClearItems(); - // } - // pGeostratum->SetSlfFileName(pWell->GetWellFileName()); - // int index = 0; - // if(flag) { - // int size=layerNameVec.size()-1; - // if(flag==2) size=layerNameVec.size(); - // for(int j=0;jGetItemByName(layerNameVec[j]); - // if(!pItem) { - // pItem = pGeostratum->AddItem(top,bottom); - // OGGeostratumItem * pGeoItem = dynamic_cast(pItem); - // if(pGeoItem) { - // pGeoItem->SetName(layerNameVec[j]); - // pGeoItem->SetDEST(layerNameVec[j]); - // pGeoItem->SetSDEP(top); - // pGeoItem->SetEDEP(bottom); - // } - // } - // else { - // OGGeostratumItem * pGeoItem = dynamic_cast(pItem); - // { - // pGeoItem->SetTopDepth(top); - // pGeoItem->SetBottomDepth(bottom); - // pGeoItem->SetSDEP(top); - // pGeoItem->SetEDEP(bottom); - // pGeoItem->SetDEST(layerNameVec[j]); - // } - // } - // } - // } - // else { - // if(topDetphVec[i]==-9999||bottomDepthVec[i]==-9999) continue; - // pai::datamodel::WelllogItem* pItem =pGeostratum->GetItemByName(layerNameVec[i]); - // if(!pItem) { - // pItem = pGeostratum->AddItem(topDetphVec[i],bottomDepthVec[i]); - // OGGeostratumItem * pGeoItem = dynamic_cast(pItem); - // pGeoItem->SetName(layerNameVec[i]); - // pGeoItem->SetDEST(layerNameVec[i]); - // pGeoItem->SetSDEP(topDetphVec[i]); - // pGeoItem->SetEDEP(bottomDepthVec[i]); - // } - // else { - // OGGeostratumItem * pGeoItem = dynamic_cast(pItem); - // pGeoItem->SetTopDepth(topDetphVec[i]); - // pGeoItem->SetBottomDepth(bottomDepthVec[i]); - // pGeoItem->SetSDEP(topDetphVec[i]); - // pGeoItem->SetEDEP(bottomDepthVec[i]); - // pGeoItem->SetDEST(layerNameVec[i]); - // } - // } - // pGeostratum->SaveToSLF(); - // } - - // AfxMessageBox("导入分层完成!"); -} - -void CDataImport::OutPutGeoStraData() -{ -// QString strFileName =QFileDialog::getSaveFileName( NULL,"输出层位数据为TXT",::GetOutDataPath(), -// "文件(*.txt)"); -// int flag=0; -// std::vector wellNameVec; -// std::vector layerNameVec; -// std::vector topDetphVec; -// std::vector bottomDepthVec; - -// CObjProject *pPrj=::GetProject(); -// if(!pPrj) return; -// PaiObject *pObj=pPrj->GetObjectByType(GetClassID_WellsFolder()); -// if(!pObj) return; -// QList childs; -// pObj->GetChildren(childs); -// QStringList LayerNameVec; -// std::vectorLayerNameVecS; -// std::vector> TopDepthVecS; -// std::vector> BottomDepthVecS; -// std::vector wellnames; -// foreach(PaiObject *pChild,childs) { -// CObjWell *pWell=dynamic_cast(pChild); -// if(pWell) { -// QString ss=pWell->GetWellFileName(); -// if(!ss.isEmpty()) { -// QString name="LAYER_DATA"; -// LAYER_DATA m_Result; -// CLogIO *logio=new CLogIO(); -// if(!logio->Open(ss.toStdString().c_str(),CSlfIO::modeRead)) -// { -// delete logio; -// return; -// } -// int iIndex=logio->OpenTable(name.toStdString().c_str()); -// if (iIndex >=0) -// { -// wellnames.push_back(pWell->GetName()); -// QStringList layerNameVec; -// std::vector TopDepthVec; -// std::vector BottomDepthVec; -// int count=logio->GetTableRecordCount(iIndex); -// for(int j=0;jReadTable(iIndex,j+1,&m_Result); -// char buf[490]; -// GetDescription(m_Result,buf); -// if(!strlen(buf)) continue; -// if(!LayerNameVec.contains(buf)) LayerNameVec.append(buf); -// layerNameVec.append(buf); -// TopDepthVec.push_back(m_Result.StartDepth); -// BottomDepthVec.push_back(m_Result.EndDepth); -// } -// LayerNameVecS.push_back(layerNameVec); -// TopDepthVecS.push_back(TopDepthVec); -// BottomDepthVecS.push_back(BottomDepthVec); -// } -// delete logio; -// } -// } -// } -// FILE *fp=fopen(strFileName.toStdString().c_str(),"wt"); -// if(!fp) return; -// fprintf(fp,"%s","wellname\t"); -// for(int j=0;j-1) { -// // if(j!=LayerNameVec.size()) -// fprintf(fp,"%10.3f\t%10.3f",TopDepthVecS[i][pos],BottomDepthVecS[i][pos]); -// // else fprintf(fp,"%10.3f",BottomDepthVecS[i][pos]); -// } -// else fprintf(fp,"%10.3f\t%10.3f",-9999.0,-9999.0); -// if(j!=LayerNameVec.size()-1) fprintf(fp,"%s","\t"); -// else fprintf(fp,"%s","\n"); -// } -// } -// fclose(fp); -// QMessageBox::warning(NULL,"提示",QString("分层数据保存完成!")); -} - -// END_OSGGRAPHICS_NAMESPACE +/////////////////////// +/// +/// wangwei change part:ImportWellTrajectorys() for add read wis、slf,table、dev + +#pragma warning( push ,0) +#include +#include +#include +#include +// #include "BaseFun.h" +#include +#include "MemRdWt.h" +#include +// #include "ObjGeoLayerData.h" +#include "DepthProgress.h" +#include +// #include "ObjectEvent.h" +// #include "VecSceneManager.h" +#include "ConvertorManager.h" +// #include "ObjDiscreteWellLog.h" +#include "DataImport.h" + +#include "geometryutils.h" +// #include "CoreImageConfigDialog.h" +#include "ObjWell.h" +#include "ObjWelllog.h" +// #include "ObjWellTrajectory.h" +// #include "ObjBitmap.h" +// #include "ObjCrossplot.h" +// #include "VecDisplayObjectCommand.h" +// #include "ObjProject.h" +#include "ConvertorManager.h" +#include "IConvertor.h" +#include "ImportdataDialog.h" +// #include "ObjWellLogTrack.h" +#include "ObjWelllogRound.h" +// #include "ObjWellTrack.h" +// #include "ConsoleOutputWidget.h" + +// #include "ObjGeostratums.h" +#include "ObjWelllogWavefile.h" +// #include "ObjWelllogBIN.h" +#include "ObjWelllogINP.h" +// #include "ObjWelllogFMT.h" +// #include "ObjWelllogTDT.h" +#include "ObjWelllogTABLE.h" +#include "InterIConvertor.h" +#include //2020.2.20 whp add +// #include "DataTree.h" +// #include "VecWindowCommand.h" +// #include "cdialog.h"//whp add 2020.3.17 +#include "tishidialog.h" +// #include "Log.h" + +#pragma warning( pop ) +// void OSGFRAMEWORK_EXPORT AppendConsole(pai::log::Priority priority,const QString &output); + +// BEGIN_OSGGRAPHICS_NAMESPACE; +QString CDataImport::m_prjname; +int CDataImport::flag1=-1; +int CDataImport::m_flag=-1; +int CDataImport::flag_check=0; +bool CDataImport::m_bImportByFolder = false; + +void CreateWellFile(CLogIO *logio,Slf_FILE_MESSAGE &mssage,QString wellFile,CObjWell *pWell) +{ + if(logio) { + CLogIO * logiowell=new CLogIO(); + Slf_FILE_MESSAGE ms=mssage; + strcpy(ms.Item,"井基本信息"); + logiowell->Open(wellFile.toStdString().c_str(),CSlfIO::modeWrite); + logiowell->SetFileMessage(ms); + QStringList azims=GetSimilarCurves("AZIM"); + int iAZIM=-1; + QString AZIM; + foreach(QString cname,azims) + { + iAZIM=logio->FindObjectName((char *)cname.toStdString().c_str()); + if(iAZIM>-1) { + AZIM=cname; + break; + } + } + int iDev=-1; + QStringList devis=GetSimilarCurves("DEVI"); + QString DEV; + foreach(QString cname,devis) + { + iDev=logio->FindObjectName((char *)cname.toStdString().c_str()); + if(iDev>-1) { + DEV=cname; + break; + } + } +// if(logio->FindObjectIndex("井基本信息")>-1) { +// logiowell->CopyFromFile((CSlfIO &)(*logio),"井基本信息"); +// } + if(iAZIM>-1)logiowell->CopyFromFile((CSlfIO &)(*logio),(char *)AZIM.toStdString().c_str()); + if(iDev>-1)logiowell->CopyFromFile((CSlfIO &)(*logio),(char *)DEV.toStdString().c_str()); + delete logiowell; + if(iDev>-1&&iAZIM>-1) { + pWell->ComputeTrajectory(pWell,wellFile); + } + } +} +// CObjWell * CDataImport::GetWellByName( QString strWellName ) +// { +// //得到或创建well +// CObjWell *pWell = NULL; +// if( GetProject() ) +// { +// PaiObject *pP=GetProject()->GetObjectByName( strWellName,GetClassID_Well()); +// pWell = dynamic_cast(pP); +// } + +// if( !pWell ) +// { +// pWell = new CObjWell(); +// pWell->SetName( strWellName ); +// if( GetProject() ) +// { +// GetProject()->GetWellsFolder(true)->AddChild( pWell ); +// } +// } +// return pWell; +// } + +// void CDataImport::AddWellNode(CVecSceneManager *pSceneManager,CObjWell *pWell,CObjWell *pWellInsertPos ) +// { +// if( !pWell ) return; +// QUuid ID = pWellInsertPos ? pWellInsertPos->GetID(): QUuid(); +// pSceneManager->AddObject( pWell,&ID ); + +// QListlistChild; +// pWell->GetChildren( listChild); +// for( long i = 0 ; i < listChild.size();++i ) +// { +// AddWellLogNode( pSceneManager,dynamic_cast( listChild[i] ),NULL ); +// } +// } + +// void CDataImport::AddWellLogNode(CVecSceneManager * pSceneManager,CObjWellLog *pWellLog,CObjWellLog *pWellLogInsertPos ) +// { +// QUuid ID = pWellLogInsertPos ? pWellLogInsertPos->GetID() : QUuid(); +// pSceneManager->AddObject( pWellLog,&ID ); +// } +int CDataImport::chakan(QList &wells,QString path,QStringList &wellfs,int &num,bool GetNum,DiDepthProgress *DepthProgress,char *pSuffix) +{ + QDir dir(path); + foreach(QFileInfo mfi ,dir.entryInfoList()) + { + if(mfi.isFile()) + { + if(pSuffix) { + if(mfi.fileName().lastIndexOf(pSuffix,-1,Qt::CaseInsensitive)==-1) continue; + } + else { + if(mfi.fileName().endsWith(".well",Qt::CaseInsensitive)) continue; + } + num++; + if(IsInvalidString(mfi.fileName())) { + wellfs.append(mfi.absoluteFilePath()); + continue; + } + if(GetNum) continue; + QString aa= mfi.completeBaseName()+"导入中"; + DepthProgress->SetShowName(aa.toStdString().c_str(),0); + DepthProgress->SetDepth(num,0); + CObjWell *pWell=ChangetoSlf(mfi.absoluteFilePath(),DepthProgress); + if(!pSuffix) { + if(pWell) wells.push_back(pWell); + else wellfs.append(mfi.absoluteFilePath()); + } + }else + { + if(mfi.fileName()=="." || mfi.fileName() == "..")continue; + chakan(wells,mfi.absoluteFilePath(),wellfs,num,GetNum,DepthProgress,pSuffix); + } + } + return num; +} +QList CDataImport::ImportWellTrajectorys(bool IsDir) +{ + CDataImport::flag_check=0; + CDataImport::flag1=-1; + CDataImport::m_flag=-1; + QList wells; + QString path; + if(IsDir) + { + static QString path1=::GetDataPath(); + path1=QFileDialog::getExistingDirectory(NULL,"选择目录",path1,QFileDialog::ShowDirsOnly); + if(path1.isEmpty()) return wells; + path=path1; + } + else { + // ConvertorManager::GetInstance().LoadAllConvertorPlugin(); + ConvertorManager &pManager=ConvertorManager::GetInstance(); + pManager.all=0; + QVectorvSuffix=pManager.GetSupportFileExtensions(); + QString fileSuffix("数据文件("); + for (int i=0;iGetObjectByType(GetClassID_WellsFolder()); + // if(pObj) { + // CBaseObject * pBaseObject = dynamic_cast(pObj); + // if(pBaseObject) { + // CDataTree *pDatatree=(CDataTree *)::GetProject()->m_pDataTree; + // if(pDatatree) { + // QTreeWidgetItem* pItem=pDatatree->GetTreeItem(pBaseObject); + // pDatatree->ClickObjectCommand(pItem); + // } + // pBaseObject->SetCheckState(Qt::Checked); + // CVecWindow *pWindow=CVecWindowCommand::GetCurrentWindow(); + // CVecDisplayObjectCommand::ClickObjectCommand( pBaseObject->GetPaiObject(),pWindow); + // } + // } + // } + QStringList lpsFile; + if(wellfs.size()) + { + for(int nIndex =0;nIndexsetMessage("成功导入"+QString::number(wells.size())+"个井次文件,"+QString::number(wellfs.size())+"个文件无法识别:\r\n"+wellfs.join("\r\n")); + // m_dialog->setTitle("提示"); + // m_dialog->exec(); + // delete m_dialog; + } + else { + // AfxMessageBox(QString::number(num)+"个文件全部导入成功!"); + QMessageBox::information(NULL, "提示",QString::number(num)+"个文件全部导入成功!"); + } + QList wells1; + return wells1; +} +QList CDataImport::ImportWells(QString path,QStringList &wellfs,int *pNum,bool IsTran) +{ + char szTemp[64]; + strcpy(szTemp, ".well"); + ImportWells(path,wellfs,szTemp,NULL,IsTran); + wellfs.clear(); + return ImportWells(path,wellfs,(char*)NULL,pNum,IsTran); +} +QString GetWellFileFromDir(QString path,QString &WellName,char *pSuffix) +{ + QDir dir(path); + foreach(QFileInfo mfi ,dir.entryInfoList()) + { + if(mfi.isFile()) + { + QString tem=mfi.absoluteFilePath(); + if(tem.endsWith(pSuffix,Qt::CaseInsensitive)) { + CLogIO tf; + if(tf.Open(tem.toStdString().c_str(),CSlfIO::OpenFlags::modeRead)) { + Slf_FILE_MESSAGE mess; + tf.GetFileMessage(mess); + WellName=mess.WellName; + return tem; + } + } + } + else + { + if(mfi.fileName()=="." || mfi.fileName() == "..")continue; + QString tt=GetWellFileFromDir(mfi.absoluteFilePath(),WellName,pSuffix); + if(tt.isEmpty()) return tt; + } + } + return ""; +} +QString GetWellFileFromCurrentDir(QString path,QString WellName,char *pSuffix) +{ + QDir dir(path); + foreach(QFileInfo mfi ,dir.entryInfoList()) + { + if(mfi.isFile()) + { + QString tem=mfi.absoluteFilePath(); + if(tem.endsWith(pSuffix,Qt::CaseInsensitive)) { + return tem; + } + } + else + { + if(mfi.fileName()=="." || mfi.fileName() == "..")continue; + QString tt=GetWellFileFromCurrentDir(mfi.absoluteFilePath(),WellName,pSuffix); + if(tt.isEmpty()) return tt; + } + } + return ""; +} +QList CDataImport::ImportWells(QString path,QStringList &wellfs,char *pSuffix,int *pNum,bool IsTran) +{ +////////////////////////// +// FIRST is dir + QList wells; + if(path.isEmpty()) return wells; + int num=0; + QStringList listFiles; + QFileInfo mfi(path); + if(!mfi.isDir()) { + if(!mfi.isFile()) return wells; + listFiles.append(path); + if(pSuffix) { + CObjWell *pWell=NULL; + foreach(QString filename,listFiles) + { + QString WellName; + if(filename.endsWith(".slf",Qt::CaseInsensitive)) + { + QString wellname1,path1; + GetWellNameAndPath(filename,wellname1,path1); + QString path2=GetLogdataPath(); + if(path1.indexOf(path2)<0) { + int a=1; + } + CLogIO tem; + if(tem.Open(filename.toStdString().c_str(),CSlfIO::OpenFlags::modeRead)){ + Slf_FILE_MESSAGE mess; + tem.GetFileMessage(mess); + WellName=mess.WellName; + } + } + if(WellName.isEmpty()) continue; + QString wellname,path1; + GetWellNameAndPath(filename,wellname,path1); + QString stem=path1+"\\"; + stem+=wellname; + stem+=pSuffix; + QDir ft(stem); + if(ft.exists()) { + pWell=ChangetoSlf(stem,NULL,IsTran); + continue; + } + path1=GetWellFileFromDir(filename,WellName,pSuffix); + if(path1.isEmpty()) continue; + pWell=ChangetoSlf(path1,NULL,IsTran); + } + return wells; + } + num=listFiles.size(); + } + else { + QString fileSuffix("数据文件("); + ConvertorManager &pManager=ConvertorManager::GetInstance(); + pManager.all=0; + if(pSuffix) { + QString sSuffix="*."; + sSuffix+=pSuffix; + fileSuffix.append(sSuffix); + } + else { + // ConvertorManager::GetInstance().LoadAllConvertorPlugin(); + QVectorvSuffix=pManager.GetSupportFileExtensions(); + for (int i=0;i=0) + { + listFiles.append(absolute_file_path); + } + else { + if(!pSuffix)wellfs.append(absolute_file_path); + } + } + } + if(listFiles.size()<1) return wells; + num=chakan(wells,path,wellfs,num,true,NULL,pSuffix); + if(num<1) return wells; + } + DiDepthProgress DepthProgress; + int progress=0; + QString sname="批量加载数据...";// + if(pSuffix) sname="遍历工区井.."; + DepthProgress.CreatProgress(0,num,sname.toStdString().c_str()); + foreach( QString wellFile,listFiles ) + { + QFileInfo w(wellFile); + if(w.isDir()) { + chakan(wells,wellFile,wellfs,progress,0,&DepthProgress,pSuffix); + } + else { + sname=w.completeBaseName()+"数据导入中"; + DepthProgress.SetShowName(sname.toStdString().c_str(),0); + DepthProgress.SetDepth(progress++,0); + // QString strCh(wellFile); // 汉字路径转换 + CObjWell *pWell=ChangetoSlf(wellFile/*strCh.toLocal8Bit()*/,&DepthProgress,IsTran); + if(!pSuffix) { + if(pWell) { + wells.push_back(pWell); + } + else wellfs.append(wellFile); + } + } + } + DepthProgress.DelProgress(); + if(pNum) *pNum=num; + return wells; +} +void CDataImport::LoadLayers(QStringList &listFiles) +{ + // CObjProject *pProj=::GetProject(); + // if(!pProj) return; + // if(!listFiles.size()) + // { + // QString path=GetLogdataPath();//GetProjectFolder() + // if(pProj) path=path+pProj->GetName(); + // QDir dir(path); + // if(!dir.exists()) + // { + // return; + // } + // dir.setFilter(QDir::NoDotAndDotDot |QDir::Files | QDir::NoSymLinks); + // QFileInfoList list = dir.entryInfoList(); + + // int file_count = list.count(); + // if(file_count <= 0) + // { + // return; + // } + // QStringList fileSuffix; + // fileSuffix.append("Layer"); + // QStringList string_list; + // listFiles.clear(); + // for(int i=0; i=0) + // { + // QString absolute_file_path = file_info.absoluteFilePath(); + // listFiles.append(absolute_file_path); + // } + // } + // } + // CBaseObject *pOSGObject =pProj->GetFolderObjectByClassID(GetClassID_GeoModelFolder(),true); + // PaiObject * pParentObject= pOSGObject->GetPaiObject(); + // QListlists; + // pParentObject->GetChildren(lists); + // for(int i=0;i(lists[i]); + // pParentObject->RemoveChild(pGeoLayerObj,true); + // } + // foreach( QString wellFile,listFiles ) { + // CObjGeoLayerData * pGeoLayerObj=new CObjGeoLayerData; + // QString sectionName,path0; + // GetWellNameAndPath(wellFile,sectionName,path0); + // if(!sectionName.isEmpty())pGeoLayerObj->SetName(sectionName); + // else pGeoLayerObj->SetName(wellFile); + // pParentObject->AddChild(pGeoLayerObj); + // } +} +void CDataImport::ImporttoTree(QString slfFileName,CLogIO *logio1,CObjWell *pWell,CObjWelllogRound* pWelllogRound,char *curvename) +{ +// // if(!pWelllogRound) return; +// CLogIO *logio=logio1; +// if(!logio) { +// logio=new CLogIO(); +// if(!logio->Open(slfFileName.toStdString().c_str(),CSlfIO::modeRead)) +// { +// delete logio; +// AppendConsole(pai::log::PAI_ERROR,"SLF文件打开失败,请检查!"); +// return; +// } +// } +// int i=logio->FindObjectName(curvename); +// if(i<0) { +// if(!logio1){ +// delete logio; +// } +// return; +// } + +// char aliasname[65]; +// aliasname[64]='\0'; +// logio->GetObjectName(i,curvename,NULL,aliasname); +// CObjWellLog * acurve; +// if(pWelllogRound) acurve=dynamic_cast(pWelllogRound->GetObjectByName(curvename)); +// else acurve=dynamic_cast(pWell->GetObjectByName(curvename)); +// if(dynamic_cast(acurve)) acurve=NULL; +// short curvetype=logio->GetObjectType(i); +// short Attribute=0,SubAttribute=0; +// logio->GetObjectAttribute(i,&Attribute,&SubAttribute); + +// if(acurve) { +// PaiObject *pP=acurve->GetParent(); +// if(dynamic_cast(pP)|| +// dynamic_cast(pP) +// ) acurve=NULL; +// else{ +// CDataTree *pTree=dynamic_cast(::GetProject()->m_pDataTree); +// if(pTree&&pTree->GetTreeItem(acurve)) +// { +// if(!logio1){ +// delete logio; +// } +// return; +// } +// } +// } + + +// PaiObject*pPai=NULL; +// if(curvetype==CURVE_OBJECT) +// { +// Slf_CURVE acurveinfo; +// logio->GetCurveInfo(i,&acurveinfo); +// int curveindex=logio->OpenCurve(curvename); +// if(curveindex<0) +// { +// if(!logio1){ +// delete logio; +// } +// return; +// } +// CObjWellLog * acurve=NULL; +// QStringList cnames=GetSimilarCurves("Trajectory"); +// if(!pWelllogRound&&cnames.contains(curvename)) { +// acurve=(CObjWellLog *) new CObjWellTrajectory(); +// } +// else { +// acurve=new CObjWellLog(); +// acurve->acurveinfo=acurveinfo; +// } +// acurve->m_ObjectType=CURVE_OBJECT; +// acurve->SetSlfFileName(slfFileName); +// acurve->SetName(QString::fromStdString(curvename)); +// acurve->SetAliasName(QString::fromStdString(aliasname)); +// acurve->SetUnit(QString::fromStdString(acurveinfo.Unit)); +// acurve->SetAliasUnit(QString::fromStdString(acurveinfo.AliasUnit)); +// acurve->SetDepthUnit(QString::fromStdString(acurveinfo.DepthUnit)); +// acurve->SetDepthAliasUnit(QString::fromStdString(acurveinfo.DepthHZUnit)); +// acurve->SetpropertyMin(acurveinfo.MinValue); +// acurve->SetpropertyMax(acurveinfo.MaxValue); +// acurve->SetRlev(acurveinfo.DepLevel); +// acurve->SetTopDepth(acurveinfo.StartDepth); +// acurve->SetBottomDepth(acurveinfo.EndDepth); +// acurve->GetLogCurve().SetCurveAlias(acurveinfo.AliasName); +// acurve->GetLogCurve().SetUnit(acurveinfo.Unit); +// acurve->GetLogCurve().SetSampleInterval(acurveinfo.DepLevel); +// acurve->AutoMatchFamily(); +// if(pWelllogRound)pWelllogRound->AddChild(acurve); +// else pWell->AddChild(acurve); +// pPai=acurve; +// } +// else if(curvetype==WAVE_OBJECT) +// { +// Slf_WAVE acurveinfo; +// logio->GetWaveInfo(i,&acurveinfo); +// CObjWellLog * acurve=new CObjWellLogWavefile(); +// acurve->m_ObjectType=WAVE_OBJECT; +// acurve->SetName(QString::fromStdString(curvename)); +// acurve->SetAliasName(QString::fromStdString(aliasname)); +// acurve->SetUnit(QString::fromStdString(acurveinfo.Unit)); +// acurve->SetAliasUnit(QString::fromStdString(acurveinfo.AliasUnit)); +// acurve->SetDepthUnit(QString::fromStdString(acurveinfo.DepthUnit)); +// acurve->SetDepthAliasUnit(QString::fromStdString(acurveinfo.DepthHZUnit)); +// acurve->SetSlfFileName(slfFileName); +// acurve->SetTopDepth(acurveinfo.StartDepth); +// acurve->SetBottomDepth(acurveinfo.EndDepth); +// acurve->SetRlev(acurveinfo.DepLevel); +// acurve->GetLogCurve().SetSampleInterval(acurveinfo.DepLevel); +// if(pWelllogRound)pWelllogRound->AddChild(acurve); +// else pWell->AddChild(acurve); +// pPai=acurve; +// } +// else if(curvetype==CARD_OBJECT) +// { +// if(SubAttribute==PARA_OBJECT) { +// CObjWellLog * acurve=new CObjWellLogINP(); +// acurve->m_ObjectType=CARD_OBJECT; +// acurve->SetName(QString::fromStdString(curvename)); +// acurve->SetAliasName(QString::fromStdString(aliasname)); +// acurve->SetSlfFileName(slfFileName); +// if(pWelllogRound)pWelllogRound->AddChild(acurve); +// else pWell->AddChild(acurve); +// } +// else { +// CObjWellLog * acurve=new CObjWellLogBIN(); +// acurve->m_ObjectType=CARD_OBJECT; +// acurve->SetName(QString::fromStdString(curvename)); +// acurve->SetAliasName(QString::fromStdString(aliasname)); +// acurve->SetSlfFileName(slfFileName); +// if(pWelllogRound)pWelllogRound->AddChild(acurve); +// else pWell->AddChild(acurve); +// } +// pPai=acurve; +// } +// else if(curvetype==FMT_OBJECT) +// { +// CObjWellLog * acurve=new CObjWellLogFMT(); +// acurve->m_ObjectType=FMT_OBJECT; +// acurve->SetName(QString::fromStdString(curvename)); +// acurve->SetAliasName(QString::fromStdString(aliasname)); +// acurve->SetSlfFileName(slfFileName); +// if(pWelllogRound)pWelllogRound->AddChild(acurve); +// else pWell->AddChild(acurve); +// pPai=acurve; +// } +// else if(curvetype==TDT_OBJECT) +// { +// CObjWellLog * acurve=new CObjWellLogTDT(); +// acurve->m_ObjectType=TDT_OBJECT; +// acurve->SetName(QString::fromStdString(curvename)); +// acurve->SetAliasName(QString::fromStdString(aliasname)); +// acurve->SetSlfFileName(slfFileName); +// if(pWelllogRound)pWelllogRound->AddChild(acurve); +// else pWell->AddChild(acurve); +// pPai=acurve; +// } +// else if(curvetype>CARD_OBJECT||curvetype==0) +// { +// if(pWelllogRound&&strcmp(curvename,"井基本信息")==0) return; +// CObjWellLog * acurve=new CObjWellLogTABLE(); +// acurve->m_ObjectType=TABLEE_OBJECT; +// acurve->SetName(QString::fromStdString(curvename)); +// acurve->SetAliasName(QString::fromStdString(aliasname)); +// acurve->SetSlfFileName(slfFileName); +// if(pWelllogRound)pWelllogRound->AddChild(acurve); +// else pWell->AddChild(acurve); +// pPai=acurve; +// } +// CObjWellLog *pLog=dynamic_cast(pPai); +// if(pLog) pLog->SetWell(pWell); +// if(!logio1){ +// delete logio; +// } +// return; +} +CObjWell *CDataImport::ChangetoSlf(QString wellFile1,DiDepthProgress *pDepthProgress) +{ + return ChangetoSlf(wellFile1,pDepthProgress,true); +} +CObjWell *CDataImport::ChangetoSlf(QString wellFile1,DiDepthProgress *pDepthProgress,bool IsTran) +{ + static QString temp = ::GetConfPath()+"data.ini"; + QSettings settings(temp,QSettings::IniFormat,0); + settings.setIniCodec(QTextCodec::codecForName("UTF-8")); + QStringList serials=settings.value("wellType",0).toStringList(); + CObjWell *pWell(NULL); + if(pDepthProgress) pDepthProgress->DelProgress(1); + + QString filename=wellFile1; + QString slffilename=filename; + +/////////////////// +//识别是否为系统格式,否则启动转换模块转换为系统格式 + if(!filename.endsWith(".slf",Qt::CaseInsensitive)&& + !filename.endsWith(".well",Qt::CaseInsensitive)&&IsTran) + { + QString logdata=GetLogdataPath()+m_prjname/*::GetProject()->GetName()*/; + logdata.replace('\\','/'); + logdata.replace("//","/"); + filename.replace("//","/"); + filename.replace("\\","/"); + if(filename.indexOf(logdata,0,Qt::CaseInsensitive)>-1) return pWell; + ConvertorManager &pManager=ConvertorManager::GetInstance(); + //按目录加载原始数据时解编入口 + // QString strCh(filename); // 汉字路径转换 + QString slfName=ConvertorWellLogFiles(pManager,filename/*strCh.toLocal8Bit().data()*/,pDepthProgress); + if(slfName!=""&&slfName!="abandoned"){//2020.3.19 放弃加载的文件名如何加入到提示中 + pWell=ChangetoSlf(slfName,pDepthProgress);//whp add 2019.12.12 + } + return pWell; + } + else { + QString wellname1,path1; + // QString strCh(filename); // 汉字路径转换 + GetWellNameAndPath(filename/*strCh.toLocal8Bit().data()*/,wellname1,path1); + QString prjname = m_prjname; + // if(GetProject()) prjname=GetProject()->GetName(); + QString path2="LogData\\"+prjname; + QString path3="LogData/"+prjname; + path1=path1.replace("\\\\","\\"); + path1=path1.replace("//","/"); + int a=path1.indexOf(path2,0,Qt::CaseInsensitive); + int b=path1.indexOf(path3,0,Qt::CaseInsensitive); + if(a<0&&b<0) { + QFile dd; + path2=GetLogdataPath(); + path2+=prjname+"\\#"+wellname1; + CreateDir((char *)path2.toStdString().c_str()); + path2+="\\"+wellname1+".slf"; + dd.copy(filename,path2); + slffilename=path2; + filename=path2; + } + + int iX=-1,iY=-1,iZ=-1; + CObjWelllogRound* pWelllogRound=NULL; + ///从文件内部读取井名 + CLogIO * logio=new CLogIO(); + if(!logio->Open(slffilename.toStdString().c_str(),CSlfIO::modeRead)) + { + delete logio; + QString aa=slffilename+"文件打开失败,请检查!"; + // AppendConsole(pai::log::PAI_ERROR,aa); + return pWell; + } + //说明从项目或者井节点发起attachSLF,需要读取slf获得井名和井次信息 + QString wellname=""; + QString wellRoundname=""; + Slf_FILE_MESSAGE mssage; + logio->GetFileMessage(mssage); + wellname=mssage.WellName; + wellname=wellname.toUpper(); + //辨别井名是否有效,无效则采用文件名 + QFileInfo fileInfo(filename); + QString strWellName = fileInfo.completeBaseName(); + strWellName=strWellName.toUpper(); + if (wellname.isEmpty()||wellname.length()>64||wellname.indexOf('&')>-1) + { + wellname=strWellName.toStdString().c_str(); + int len=strlen(strWellName.toStdString().c_str()); + if(len>sizeof(mssage.WellName)) len=sizeof(mssage.WellName); + strncpy(mssage.WellName,strWellName.toStdString().c_str(),len); + mssage.WellName[len]=0; + logio->SetFileMessage(mssage); + } + wellname=wellname.toUpper(); + // if(!GetProject() ) { + // delete logio; + // return NULL; + // } + // //挂接到树 + // PaiObject *pObject=GetProject()->GetObjectByName( wellname,2);//GetClassID_Well()); + // pWell = dynamic_cast( pObject ); + // if(!pWell) { + // CObjWellTrack *pWellTrack = dynamic_cast( pObject); + // if(pWellTrack&&pWellTrack->GetWelllogRound()) { + // pWell=pWellTrack->GetWelllogRound()->GetWell(); + // } + // } + if(!pWell) { + // pWell = CDataImport::GetWellByName(wellname); + // CDataTree *pTree=(CDataTree *)GetDataTree(); + // if(pTree) { + // PaiObject *pJ=GetProject()->GetObjectByType(GetClassID_WellsFolder()); + // QTreeWidgetItem* pItemF=pTree->GetTreeItem(dynamic_cast(pJ)); + // QTreeWidgetItem* pItem=pTree->GetTreeItem(pWell ); + // QTreeWidgetItem* pItemF1=NULL; + // if(pItem)pItemF1=pItem->parent(); + // if(pItemF1!=pItemF) { + // if(pItemF1)pItemF1->removeChild(pItem); + // if(pItemF)pItemF->addChild(pItem); + // } + // } + // if(!pWell) { + // delete logio; + // return NULL; + // } + + if( !pWell ) + { + pWell = new CObjWell(); + pWell->SetName( strWellName ); + } + + QString welln; + if(filename.endsWith(".slf",Qt::CaseInsensitive)) + { + QString dirpath=GetLogdataPath()+m_prjname/*GetProject()->GetName()*/; + + char szTemp[64]; + strcpy(szTemp, ".well"); + welln=GetWellFileFromDir(dirpath,wellname, szTemp); + if(welln.isEmpty()||(!pWell->GetName().isEmpty()&&wellname!=pWell->GetName())) { + wellname=pWell->GetName(); + int index=filename.lastIndexOf("\\"); + int index1=filename.lastIndexOf("/"); + if(index1>index) index=index1; + welln=GetWellFileFromCurrentDir(filename.left(index+1),wellname,szTemp); + if(welln.isEmpty()) { + welln=filename.left(index+1)+wellname+".well"; + CreateWellFile(logio,mssage,welln,pWell); + // CDataTree::SetTree(welln,pWell,NULL,(DepthProgress *)pDepthProgress,1); + } + } + } + else if(filename.endsWith(".well",Qt::CaseInsensitive))welln=filename; + pWell->SetWellFileName(welln); + } + wellRoundname=strWellName; + //查找是否已经存在该井和井次 + int isrefress=0; + if(!filename.endsWith(".well",Qt::CaseInsensitive)) { + pWelllogRound=dynamic_cast( pWell->GetObjectByName(wellRoundname,GetClassID_WellLogRound())); + if(pWelllogRound) + { + QString cs=pWelllogRound->GetSlfFileName(); + cs.replace('\\','/'); + cs.replace("//","/"); + QString cs1=filename; + cs1.replace('\\','/'); + cs1.replace("//","/"); + if(cs1.compare(cs,Qt::CaseInsensitive)!=0) { + QString cs2=cs+"\n"; + cs2+=cs1+"为同一井次文件!\n"; + cs2+="按重名文件加载!"; + // AppendConsole(pai::log::PAI_ERROR,cs2); + wellRoundname+="_重名文件"; + strcpy(mssage.Item,wellRoundname.toStdString().c_str()); + pWelllogRound=NULL;//return 0; + } + } + if(!pWelllogRound) + { + // pWelllogRound=new CObjWelllogRound(); + // pWelllogRound->SetWell(pWell); + // pWell->AddChild(pWelllogRound); + + // pWell->SetCurrentObjWellRound(pWelllogRound); + if(strstr(mssage.Item,"常规")) { + strncpy(mssage.Item,wellRoundname.toStdString().c_str(),sizeof(mssage.Item)); + mssage.Item[strlen(wellRoundname.toStdString().c_str())]=0; + } + if(strlen(mssage.Item)) { + wellRoundname=mssage.Item; + } + else { + int len=strlen(wellRoundname.toStdString().c_str()); + if(len>sizeof(mssage.Item)) len=sizeof(mssage.Item); + strncpy(mssage.Item,wellRoundname.toStdString().c_str(),len); + mssage.Item[len]=0; + logio->SetFileMessage(mssage); + } + // wellRoundname=wellRoundname.toUpper(); + // pWelllogRound->SetName(wellRoundname); + // pWelllogRound->SetSlfFileName(filename); + } + else { + isrefress=true; + } + } + QString temp = ::GetConfPath()+"data.ini"; + QSettings settings(temp,QSettings::IniFormat,0); + settings.setIniCodec(QTextCodec::codecForName("UTF-8")); + QStringList serials=settings.value("wellType",0).toStringList(); + int type=serials.indexOf(mssage.WellType); + + if(type>-1) pWell->SetWellSymbol("well" + QString::number(type) + ".png"); + + //else isrefress=true; + float Altitude=mssage.Altitude; + float X_COORDINATE=mssage.Xcoor; + float Y_COORDINATE=mssage.Ycoor;//井斜x,y坐标 + WellHead &mWellHead=pWell->GetWellHead(); + if(mssage.Kelly==9999999) mssage.Kelly=0; + if(mssage.Kelly==-9999) mssage.Kelly=0; + if(mssage.Kelly==-99999) mssage.Kelly=0; + if(mssage.azca) mWellHead.azca=mssage.azca; + if(mssage.Kelly)mWellHead.dEle=ConvertDataByFloat(mssage.Kelly).toFloat(); + if(mssage.WellName[0])mWellHead.wellName=mssage.WellName; + if(X_COORDINATE)mWellHead.x=X_COORDINATE; + if(Y_COORDINATE)mWellHead.y=Y_COORDINATE; + if(Altitude)mWellHead.earthEle=Altitude; + if(mssage.X0)mWellHead.dxe=mssage.X0; + if(mssage.Y0)mWellHead.dyn=mssage.Y0; + if(mssage.TVD)mWellHead.tvd=mssage.TVD; + Slf_CURVE acurveinfo; + memset(&acurveinfo,0,sizeof(Slf_CURVE)); + int curveCount=logio->GetObjectCount(); + if(isrefress) { + logio->DiscardObject("X"); + logio->DiscardObject("Y"); + logio->DiscardObject("Z"); + logio->DiscardObject("TVD"); + } + iX=logio->OpenCurve("X"); + iY=logio->OpenCurve("Y"); + iZ=logio->OpenCurve("Z"); + if(iX>-1) logio->GetCurveInfo(iX,&acurveinfo); + + mWellHead.depth=acurveinfo.StartDepth; + if(mWellHead.tvd==0&&acurveinfo.StartDepth!=0)mWellHead.tvd=acurveinfo.StartDepth; + mWellHead.z=mWellHead.earthEle-mWellHead.tvd+mWellHead.dEle; + mWellHead.startDepth=acurveinfo.StartDepth; + mWellHead.endDepth=acurveinfo.EndDepth; + mWellHead.rlev=acurveinfo.DepLevel; + int iDepth=-1; + iDepth=logio->OpenCurve("TVD"); + if(iX>=0&&iY>=0&&iZ>=0&&iDepth>=0) { + logio->GetCurveInfo(iX,&acurveinfo); + if(acurveinfo.DepLevel==0) { + logio->DiscardObject(iX); + logio->DiscardObject(iY); + logio->DiscardObject(iZ); + logio->DiscardObject(iDepth); + delete logio; + pWell->ComputeTrajectory(pWell,filename); + } else { + delete logio; + pWell->SetDepth(pWell); + } + } + else { + delete logio; + pWell->ComputeTrajectory(pWell,slffilename); + } + logio=new CLogIO(); + if(!logio->Open(slffilename.toStdString().c_str(),CSlfIO::modeRead)) + { + delete logio; + QString aa=slffilename+"文件打开失败,请检查!"; + // AppendConsole(pai::log::PAI_ERROR,aa); + return pWell; + } + curveCount=logio->GetObjectCount(); + char* curvename=new char[65]; + curvename[64]='\0'; + char* aliasname=new char[65]; + aliasname[64]='\0'; + for(int i=0;iGetObjectName(i,curvename,NULL,aliasname); + if(!logio->IsObject(i)) { + logio->DiscardObject(i); + continue; + }; + if(logio->GetObjectStatus(i)!=OBJECT_NORMAL) continue; + short curvetype=logio->GetObjectType(i); + short Attribute=0,SubAttribute=0; + logio->GetObjectAttribute(i,&Attribute,&SubAttribute); + if(curvetype==CURVE_OBJECT) + { + Slf_CURVE acurveinfo; + logio->GetCurveInfo(i,&acurveinfo); + if(acurveinfo.DepLevel!=0&&(acurveinfo.EndDepth-acurveinfo.StartDepth>0)) + { + if(acurveinfo.MaxValue==acurveinfo.MinValue||acurveinfo.MaxValue==-99999||acurveinfo.MaxValue==-9999||acurveinfo.MinValue==999999||acurveinfo.MinValue==999999||acurveinfo.MinValue==99999||acurveinfo.MinValue==99999||acurveinfo.MinValue==-9999){ + int curveindex=logio->OpenSlfTable(i,-1); + if(curveindex>-1) + { + MyDataTypeEnum vVdl; + DWORD count=(acurveinfo.EndDepth-acurveinfo.StartDepth)/acurveinfo.DepLevel+1.5; + DWORD len=count*acurveinfo.CodeLen; + acurveinfo.MinValue=99999999; + acurveinfo.MaxValue=-99999999; + if(acurveinfo.CodeLen==8) acurveinfo.MinValue=99999999; + vVdl.vchar=new char[len]; + len=logio->ReadCurve(curveindex, acurveinfo.StartDepth,count,(void *)vVdl.vchar); + if(!len) { + QString cs; + char buf[1000]; + sprintf(buf,"%s %f-%f",acurveinfo.Name,acurveinfo.StartDepth,acurveinfo.EndDepth); + cs=buf; + int flag = QMessageBox::warning(NULL,"提示",QString(cs+"\n曲线信息异常!删除该曲线可能需要较长时间,建议复制正常曲线等信息到新文件,然后删除此文件。是否此时直接将该曲线删除?"),QMessageBox::Yes,QMessageBox::No); + if(flag==QMessageBox::Yes) logio->DiscardObject(i); + delete vVdl.vchar; + continue; + } + for(int kk=0;kkGetData(acurveinfo.RepCode,&vVdl.vchar[kk*acurveinfo.CodeLen],buf); + if(_isnan(temp)||!_finite(temp)) continue; + + if(acurveinfo.MaxValuetemp) if(temp!=-9999.0&&temp!=-999.25&&temp!=-99999.0)acurveinfo.MinValue=temp; + } + logio->SetCurveInfo(curveindex,&acurveinfo); + delete vVdl.vchar; + } + } + } + else if(acurveinfo.DepLevel==0||acurveinfo.StartDepth<-100000||acurveinfo.StartDepth>100000) + { + QString cs; + char buf[1000]; + sprintf(buf,"%s %f-%f",acurveinfo.Name,acurveinfo.StartDepth,acurveinfo.EndDepth); + cs=buf; + int flag = QMessageBox::warning(NULL,"提示",QString(cs+"\n曲线信息异常!删除该曲线可能需要较长时间,建议复制正常曲线等信息到新文件,然后删除此文件。是否此时直接将该曲线删除?"),QMessageBox::Yes,QMessageBox::No); + if(flag==QMessageBox::Yes) logio->DiscardObject(i); + continue; + } + } + } + delete []curvename; + delete []aliasname; + DepthProgress *pd=new DepthProgress; + pd->CreatProgress(0,2,"正在整理数据..."); + pd->SetDepth(1); + delete logio; + delete pd; +///////////////////// + pai::ios::welllog::Well& topwell=pWell->GetDBWell(); + topwell.SetTopDepth(pWell->GetTopWellLogDepth()); + topwell.SetBottomDepth(pWell->GetBottomWellLogDepth()); + if(X_COORDINATE)topwell.SetXCode(X_COORDINATE); + if(Y_COORDINATE)topwell.SetYCode(Y_COORDINATE); + if(mssage.Altitude)topwell.SetAsl(mssage.Altitude); + if(mssage.Kelly)topwell.SetBsl(ConvertDataByFloat(mssage.Kelly).toFloat()); + // topwell.SetItem(mssage.Item); + + ///////////// + topwell.LoadMeesge(filename); + // if(pWelllogRound&&pWelllogRound->GetChildrenCount()>2) { + // isrefress=1; + // } + // if(isrefress) { + // QString slfFileName=filename; + // CDataTree::SetTree(slfFileName,pWell,pWelllogRound,(DepthProgress *)pDepthProgress,1); + // } + } + + return pWell; +} +void CDataImport::ImportCoreImage() +{ + // QStringList listFiles=GetFileNames("选择文件","图片文件(*.jpg)"); + // CObjCoreImage* pCoreImage = new CObjCoreImage(); + + // std::vectorvCoreImage; + // foreach( QString imageFile,listFiles ) + // { + // //得到或创建well + // QFileInfo fileInfo(imageFile); + // QString strWellName = fileInfo.completeBaseName(); + + + // CoreImage coreImage; + + // LinePro linePro; + // linePro.lineColor = QColor(Qt::black); + // linePro.lineWidth = 1; + // linePro.lineStyle = Qt::SolidLine; + + // coreImage.m_imageFile = imageFile; + // coreImage.m_startDepth = 0; + // coreImage.m_endDDepth = 0; + // coreImage.m_leftDepth = 0; + // coreImage.m_rightDepth = 0; + // coreImage.m_border = linePro ; + // //pCoreImage->m_childrenItems.push_back(coreImage); + // vCoreImage.push_back(coreImage); + + // } + // pCoreImage->SetImageObjects( vCoreImage ); + + // if(listFiles.size() > 0) + // { + // pai::gui::CoreImageConfigDialog* pDialog = new pai::gui::CoreImageConfigDialog(); + // pDialog->SetCoreImages( pCoreImage ); + // if(pDialog->exec() == QDialog::Accepted) + // { + // //TODO这里要找到当前曲线,不可写死 + // CObjWell *pWell = CDataImport::GetWellByName( "A10" ); + // pWell->AddChild( pCoreImage ); + // } + // } +} + +void CDataImport::ImportBitmaps() +{ + // QStringList listFiles=GetFileNames("选择文件","图片文件(*.jpg)"); + // qsrand(qrand()); + // foreach( QString imageFile,listFiles ) + // { + + // // create Image object + // int nWidth = qBound( 0,qrand(),1000 ); + // int nHeight = nWidth ; + // CObjBitmap *pImageObject = new CObjBitmap( QRectF( qBound( 0,qrand(),1000 ),qBound( 0,qrand(),1000 ), + // nWidth,nHeight ),imageFile ); + + // // set name + // QFileInfo fileInfo( imageFile ); + // pImageObject->SetName( fileInfo.completeBaseName() ); + + // // add to project + // if( ::GetProject() ) + // { + // ::GetProject()->AddChild( pImageObject ); + // } + // } +} + +void CDataImport::ImportConvertorWellLogFiles(QString wellname,QString wellroundname) +{ +// AppendConsole(pai::log::PAI_INFO,QObject::tr("解编模块启动中...")); +// ConvertorManager &pManager=ConvertorManager::GetInstance(); +// QVectorvSuffix=pManager.GetSupportFileExtensions(); +// // if (vSuffix.empty()) +// // return; +// QString fileSuffix("数据文件("); +// for (int i=0;i1) { +// DepthProgress.CreatProgress(0,listFiles.size(),"数据加载",0); +// int progress=0; +// char aa[1000]; +// //whp change 2019.12.08 for 输出成功加载的文件个数 +// int errNum=0,okNum=0,abandonedNum=0;//2020.3.19 放弃加载; +// QStringList errFile,abandonedFile;//2020.3.19 +// //whp add 2020.3.19 +// CDataImport::flag1=-1; +// CDataImport::m_flag=-1; +// CDataImport::flag_check=0;// +// foreach(QString iFile,listFiles ) { +// progress++; +// sprintf(aa,"待加载数据文件%d个,当前正在加载:%s",listFiles.size(),iFile.toStdString().c_str()); +// DepthProgress.SetShowName(aa,0); +// DepthProgress.SetDepth(progress,0); +// //多个测井数据加载时解编入口 +// QString slfName=ConvertorWellLogFiles(pManager,iFile,&DepthProgress); +// if(slfName=="") +// { +// errNum++; +// errFile.append(iFile); +// } +// else if(slfName=="abandoned")//2020.3.19 放弃加载 +// { +// abandonedNum++; +// abandonedFile.append(iFile); +// } +// else +// { +// CObjWell* pWell=ChangetoSlf(slfName,&DepthProgress);//whp add 2019.12.12 +// if(!pWell) { +// errNum++; +// errFile+=iFile; +// errFile+="\r\n"; +// } +// } +// } +// DepthProgress.DelProgress(); +// CObjProject *pPrj=::GetProject(); +// if(pPrj) { +// PaiObject *pObj=pPrj->GetObjectByType(GetClassID_WellsFolder()); +// if(pObj) { +// CBaseObject * pBaseObject = dynamic_cast(pObj); +// if(pBaseObject) { +// CDataTree *pDatatree=(CDataTree *)::GetProject()->m_pDataTree; +// if(pDatatree) { +// QTreeWidgetItem* pItem=pDatatree->GetTreeItem(pBaseObject); +// pDatatree->ClickObjectCommand(pItem); +// } +// pBaseObject->SetCheckState(Qt::Checked); +// CVecWindow *pWindow=CVecWindowCommand::GetCurrentWindow(); +// CVecDisplayObjectCommand::ClickObjectCommand( pBaseObject->GetPaiObject(),pWindow); +// } +// } +// } + +// //2020.3.17需要修改 +// QString mes=""; +// if(errNum||abandonedNum) +// { +// mes="成功导入"+QString::number(listFiles.size()-errNum-abandonedNum)+"个文件;"; +// if(abandonedNum) mes+="放弃导入"+QString::number(abandonedNum)+"个数据文件;"; +// if(errNum)mes+="\r\n"+QString::number(errNum)+"个数据文件无法识别:\r\n"+errFile.join("\r\n"); +// CDialog* m_dialog=new CDialog(); +// m_dialog->setMessage(mes); +// m_dialog->setTitle("提示"); +// m_dialog->exec(); +// delete m_dialog; +// } +// else { +// mes=QString::number(listFiles.size())+"个文件全部导入成功!"; +// QMessageBox::about(NULL,"提示",mes); +// } +// } +// else { +// DepthProgress.CreatProgress(0,1,"数据加载",0); +// DepthProgress.SetDepth(1,0); +// QString us=listFiles[0].toLower(); +// QFileInfo currentfile(us); +// us=currentfile.suffix(); +// // if(us.indexOf("slf")>-1||us.indexOf("wis")>-1) { +// //whp add 2019.12.09 for .well +// if(us.indexOf("slf")>-1||us.indexOf("well")>-1) { +// ChangetoSlf(listFiles[0]); +// QString message=listFiles[0]+"解编结束"; +// AppendConsole(pai::log::PAI_INFO,QObject::tr(message.toStdString().c_str())); +// return; +// } +// DepthProgress.SetShowName("类型识别",0); +// QVector vConvertor=pManager.GetSupportConvertors(listFiles[0],&DepthProgress); +// // if (vConvertor.empty()) return ; +// if (vConvertor.empty()) +// { +// QMessageBox::information(NULL,"无法识别的文件",listFiles[0]); +// return ; +// } +// ImportDataDialog *pDialog = new ImportDataDialog(NULL,wellname,wellroundname); +// pDialog->DisplayFileInformationAreaData(vConvertor,listFiles[0]); +// ::GetObjectEvent().OnActiveConvertorWindow( pDialog ); +// } +// AppendConsole(pai::log::PAI_INFO,QObject::tr("解编模块解编结束")); +} +//whp change 2019.12.08 for 输出成功加载的文件个数 +//void +//bool +//whp add 2020.2.28 for 检查井名文件名是否存在,若存在,获取井次全路径文件名 +QString CDataImport::GetOutName(QString wellname,QString filename) +{ + // CObjProject *pPrj=::GetProject(); + // PaiObject *pObj=pPrj->GetObjectByType(GetClassID_WellsFolder()); + // QList childs; + // pObj->GetChildren(childs); + // int wellnum=childs.count(); + // foreach(PaiObject *pChild,childs) + // { + // CObjWell *pWell=dynamic_cast(pChild); + // if(pWell) + // { + // QString well=pWell->GetName().toUpper(); + // if(well==wellname.toUpper()) + // { + // QList childsRound; + // pChild->GetChildren(childsRound); + // foreach(PaiObject *pChildRound,childsRound) + // { + // CObjWelllogRound *pWellRound=dynamic_cast(pChildRound); + // if(pWellRound) + // { + // QString file=pWellRound->GetName().toUpper(); + // if(file==filename.toUpper()) + // { + // QString outname=pWellRound->GetSlfFileName(); + // return outname; + // } + // } + // } + // } + // } + // } + return ""; + } +////whp change 2020.2.28 for 检查井名、文件名是否存在,若存在,使用已存在的输出路径(主要针对更名后的井文件) +QString CDataImport::ConvertorWellLogFiles(ConvertorManager &pManager,QString wellname,DiDepthProgress *DepthProgress) +{ + QString iFile=wellname; + QString us1=iFile.toLower(); + QFileInfo currentfile(us1); + QString us=currentfile.suffix(); + //whp add 2019.12.09 for .well + if(us.indexOf("slf")>-1||us.indexOf("well")>-1) { + //ChangetoSlf(iFile,DepthProgress); + //return 1; + return iFile;//whp change 2019.12.12 + } + QVector vConvertor=pManager.GetSupportConvertors(iFile,DepthProgress); + if(vConvertor.size()>1) { + QString s=iFile+"解编模块不唯一,无法批量解编!"; + // AppendConsole(pai::log::PAI_INFO,s); + return "";//0;//whp change 2019.12.12 + } + if(vConvertor.size()==0) { + QString s=iFile+"无法识别数据类型,无法解编!"; + // AppendConsole(pai::log::PAI_INFO,s); + return "";//0;//whp change 2019.12.12 + } + InterIConvertor *v=(InterIConvertor *)vConvertor[0]; + QList ObjWellLogs= v->GetWellLogList(iFile); + int c=ObjWellLogs.size(); + for(int i=0;iGetWellInfo(); + MyWelllogRound* r=v->GetWellLogRoundInfo(); + QString WellName=well->GetName().c_str();//取的谁的名字?跟踪遇见的都是空 + + // if(WellName==""){//应用当前选中井名 + // QAction* ImportConvertorWellLogDataAct= ::GetGlobalCommand().GetAction(GetCmdID_ImportConvertorWellLogData(),true) ; + // WellName = ImportConvertorWellLogDataAct->property("CurrentWellName").value(); + // } + + //whp change 2020.2.18 for 汉字井名转换有乱码 + if(WellName=="") WellName=QString(QString::fromLocal8Bit(v->FILE_MESSAGE.WellName)); //QLatin1String(v->FILE_MESSAGE.WellName);//for 带有井名信息的原始数据,如ASCII + //该语句不可用,发现clis文件中的井名 + //add end + if(WellName=="") WellName=r->GetName().c_str(); + QString strWellName; + // CObjProject *pProject = ::GetProject(); + // if(pProject != NULL) + // { + // strWellName = pProject->GetName(); + // } + strWellName = m_prjname; + QString dir0,dir=::GetLogdataPath();//whp add 2020.2.19 for 非法井名,无法产生井目录 + QDir w; + if(!strWellName.isEmpty()) { + dir=dir+strWellName; + bool ok=w.mkdir(dir); + dir+=QDir::separator(); + } + QString tempWellName; + QString filename=r->GetName().c_str(); + if(filename=="") filename=WellName; + //whp add 2020.3.3 删除井名中的空格 + WellName.replace(" ",""); + WellName=WellName.toUpper(); + //whp add 2020.3.3 删除".zh"之类的后缀之类的后缀 + QFileInfo temDir(WellName); + WellName=temDir.baseName(); + +////// + char *pmessage=v->GetfileMessage(); + if(pmessage) { + char *p=pmessage; + p+=strlen(p)+1; + if(strlen(p)>0&&strlen(p)<20) { + p+=strlen(p)+1; + p+=strlen(p)+1; + tempWellName=p; + } + else tempWellName=""; + } + //whp change 2020.2.18 for 文件名中有一个以上的“."时,如3Oq.ZH.716 + //QFileInfo temDir(filename); + //if(tempWellName=="") tempWellName=temDir.completeBaseName(); + if(tempWellName=="") tempWellName=filename; + QString outputfilename=GetOutName(WellName,tempWellName); + if(outputfilename=="") + { + dir0=dir;//whp add 2020.2.19 for 非法井名,无法产生井目录 + dir+="#"+WellName; + bool ok=w.mkdir(dir); + //whp add 2020.2.19 for 非法井名,无法产生井目录 + QDir mdir(dir); + if(mdir.exists())ok=1; + if(!ok) + { + dir=dir0; + QFileInfo temDir(iFile); + WellName=temDir.completeBaseName(); + outputfilename=GetOutName(WellName,tempWellName); + if(outputfilename=="") + { + dir+="#"+WellName; + ok=w.mkdir(dir); + if(!ok) + { + QString mes="解编"+iFile+"文件时,产生井文件目录失败:\r\n井文件目录:"+dir; + QMessageBox::about(NULL, QObject::tr("警告"), mes); + return ""; + } + outputfilename=dir; + outputfilename+=QDir::separator(); + outputfilename+=tempWellName; + outputfilename+=".slf"; + } + } + else outputfilename=dir+QDir::separator()+tempWellName+".slf"; + } + char *outfile = new char[outputfilename.toStdString().size()+200]; + strcpy(outfile, outputfilename.toStdString().c_str()); + +/* //whp add 2019.12.10 for 如果文件存在,提示是否覆盖 + QFileInfo mfi(outfile); + //2020.3.19 + if(mfi.isFile()) + { + + if(CDataImport::flag_check)//&&CDataImport::flag1!=-1) + { + if(CDataImport::flag1==QMessageBox::Cancel)return "abandoned";//放弃加载 + else if(CDataImport::flag1==QMessageBox::No){ + QDir ss;ss.remove(outfile); + } + } + else //if(mfi.isFile()) + {//whp change 2020.2.28 + QMessageBox box(QMessageBox::Warning,"提示","输出文件"+QString::fromLocal8Bit(outfile)+"已存在!"); + //box.setStandardButtons (QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel|QMessageBox::YesAll|QMessageBox::NoAll|QMessageBox::Apply); + box.setStandardButtons (QMessageBox::Yes|QMessageBox::Cancel|QMessageBox::YesAll|QMessageBox::Apply); + box.setButtonText (QMessageBox::Yes,QString("覆盖当前"));//\r\n已存在文件")); + // box.setButtonText (QMessageBox::No,QString("重建\r\n当前文件")); + box.setButtonText (QMessageBox::YesAll,QString("覆盖所有"));//\r\n已存在文件")); + // box.setButtonText (QMessageBox::NoAll,QString("全部\r\n执行重建")); + box.setButtonText (QMessageBox::Cancel,QString("放弃当前"));//\r\n文件解编")); + box.setButtonText (QMessageBox::Apply,QString("放弃所有"));//\r\n已存在文件解编")); + int ret=box.exec(); + if(ret==QMessageBox::YesAll||ret==QMessageBox::Yes) CDataImport::flag1 =QMessageBox::Yes; + //if(ret==QMessageBox::NoAll||ret==QMessageBox::No) CDataImport::flag1 =QMessageBox::No; + if(ret==QMessageBox::Cancel||ret==QMessageBox::Apply) CDataImport::flag1 =QMessageBox::Cancel; + //if(ret==QMessageBox::NoAll||ret==QMessageBox::YesAll||ret==QMessageBox::Apply) CDataImport::flag_check=1; + if(ret==QMessageBox::YesAll||ret==QMessageBox::Apply) CDataImport::flag_check=1; + if(CDataImport::flag1==QMessageBox::Cancel)return "abandoned";//放弃加载 + //else if(CDataImport::flag1==QMessageBox::No)QDir ss;ss.remove(outfile); + } + } + //add end*/ + char *logfilename = new char[iFile.toStdString().size()+1]; + + strcpy(logfilename, iFile.toStdString().c_str()); + + int l=strlen(outfile)+1; + double x=well->GetXCode(); + strcpy(&outfile[l],QString::number(x).toStdString().c_str());//x坐标 + double y=well->GetYCode(); + l+=strlen(&outfile[l])+1; + strcpy(&outfile[l],QString::number(y).toStdString().c_str());//y坐标 + + QString top="-99999.";//QString::number(r->GetTopDepth()); + l+=strlen(&outfile[l])+1; + strcpy(&outfile[l],top.toStdString().c_str());//y坐标 + + QString bottom="-99999.";//QString::number(r->GetBottomDepth()); + l+=strlen(&outfile[l])+1; + strcpy(&outfile[l],bottom.toStdString().c_str());//y坐标 + l+=strlen(&outfile[l])+1; + int iRow=v->GetWellCurves().Curve_Num; + *(int *)&outfile[l]=iRow; + //TODO + vector OutCurveNo; + vector OutCurve=v->GetCurveNames(); + vector strChineseName=v->GetCurveNames(); + vector strUnit=v->GetCurveUnits(); + for(int i=0;i ExistCurveNo; + vector ExistCurve; + int ExistCurveNum=0; + logio->Open(qss.toStdString().c_str(),CSlfIO::modeRead); + for(int i=0;iFindObjectName(OutCurve[i]); + if(logio->FindObjectName(OutCurve[i],-1,-1,OBJECT_NORMAL)<0)continue; + ExistCurve.push_back(OutCurve[i]); + ExistCurveNo.push_back(i); + } + if(ExistCurve.size()>0)//输出对象是否存在 + { + if(!CDataImport::flag_check) + { + QString name=qss; + int index=name.lastIndexOf("/"); + int index1=name.lastIndexOf("\\"); + if(index1>index)index=index1; + name=name.mid(index+1); + name=name.left(name.lastIndexOf(".")); + Slf_FILE_MESSAGE mes; + logio->GetFileMessage(mes); + QString m_WellAndRound=QString::fromLocal8Bit(mes.WellName)+"井"+name; + TiShiDialog *dlg=new TiShiDialog(NULL); + dlg->init(ExistCurve,m_WellAndRound);//qss); + + if(dlg->exec()==QDialog::Accepted) + { + CDataImport::flag1=dlg->flag; + CDataImport::m_flag=dlg->flag; + CDataImport::flag_check=dlg->check; + } + } + int mflag=CDataImport::m_flag; + if(mflag==0)//跳过 + { + for(int i=0;iDiscardObject(ExistCurve[i]); + } + } + else if(mflag==3)//另存 + { + QStringList OutCurveList; + for(int i=0;iGetObjectCount();i++) + { + char name[64]; + if(logio->GetObjectStatus(i)!=OBJECT_NORMAL)continue; + logio->GetObjectName(i,name); + OutCurveList.append(QString(name)); + } + for(int i=0;iClose(); + } +// bool CheckExistCurve(QString outputfilename,int NumLog,vector& OutCurveNo,vector& OutCurve); + + + if(logio->Open(UTF8ToGBK(qss).data()/*qss.toStdString().c_str()*/,CSlfIO::modeRead)) + { + Slf_FILE_MESSAGE FILE_MESSAGE=v->FILE_MESSAGE; + logio->GetFileMessage(v->FILE_MESSAGE); + + if(v->FILE_MESSAGE.Xcoor!=FILE_MESSAGE.Xcoor) { + if(FILE_MESSAGE.Xcoor!=0) v->FILE_MESSAGE.Xcoor=FILE_MESSAGE.Xcoor; + } + if(v->FILE_MESSAGE.Ycoor!=FILE_MESSAGE.Ycoor) { + if(FILE_MESSAGE.Ycoor!=0) v->FILE_MESSAGE.Ycoor=FILE_MESSAGE.Ycoor; + } + if(v->FILE_MESSAGE.Altitude!=FILE_MESSAGE.Altitude) { + if(FILE_MESSAGE.Altitude!=0) v->FILE_MESSAGE.Altitude=FILE_MESSAGE.Altitude; + } + if(v->FILE_MESSAGE.Kelly!=FILE_MESSAGE.Kelly) { + if(FILE_MESSAGE.Kelly!=0) v->FILE_MESSAGE.Kelly=FILE_MESSAGE.Kelly; + } + if(v->FILE_MESSAGE.TVD!=FILE_MESSAGE.TVD) { + if(FILE_MESSAGE.TVD!=0) v->FILE_MESSAGE.TVD=FILE_MESSAGE.TVD; + } + if(v->FILE_MESSAGE.X0!=FILE_MESSAGE.X0) { + if(FILE_MESSAGE.X0!=0) v->FILE_MESSAGE.X0=FILE_MESSAGE.X0; + } + if(v->FILE_MESSAGE.Y0!=FILE_MESSAGE.Y0) { + if(FILE_MESSAGE.Y0!=0) v->FILE_MESSAGE.Y0=FILE_MESSAGE.Y0; + } + if(v->FILE_MESSAGE.Z0!=FILE_MESSAGE.Z0) { + if(FILE_MESSAGE.Z0!=0) v->FILE_MESSAGE.Z0=FILE_MESSAGE.Z0; + } + int indexSTable=-1; + int indexDTable=-1; + if(logio->FindObjectIndex("井基本信息")>-1) { + WELL_STATIC_INFO WellStaticInfo=v->WellStaticInfo; + + indexSTable=logio->OpenSTATIC("井基本信息"); + logio->ReadTable(indexSTable,1,&v->WellStaticInfo);//inf); + if(v->WellStaticInfo.XCoor!=WellStaticInfo.XCoor) { + if(WellStaticInfo.XCoor!=0) v->WellStaticInfo.XCoor=WellStaticInfo.XCoor; + } + if(v->WellStaticInfo.YCoor!=WellStaticInfo.YCoor) { + if(WellStaticInfo.YCoor!=0) v->WellStaticInfo.YCoor=WellStaticInfo.YCoor; + } + if(v->WellStaticInfo.As1!=WellStaticInfo.As1) { + if(WellStaticInfo.As1!=0) v->WellStaticInfo.As1=WellStaticInfo.As1; + } + if(v->WellStaticInfo.Bs1!=WellStaticInfo.Bs1) { + if(WellStaticInfo.Bs1!=0) v->WellStaticInfo.Bs1=WellStaticInfo.Bs1; + } + logio->CloseTable(indexSTable); + } + if(logio->FindObjectIndex("测井信息")>-1) { + WELL_DYNAMIC_INFO WellDynamicInfo; + indexDTable=logio->OpenDYNAMIC("测井信息"); + logio->ReadTable(indexDTable,1,&v->WellDynamicInfo);//inf); + logio->CloseTable(indexDTable); + } + } + delete logio; + //v->Transfer(logfilename,outfile,&OutCurveNo[0],&OutCurve[0],&strChineseName[0],&strUnit[0],iRow); + //whp change 2019.12.10 for写入井名 + // QString strCh(logfilename); // 汉字路径转换 + if(v->Transfer(/*strCh.toLocal8Bit().data()*/UTF8ToGBK(logfilename).data(),outfile,&OutCurveNo[0],&OutCurve[0],&strChineseName[0],&strUnit[0],iRow)) + { + CLogIO * logio=new CLogIO(); + logio->Open(outfile/*UTF8ToGBK(outfile).data()*/,CSlfIO::modeReadWrite); + Slf_FILE_MESSAGE mssage; + logio->GetFileMessage(mssage); + strcpy(mssage.WellName,UTF8ToGBK(WellName).data()/*WellName.toStdString().c_str()*/); + logio->SetFileMessage(mssage); + delete logio; + } + else return "";//whp add 2019.12.12 + //whp change 2020.2.18 for 汉字井名转换有乱码 + QString slfname=outfile;//QString(QString::fromLocal8Bit(outfile));//QString(QLatin1String(outfile)); + delete []logfilename; + delete []outfile; + //return 1;////whp add 2019.12.08 for 输出成功加载的文件个数 + return slfname;//whp change 2019.12.12 +} +QStringList CDataImport::GetFileNames(const QString &caption , const QString &filter,QFileDialog::FileMode filemode ) +{ + static QString path=::GetDataPath(); + QStringList sts=QFileDialog::getOpenFileNames(NULL,caption,path,filter); + if(sts.size()) path=sts[0]; + return sts; +// QFileDialog * fileDlg=new QFileDialog(); +// fileDlg->setFileMode(filemode); +// QStringList listFiles; +// if(fileDlg->exec()==QFileDialog::Accepted) +// { +// listFiles=fileDlg->selectedFiles(); +// } +// delete fileDlg; +// return listFiles; +} +void CDataImport::OutPutWellXYCoordinate() +{ + // //井名 磁偏角 南北(小) 东西(大) 测量深度 地面海拔 补心高 TVD 东西位移 南北位移 + // //a 0 4394427.9 19308473.9 0 1446.9 0 0 0 0 + // //b 0 4394427.9 19308473.9 0 1446.9 0 0 0 0 + // //c 0 4398164.3 19306076.3 0 1436.5 0 0 0 0 + // //d 0 4398270.1 19311098.4 0 1437.5 0 0 0 0 + // //e 0 4392057.3 19305209.1 0 1461.3 0 0 0 0 + // QString strFileName =QFileDialog::getSaveFileName( NULL,"导出工区井坐标为TXT",::GetOutDataPath(),"文件(*.txt)"); + // FILE *fp=fopen(strFileName.toStdString().c_str(),"wt"); + // if(!fp) return; + // fprintf(fp,"磁偏角 南北(小) 东西(大) 测量深度 地面海拔 补心高 TVD 东西位移 南北位移\m"); + // int flag=0; + // CObjProject *pPrj=::GetProject(); + // if(!pPrj) return; + // PaiObject *pObj=pPrj->GetObjectByType(GetClassID_WellsFolder()); + // if(!pObj) return; + // QList childs; + // pObj->GetChildren(childs); + // std::vector wellnames; + // foreach(PaiObject *pChild,childs) { + // CObjWell *pWell=dynamic_cast(pChild); + // if(pWell) + // { + // QString ss=pWell->GetWellFileName(); + // QString wellname,path; + // GetWellNameAndPath(ss,wellname,path); + // WellHead &hd=pWell->GetWellHead(); + // fprintf(fp,"%s\t%10.3f\t%10.3f\t%10.3f\t%10.3f\t%10.3f\t%10.3f\t%10.3f\t%10.3f\t%10.3f\t\n", + // hd.wellName.toStdString().c_str(), + // //井名 磁偏角 南北(小) 东西(大) 测量深度 地面海拔 补心高 TVD 东西位移 南北位移 + // hd.azca, + // hd.x, + // hd.y, + // hd.depth, + // hd.earthEle, + // hd.dEle, + // hd.tvd, + // hd._HorizBoreXE, + // hd._HorizBoreYN); + // } + // } + // fclose(fp); + // QMessageBox::warning(NULL,"提示",QString("井位信息保存完成!")); +} + +void CDataImport::ImportWellXYCoordinate() +{ +// //井名 磁偏角 南北(小) 东西(大) 测量深度 地面海拔 补心高 TVD 东西位移 南北位移 +// //a 0 4394427.9 19308473.9 0 1446.9 0 0 0 0 +// //b 0 4394427.9 19308473.9 0 1446.9 0 0 0 0 +// //c 0 4398164.3 19306076.3 0 1436.5 0 0 0 0 +// //d 0 4398270.1 19311098.4 0 1437.5 0 0 0 0 +// //e 0 4392057.3 19305209.1 0 1461.3 0 0 0 0 + + +// QStringList listFiles=GetFileNames("选择工区井井位信息","数据文件(*.prn;*.txt)"); +// if(!listFiles.size()) +// { +// return; +// } +// int flag=0; +// foreach(QString strFileName, listFiles) +// { +// QFile file(strFileName); +// if (!file.open(QIODevice::ReadOnly )) +// { +// continue; +// } +// flag=0; +// QTextStream in(&file); +// QString lineString = in.readLine(); +// QStringList LineStringList = lineString.split(","); +// if(LineStringList.size()==1) LineStringList = lineString.split(" "); +// if(LineStringList.size()==1) LineStringList = lineString.split(" "); +// LineStringList.removeAll(""); +// LineStringList.removeAll(" "); +// for (int i=0;i-1) LineStringList[i]=LineStringList[i].replace("\t",""); +// LineStringList[i]=LineStringList[i].trimmed(); +// } +// QString strWellName=LineStringList[0]; +// if(strWellName.indexOf("wellname",0,Qt::CaseInsensitive)>=0|| +// strWellName.indexOf("井名",0,Qt::CaseInsensitive)>=0 +// ) { +// flag=1; +// } +// while ( !in.atEnd() ) +// { +// lineString = in.readLine(); +// if(lineString.isEmpty()) continue; +// LineStringList = lineString.split(","); +// if(LineStringList.size()==1) LineStringList = lineString.split(" "); +// if(LineStringList.size()==1) LineStringList = lineString.split(" "); +// LineStringList.removeAll(""); +// LineStringList.removeAll(" "); +// for (int i=0;i-1) LineStringList[i]=LineStringList[i].replace("\t",""); +// LineStringList[i]=LineStringList[i].trimmed(); +// } +// if(LineStringList.size()<1) continue; +// LineStringList.replaceInStrings("-9999.0","0"); +// LineStringList.replaceInStrings("-9999","0"); +// if(flag) { +// CObjWell * pWell = CDataImport::GetWellByName(LineStringList[0]); +// if(!pWell) continue; +// //井名 磁偏角 南北(小) 东西(大) 测量深度 地面海拔 补心高 TVD 东西位移 南北位移 +// // 0 1 2 3 4 5 6 7 8 9 +// WellHead &wh=pWell->GetWellHead(); +// if(LineStringList.size()>1)wh.azca=LineStringList[1].toDouble(); +// if(LineStringList.size()>2)wh.y=LineStringList[2].toDouble(); +// if(LineStringList.size()>3)wh.x=LineStringList[3].toDouble(); +// if(LineStringList.size()>4)wh.depth=LineStringList[4].toDouble(); +// if(LineStringList.size()>5)wh.earthEle=LineStringList[5].toDouble(); +// if(LineStringList.size()>6){ +// wh.dEle=LineStringList[6].toDouble(); +// if(wh.dEle==-9999) wh.dEle=0; +// } +// if(LineStringList.size()>7)wh.tvd=LineStringList[7].toDouble(); +// if(LineStringList.size()>8)wh.dyn=LineStringList[8].toDouble(); +// if(LineStringList.size()>9)wh.dxe=LineStringList[9].toDouble(); +// wh.z=wh.earthEle-wh.tvd+wh.dEle; +// if(pWell->GetWellFileName().isEmpty()) { +// QString fi=GetLogdataPath()+GetProject()->GetName()+"\\#"+LineStringList[0]; +// CreateDir((char *)fi.toStdString().c_str()); +// fi+="\\"+LineStringList[0]+".slf"; +// pWell->SetWellFileName(fi); +// } +// pWell->SaveWellHead(pWell->GetWellFileName()); +// QList wellroundchildren; +// int count=pWell->GetAllWellRound(wellroundchildren); +// for(int i=0;i(wellroundchildren[i]); +// pWell->SaveWellHead(pWR->GetSlfFileName()); +// } +// } +// else { +// } +// } +// } +// AfxMessageBox("导入完成!"); +} +void CDataImport::ImportGeoStraData() +{ + // QStringList listFiles=GetFileNames("选择工区层位数据","数据文件(*.prn;*.txt)"); + // if(listFiles.size()<1) return; + // int flag=0; + // std::vector wellNameVec; + // QList layerNameVec; + // std::vector topDetphVec; + // std::vector bottomDepthVec; + // foreach(QString strFileName, listFiles) + // { + // QFile file(strFileName); + // if (!file.open(QIODevice::ReadOnly )) + // { + // continue; + // } + // flag=0; + // QTextStream in(&file); + // QString lineString = in.readLine(); + // QStringList LineStringList = lineString.split(","); + // if(LineStringList.size()==1) LineStringList = lineString.split(" "); + // if(LineStringList.size()==1) LineStringList = lineString.split(" "); + // LineStringList.removeAll(""); + // LineStringList.removeAll(" "); + // for (int i=0;i-1) LineStringList[i]=LineStringList[i].replace("\t",""); + // LineStringList[i]=LineStringList[i].trimmed(); + // } + // if(LineStringList.size()<1) continue; + // QString strWellName = LineStringList[0] ; + // if(strWellName.indexOf("wellname",0,Qt::CaseInsensitive)>=0|| + // strWellName.indexOf("井名",0,Qt::CaseInsensitive)>=0 + // ) { + // flag=1; + // for(int i=1;i-1) { + // flag=2; + // continue; + // } + // layerNameVec.push_back(LineStringList[i]); + // } + // } + // while ( !in.atEnd() ) + // { + // lineString = in.readLine(); + // LineStringList = lineString.split(","); + // if(LineStringList.size()==1) LineStringList = lineString.split(" "); + // if(LineStringList.size()==1) LineStringList = lineString.split(" "); + // LineStringList.removeAll(" "); + // LineStringList.removeAll(""); + // for (int i=0;i-1) LineStringList[i]=LineStringList[i].replace("\t",""); + // LineStringList[i]=LineStringList[i].trimmed(); + // } + // if(LineStringList.size()<1) continue; + // if(flag) { + // wellNameVec.push_back(LineStringList[0]); + // if(flag==1) { + // for(int i=2;iGetWellFileName().isEmpty()) { + // QString fi=GetLogdataPath()+GetProject()->GetName()+"\\#"+wellNameVec[i]; + // CreateDir((char *)fi.toStdString().c_str()); + // fi+="\\"+wellNameVec[i]+".slf"; + // pWell->SetWellFileName(fi); + // } + // CObjGeostratums* pGeostratum = dynamic_cast(pWell->GetObjectByType(GetClassID_OGGeostratums(), 2)); + // if(!pGeostratum) { + // pGeostratum = new CObjGeostratums(); + // pGeostratum->SetName("LAYER_DATA"); + // pWell->AddChild( pGeostratum ); + // } + // if (flag1==QMessageBox::Yes) { + // pGeostratum->ClearItems(); + // } + // pGeostratum->SetSlfFileName(pWell->GetWellFileName()); + // int index = 0; + // if(flag) { + // int size=layerNameVec.size()-1; + // if(flag==2) size=layerNameVec.size(); + // for(int j=0;jGetItemByName(layerNameVec[j]); + // if(!pItem) { + // pItem = pGeostratum->AddItem(top,bottom); + // OGGeostratumItem * pGeoItem = dynamic_cast(pItem); + // if(pGeoItem) { + // pGeoItem->SetName(layerNameVec[j]); + // pGeoItem->SetDEST(layerNameVec[j]); + // pGeoItem->SetSDEP(top); + // pGeoItem->SetEDEP(bottom); + // } + // } + // else { + // OGGeostratumItem * pGeoItem = dynamic_cast(pItem); + // { + // pGeoItem->SetTopDepth(top); + // pGeoItem->SetBottomDepth(bottom); + // pGeoItem->SetSDEP(top); + // pGeoItem->SetEDEP(bottom); + // pGeoItem->SetDEST(layerNameVec[j]); + // } + // } + // } + // } + // else { + // if(topDetphVec[i]==-9999||bottomDepthVec[i]==-9999) continue; + // pai::datamodel::WelllogItem* pItem =pGeostratum->GetItemByName(layerNameVec[i]); + // if(!pItem) { + // pItem = pGeostratum->AddItem(topDetphVec[i],bottomDepthVec[i]); + // OGGeostratumItem * pGeoItem = dynamic_cast(pItem); + // pGeoItem->SetName(layerNameVec[i]); + // pGeoItem->SetDEST(layerNameVec[i]); + // pGeoItem->SetSDEP(topDetphVec[i]); + // pGeoItem->SetEDEP(bottomDepthVec[i]); + // } + // else { + // OGGeostratumItem * pGeoItem = dynamic_cast(pItem); + // pGeoItem->SetTopDepth(topDetphVec[i]); + // pGeoItem->SetBottomDepth(bottomDepthVec[i]); + // pGeoItem->SetSDEP(topDetphVec[i]); + // pGeoItem->SetEDEP(bottomDepthVec[i]); + // pGeoItem->SetDEST(layerNameVec[i]); + // } + // } + // pGeostratum->SaveToSLF(); + // } + + // AfxMessageBox("导入分层完成!"); +} + +void CDataImport::OutPutGeoStraData() +{ +// QString strFileName =QFileDialog::getSaveFileName( NULL,"输出层位数据为TXT",::GetOutDataPath(), +// "文件(*.txt)"); +// int flag=0; +// std::vector wellNameVec; +// std::vector layerNameVec; +// std::vector topDetphVec; +// std::vector bottomDepthVec; + +// CObjProject *pPrj=::GetProject(); +// if(!pPrj) return; +// PaiObject *pObj=pPrj->GetObjectByType(GetClassID_WellsFolder()); +// if(!pObj) return; +// QList childs; +// pObj->GetChildren(childs); +// QStringList LayerNameVec; +// std::vectorLayerNameVecS; +// std::vector> TopDepthVecS; +// std::vector> BottomDepthVecS; +// std::vector wellnames; +// foreach(PaiObject *pChild,childs) { +// CObjWell *pWell=dynamic_cast(pChild); +// if(pWell) { +// QString ss=pWell->GetWellFileName(); +// if(!ss.isEmpty()) { +// QString name="LAYER_DATA"; +// LAYER_DATA m_Result; +// CLogIO *logio=new CLogIO(); +// if(!logio->Open(ss.toStdString().c_str(),CSlfIO::modeRead)) +// { +// delete logio; +// return; +// } +// int iIndex=logio->OpenTable(name.toStdString().c_str()); +// if (iIndex >=0) +// { +// wellnames.push_back(pWell->GetName()); +// QStringList layerNameVec; +// std::vector TopDepthVec; +// std::vector BottomDepthVec; +// int count=logio->GetTableRecordCount(iIndex); +// for(int j=0;jReadTable(iIndex,j+1,&m_Result); +// char buf[490]; +// GetDescription(m_Result,buf); +// if(!strlen(buf)) continue; +// if(!LayerNameVec.contains(buf)) LayerNameVec.append(buf); +// layerNameVec.append(buf); +// TopDepthVec.push_back(m_Result.StartDepth); +// BottomDepthVec.push_back(m_Result.EndDepth); +// } +// LayerNameVecS.push_back(layerNameVec); +// TopDepthVecS.push_back(TopDepthVec); +// BottomDepthVecS.push_back(BottomDepthVec); +// } +// delete logio; +// } +// } +// } +// FILE *fp=fopen(strFileName.toStdString().c_str(),"wt"); +// if(!fp) return; +// fprintf(fp,"%s","wellname\t"); +// for(int j=0;j-1) { +// // if(j!=LayerNameVec.size()) +// fprintf(fp,"%10.3f\t%10.3f",TopDepthVecS[i][pos],BottomDepthVecS[i][pos]); +// // else fprintf(fp,"%10.3f",BottomDepthVecS[i][pos]); +// } +// else fprintf(fp,"%10.3f\t%10.3f",-9999.0,-9999.0); +// if(j!=LayerNameVec.size()-1) fprintf(fp,"%s","\t"); +// else fprintf(fp,"%s","\n"); +// } +// } +// fclose(fp); +// QMessageBox::warning(NULL,"提示",QString("分层数据保存完成!")); +} + +// END_OSGGRAPHICS_NAMESPACE diff --git a/ConvertorManager/src/IConvertor.cpp b/ConvertorManager/src/IConvertor.cpp index 59461b6..d8c3dd1 100644 --- a/ConvertorManager/src/IConvertor.cpp +++ b/ConvertorManager/src/IConvertor.cpp @@ -1,62 +1,62 @@ -#include "IConvertor.h" - -BEGIN_OSGGRAPHICS_NAMESPACE; -sConvertorKey::sConvertorKey() -{ - -} - -sConvertorKey::sConvertorKey( QUuid ConvertorTypeClassIDTmp ,QString strConvertorTypeName) -{ - m_ConvertorTypeClassID = ConvertorTypeClassIDTmp; - m_strConvertorTypeName= strConvertorTypeName; -} - -bool sConvertorKey::operator !=( const sConvertorKey& s ) -{ - return m_ConvertorTypeClassID != s.m_ConvertorTypeClassID ; -} - -bool sConvertorKey::operator< ( const sConvertorKey& s ) const -{ - return m_ConvertorTypeClassID < s.m_ConvertorTypeClassID; - -} - -IConvertor::IConvertor():m_ConvertorTypeName("") -{ - m_WellLogRoundInfo=new MyWelllogRound(); - m_WellInfo=new Well(); - m_pDepthProgress=NULL; - m_ColumnCount=0; -} - - -IConvertor::~IConvertor() -{ - delete m_WellLogRoundInfo; - delete m_WellInfo; -} -void IConvertor::InitFormatSuffixName() -{ -} -MyWelllogRound * IConvertor::GetWellLogRoundInfo() -{ - - return m_WellLogRoundInfo; - -} - -pai::ios::welllog::Well *IConvertor::GetWellInfo() -{ - return m_WellInfo; - -} - -pai::datamodel::CObjectGenralFactory& IConvertor::GetFatory() -{ - static pai::datamodel::CObjectGenralFactory fatory; - - return fatory; -} -END_OSGGRAPHICS_NAMESPACE; +#include "IConvertor.h" + +BEGIN_OSGGRAPHICS_NAMESPACE; +sConvertorKey::sConvertorKey() +{ + +} + +sConvertorKey::sConvertorKey( QUuid ConvertorTypeClassIDTmp ,QString strConvertorTypeName) +{ + m_ConvertorTypeClassID = ConvertorTypeClassIDTmp; + m_strConvertorTypeName= strConvertorTypeName; +} + +bool sConvertorKey::operator !=( const sConvertorKey& s ) +{ + return m_ConvertorTypeClassID != s.m_ConvertorTypeClassID ; +} + +bool sConvertorKey::operator< ( const sConvertorKey& s ) const +{ + return m_ConvertorTypeClassID < s.m_ConvertorTypeClassID; + +} + +IConvertor::IConvertor():m_ConvertorTypeName("") +{ + m_WellLogRoundInfo=new MyWelllogRound(); + m_WellInfo=new Well(); + m_pDepthProgress=NULL; + m_ColumnCount=0; +} + + +IConvertor::~IConvertor() +{ + delete m_WellLogRoundInfo; + delete m_WellInfo; +} +void IConvertor::InitFormatSuffixName() +{ +} +MyWelllogRound * IConvertor::GetWellLogRoundInfo() +{ + + return m_WellLogRoundInfo; + +} + +pai::ios::welllog::Well *IConvertor::GetWellInfo() +{ + return m_WellInfo; + +} + +pai::datamodel::CObjectGenralFactory& IConvertor::GetFatory() +{ + static pai::datamodel::CObjectGenralFactory fatory; + + return fatory; +} +END_OSGGRAPHICS_NAMESPACE; diff --git a/ConvertorManager/src/ImportdataDialog.cpp b/ConvertorManager/src/ImportdataDialog.cpp index a66090b..e054eb4 100644 --- a/ConvertorManager/src/ImportdataDialog.cpp +++ b/ConvertorManager/src/ImportdataDialog.cpp @@ -1,889 +1,889 @@ -#include "ui_importdataDialog.h" -#include "ImportdataDialog.h" -#include "InterIConvertor.h" -#include "IConvertor.h" -//#include "ObjWelllogRound.h" -#include -#include -#include "DataImport.h" -#include "CStringType.h" -#include "MyWelllogRound.h" -#include "tishidialog.h" -#include "ui_interfaceWidget.h" -//#include "ObjectEvent.h" -#include "ObjWell.h" -#include "MemRdWt.h" -BEGIN_OSGGRAPHICS_NAMESPACE; -ImportDataDialog::ImportDataDialog(QWidget *parent,QString wellname,QString wellroundname): QDialog(parent),m_FilePath(""),m_ExistSameWellName(false),m_ExistSameWellRoundName(false) -{ - m_CurrentWellName=wellname; - m_CurrentWellRoundName=wellroundname; - m_pImportDataUI=new Ui::ImportData(); - m_pImportDataUI->setupUi(this); - m_pImportDataUI->tabWidget->removeTab(1); - m_pImportDataUI->tabWidget->removeTab(0); - connect(m_pImportDataUI->pushButton_2, SIGNAL(clicked()), this, SLOT(AcceptOK())); - connect(m_pImportDataUI->pushButton, SIGNAL(clicked()), this, SLOT(reject())); - //whp add 2019.10.12 - connect(m_pImportDataUI->pushButton_3, SIGNAL(clicked()), this, SLOT(SelAll())); - connect(m_pImportDataUI->pushButton_4, SIGNAL(clicked()), this, SLOT(NotSelAll())); - connect(m_pImportDataUI->pushButton_5, SIGNAL(clicked()), this, SLOT(ReverseSel())); - setAttribute( Qt::WA_DeleteOnClose ,true ); - setWindowTitle("Import Well-Logging-Data"); - m_pImportDataUI->pushButton_2->setIcon(QIcon( ::GetImagePath() + "icon/Import.png")); - m_pImportDataUI->pushButton->setIcon(QIcon( ::GetImagePath() + "icon/Exit.png")); -} - -ImportDataDialog::~ImportDataDialog() -{ - std::map::iterator itor=m_TabInterWidget.begin(); - for (;itor!=m_TabInterWidget.end();itor++) - { - InterfaceWidget *pIterWidget=itor->second; - if (pIterWidget) - { - delete pIterWidget; - pIterWidget=NULL; - } - } - m_TabInterWidget.clear(); - - if (m_pImportDataUI) - { - delete m_pImportDataUI; - m_pImportDataUI=NULL; - } -} - -void ImportDataDialog::DisplayFileInformationAreaData( const QVectorConvertorVector,const QString filePath ) -{ - m_vConvertorVector.clear(); - m_vConvertorVector=ConvertorVector; - std::map&mapBuilderType = - IConvertor::GetFatory().m_map; - std::map::iterator itor = - mapBuilderType.begin(); - m_FilePath=filePath; - - for (int i=0;itabWidget->addTab(tabWidget,QString()); - QHBoxLayout *Mainlayout=new QHBoxLayout(tabWidget); - QHBoxLayout *ScondLayout=new QHBoxLayout(); - Mainlayout->addLayout(ScondLayout); - ScondLayout->addWidget(pInterfaceWidget); - m_pImportDataUI->tabWidget->setTabText(i,ConvertorVector[i]->GetConvertorTypeName()); - pInterfaceWidget->GetDataPreviewArea()->setText(ConvertorVector[i]->GetFileContent(filePath)); - FamilyDelegate* familyDelegate=new FamilyDelegate(this); - pInterfaceWidget->GetDataSelectAreaWidget()->setItemDelegateForColumn(2,familyDelegate); - pInterfaceWidget->m_pConvertor=ConvertorVector[i]; - QStringList fileHead=ConvertorVector[i]->GetListHead(); - if(fileHead.isEmpty()) - fileHead<<"原始名称"<<"原始单位"<<"曲线类别"<<"输出名称"<<"输出单位"; - - ConvertorVector[i]->m_ColumnCount=fileHead.size(); - DisplaySelectAreaData(pInterfaceWidget,fileHead,ConvertorVector[i]); - - //初始化井和井次信息界面 - InitWell(pInterfaceWidget,ConvertorVector[i]); - InitWellLogRound(pInterfaceWidget,ConvertorVector[i]); - } -} -void ImportDataDialog::InitWell(InterfaceWidget *pInterfaceWidget,IConvertor*pConvertor) -{ - MyWelllogRound *wellinfo=pConvertor->GetWellLogRoundInfo(); - //无井代码 - if(m_CurrentWellName!="") - pInterfaceWidget->GetWellNameLineEdit()->insert(m_CurrentWellName); - else - { - QString tempWellName=QString::fromStdString(wellinfo->GetWellName());//whp add 2020.7.15 - tempWellName=tempWellName.simplified(); - //whp change 2020.3.3 井名提取应该不含".zh"之类的后缀,应该取文件的基本名 - //文件名中有一个以上的“."时,如3Oq.ZH.716,需要井名和文件名区分开,比如a.zh.716和a.wj.716同时解编,井名都取最前面的a,井次名分别为a.zh和a.wj - //pInterfaceWidget->GetWellNameLineEdit()->insert(QString::fromStdString(wellinfo->GetName())); - if(tempWellName=="") - { - QFileInfo temDir(QString::fromStdString(wellinfo->GetName())); - tempWellName=temDir.baseName(); - } - pInterfaceWidget->GetWellNameLineEdit()->insert(tempWellName); - } - pInterfaceWidget->GetWellCompanyNameLineEdit()->insert(QString::fromStdString(wellinfo->GetCompanyName())); - pInterfaceWidget->GetWellAreaNameLineEdit()->insert(QString::fromStdString(wellinfo->GetAreaName())); -// pInterfaceWidget->GetWellCodeLineEdit()->insert("井代码"); - pInterfaceWidget->GetXCodeLineEdit()->setText(QString::number(wellinfo->GetXCode(), 'f', 4)); - pInterfaceWidget->GetYCodeLineEdit()->setText(QString::number(wellinfo->GetYCode(), 'f', 4)); - pInterfaceWidget->GetAslLineEdit()->setText(QString::number(wellinfo->GetAsl(), 'f', 4)); - pInterfaceWidget->GetBslLineEdit()->setText(QString::number(wellinfo->GetBsl(), 'f', 4)); - pInterfaceWidget->GetCWMethodLineEdit()->insert(QString::fromStdString(wellinfo->GetCWMethod())); - pInterfaceWidget->GetBit1ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetBit1Prog())); - pInterfaceWidget->GetBit2ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetBit2Prog())); - pInterfaceWidget->GetBit3ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetBit3Prog())); - pInterfaceWidget->GetBit4ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetBit4Prog())); - pInterfaceWidget->GetBit5ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetBit5Prog())); - pInterfaceWidget->GetCas1ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetCas1Prog())); - pInterfaceWidget->GetCas2ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetCas2Prog())); - pInterfaceWidget->GetCas3ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetCas3Prog())); - pInterfaceWidget->GetCas4ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetCas4Prog())); - pInterfaceWidget->GetCas5ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetCas5Prog())); - pInterfaceWidget->GetCas1ShotLineEdit()->setText(QString::number(wellinfo->GetCas1Shot(), 'f', 4)); - pInterfaceWidget->GetCas2ShotLineEdit()->setText(QString::number(wellinfo->GetCas2Shot(), 'f', 4)); - pInterfaceWidget->GetSC1SDepLineEdit()->setText(QString::number(wellinfo->GetSC1SDep(), 'f', 4)); - pInterfaceWidget->GetSC1EDepLineEdit()->setText(QString::number(wellinfo->GetSC1EDep(), 'f', 4)); - pInterfaceWidget->GetSC2SDepLineEdit()->setText(QString::number(wellinfo->GetSC2SDep(), 'f', 4)); - pInterfaceWidget->GetSC2EDepLineEdit()->setText(QString::number(wellinfo->GetSC2EDep(), 'f', 4)); - pInterfaceWidget->GetWellTypeComboBox()->addItem(QString::fromStdString("直井")); - pInterfaceWidget->GetWellTypeComboBox()->addItem(QString::fromStdString("斜井")); - - QDate SDrilltime; - SDrilltime=QDate::currentDate(); - pInterfaceWidget->GerSDrillDateEdit()->setDate(SDrilltime); - pInterfaceWidget ->GerSDrillDateEdit()->setDisplayFormat("yyyy年 MM月 dd日"); - - QDate EDrilltime; - EDrilltime=QDate::currentDate(); - pInterfaceWidget->GerEDrillDateEdit()->setDate(EDrilltime); - pInterfaceWidget ->GerEDrillDateEdit()->setDisplayFormat("yyyy年 MM月 dd日"); - - QDate Completetime; - Completetime=QDate::currentDate(); - pInterfaceWidget->GerCompleteDateEdit()->setDate(Completetime); - pInterfaceWidget ->GerCompleteDateEdit()->setDisplayFormat("yyyy年 MM月 dd日"); -} -void ImportDataDialog::InitWellLogRound(InterfaceWidget *pInterfaceWidget,IConvertor*pConvertor) -{ - MyWelllogRound *welllogRound=pConvertor->GetWellLogRoundInfo(); - //无测井剖面 - if(m_CurrentWellRoundName!="") - pInterfaceWidget->GetWellRoundNameLineEdit()->insert(m_CurrentWellRoundName); - else - pInterfaceWidget->GetWellRoundNameLineEdit()->insert(QString::fromStdString(welllogRound->GetName())); - pInterfaceWidget->GetCompanyNameLineEdit()->insert(QString::fromStdString(welllogRound->GetCompanyName())); - pInterfaceWidget->GetTeamLineEdit()->insert(QString::fromStdString(welllogRound->GetTeam())); - pInterfaceWidget->GetOperatorLineEdit()->insert(QString::fromStdString(welllogRound->GetOperator())); - pInterfaceWidget->GetMudViscosityLineEdit()->insert(QString::number(welllogRound->GetMudViscosity(), 'f', 4)); - pInterfaceWidget->GetRemarkTextEdit()->setText(QString::fromStdString(welllogRound->GetRemark())); - pInterfaceWidget->GetWaterLossLineEdit()->setText(QString::number(welllogRound->GetWaterLoss(), 'f', 4)); - pInterfaceWidget->GetDensityLineEdit()->setText(QString::number(welllogRound->GetDensity(), 'f', 4)); - pInterfaceWidget->GetResiLineEdit()->setText(QString::number(welllogRound->GetResi(), 'f', 4)); - pInterfaceWidget->GetTempLineEdit()->setText(QString::number(welllogRound->GetTemp(), 'f', 4)); - pInterfaceWidget->GetINTLogLineEdit()->insert(QString::fromStdString(welllogRound->GetINTLog())); - pInterfaceWidget->GetTempBotLineEdit()->setText(QString::number(welllogRound->GetTempBot(), 'f', 4)); - pInterfaceWidget->GetNITINTLineEdit()->insert(QString::fromStdString(welllogRound->GetNITINT())); - pInterfaceWidget->GetIntProgLineEdit()->insert(QString::fromStdString(welllogRound->GetIntProg())); - pInterfaceWidget->GetInteDressLineEdit()->insert(QString::fromStdString(welllogRound->GetInteDress())); - pInterfaceWidget->GetAuditLineEdit()->insert(QString::fromStdString(welllogRound->GetAudit())); - pInterfaceWidget->GetEditTopDepth()->setText("-99999."); - pInterfaceWidget->GetEditBottomDepth()->setText("-99999."); - QString temp_topDepth = (welllogRound->GetTopDepth() > -9999) ? QString::number(welllogRound->GetTopDepth(),'f',6) : "-99999."; - QString temp_botDepth = (welllogRound->GetBottomDepth() > -9999) ? QString::number(welllogRound->GetBottomDepth(),'f',6) : "-99999."; - pInterfaceWidget->GetEditFileSDepth()->setText(temp_topDepth); - pInterfaceWidget->GetEditFileEDepth()->setText(temp_botDepth); - - QDateTime time; - if (welllogRound->GetDate()=="") - { - time=QDateTime::currentDateTime(); - } - else - { - time =QDateTime::fromString(QString::fromStdString(welllogRound->GetDate()), "yyyy-MM-dd"); - } - pInterfaceWidget->GerDateEdit()->setDateTime (time); - pInterfaceWidget ->GerDateEdit()->setDisplayFormat("yyyy年 MM月 dd日"); - ComboxFromConfigFile(pInterfaceWidget->GetSerialComboBox(),"serial"); - ComboxFromConfigFile(pInterfaceWidget->GetItemComboBox(),"wellItem"); - ComboxFromConfigFile(pInterfaceWidget->GetMudTypeComboBox(),"mudType"); -} - - -// CObjWell * ImportDataDialog::GetWellBaseName( IConvertor *pConvertor,const std::string strWellName ) -// { -// CObjWell *pWell(NULL); -// { -// QString strName=QString::fromStdString(strWellName); -// if (!GetProject()) -// { -// if(!CProjectCommand::NewProject(true)) return NULL; -// } -// if( GetProject() ) -// { -// pWell = dynamic_cast( GetProject()->GetObjectByName(strName)); -// if (pWell) -// { -// //pWell->SetDBWell(pConvertor->GetWellInfo()); -// m_ExistSameWellName=true; -// } -// } -// if( !pWell ) -// { -// pWell = new CObjWell(); -// pWell->SetName( strName ); -// pWell->SetDBWell(*(pConvertor->GetWellInfo())); -// if( GetProject() ) -// { -// GetProject()->GetWellsFolder(true)->AddChild( pWell ); -// } -// } -// } - -// return pWell; -// } -void ImportDataDialog::UpdateWell(InterfaceWidget *pInterfaceWidget,IConvertor *pConvertor) -{ - if (!pInterfaceWidget||!pConvertor) - return ; - //井代码接口暂时没有 -// pai::ios::welllog::Well &wellInfo=pConvertor->GetWellInfo(); - InterIConvertor*pIC=dynamic_cast(pConvertor); - MyWelllogRound* wellInfo=pConvertor->GetWellLogRoundInfo(); - QString wellname=pInterfaceWidget->GetWellNameLineEdit()->text(); - wellname=wellname.toUpper(); - if(pIC) strcpy(pIC->FILE_MESSAGE.WellName,wellname.toLocal8Bit().data()); - wellInfo->SetWellName(wellname.toStdString()); - wellInfo->SetName(wellname.toStdString()); - // - wellInfo->SetCompanyName((pInterfaceWidget->GetWellCompanyNameLineEdit()->text()).toStdString()); - wellInfo->SetAreaName((pInterfaceWidget->GetWellAreaNameLineEdit()->text()).toStdString()); -// wellInfo->SetWellCode((pInterfaceWidget->GetWellCodeLineEdit()->text()).toStdString()); - wellInfo->SetCWMethod((pInterfaceWidget->GetCWMethodLineEdit()->text()).toStdString()); - wellInfo->SetXCode((pInterfaceWidget->GetXCodeLineEdit()->text()).toFloat()); - wellInfo->SetYCode((pInterfaceWidget->GetYCodeLineEdit()->text()).toFloat()); - wellInfo->SetAsl((pInterfaceWidget->GetAslLineEdit()->text()).toFloat()); - wellInfo->SetBsl((pInterfaceWidget->GetBslLineEdit()->text()).toFloat()); - wellInfo->SetBit1Prog((pInterfaceWidget->GetBit1ProgLineEdit()->text()).toStdString()); - wellInfo->SetBit2Prog((pInterfaceWidget->GetBit2ProgLineEdit()->text()).toStdString()); - wellInfo->SetBit3Prog((pInterfaceWidget->GetBit3ProgLineEdit()->text()).toStdString()); - wellInfo->SetBit4Prog((pInterfaceWidget->GetBit4ProgLineEdit()->text()).toStdString()); - wellInfo->SetBit5Prog((pInterfaceWidget->GetBit5ProgLineEdit()->text()).toStdString()); - wellInfo->SetCas1Prog((pInterfaceWidget->GetCas1ProgLineEdit()->text()).toStdString()); - wellInfo->SetCas2Prog((pInterfaceWidget->GetCas2ProgLineEdit()->text()).toStdString()); - wellInfo->SetCas3Prog((pInterfaceWidget->GetCas3ProgLineEdit()->text()).toStdString()); - wellInfo->SetCas4Prog((pInterfaceWidget->GetCas4ProgLineEdit()->text()).toStdString()); - wellInfo->SetCas5Prog((pInterfaceWidget->GetCas5ProgLineEdit()->text()).toStdString()); - wellInfo->SetCas1Shot((pInterfaceWidget->GetCas1ShotLineEdit()->text()).toFloat()); - wellInfo->SetCas2Shot((pInterfaceWidget->GetCas2ShotLineEdit()->text()).toFloat()); - wellInfo->SetSC1SDep((pInterfaceWidget->GetSC1SDepLineEdit()->text()).toFloat()); - wellInfo->SetSC1EDep((pInterfaceWidget->GetSC1EDepLineEdit()->text()).toFloat()); - wellInfo->SetSC2SDep((pInterfaceWidget->GetSC2SDepLineEdit()->text()).toFloat()); - wellInfo->SetSC2EDep((pInterfaceWidget->GetSC2EDepLineEdit()->text()).toFloat()); - wellInfo->SetSDrillDate(pInterfaceWidget->GerSDrillDateEdit()->date().toString("yyyy年-MM月-dd日").toStdString()); - wellInfo->SetEDrillDate(pInterfaceWidget->GerEDrillDateEdit()->date().toString("yyyy年-MM月-dd日").toStdString()); - wellInfo->SetCompleteDate(pInterfaceWidget->GerCompleteDateEdit()->date().toString("yyyy年-MM月-dd日").toStdString()); - wellInfo->SetWellType((pInterfaceWidget->GetWellTypeComboBox()->currentText()).toInt()); - -} - -void ImportDataDialog::UpdateWellLogRound(InterfaceWidget *pInterfaceWidget,IConvertor *pConvertor) -{ - if (!pInterfaceWidget||!pConvertor) - return ; - //剖面接口暂时没有 - MyWelllogRound *wellRound=pConvertor->GetWellLogRoundInfo(); - wellRound->SetCompanyName((pInterfaceWidget->GetCompanyNameLineEdit()->text()).toStdString()); - wellRound->SetTeam((pInterfaceWidget->GetTeamLineEdit()->text()).toStdString()); - wellRound->SetOperator((pInterfaceWidget->GetOperatorLineEdit()->text()).toStdString()); - wellRound->SetMudViscosity((pInterfaceWidget->GetMudViscosityLineEdit()->text()).toFloat()); - wellRound->SetRemark(pInterfaceWidget->GetRemarkTextEdit()->toPlainText().toStdString()); - wellRound->SetWaterLoss((pInterfaceWidget->GetWaterLossLineEdit()->text()).toFloat()); - wellRound->SetDensity((pInterfaceWidget->GetDensityLineEdit()->text()).toFloat()); - wellRound->SetResi((pInterfaceWidget->GetResiLineEdit()->text()).toFloat()); - wellRound->SetTemp((pInterfaceWidget->GetTempLineEdit()->text()).toFloat()); - wellRound->SetINTLog((pInterfaceWidget->GetINTLogLineEdit()->text()).toStdString()); - wellRound->SetTempBot((pInterfaceWidget->GetTempBotLineEdit()->text()).toFloat()); - wellRound->SetNITINT((pInterfaceWidget->GetNITINTLineEdit()->text()).toStdString()); - wellRound->SetIntProg((pInterfaceWidget->GetIntProgLineEdit()->text()).toStdString()); - wellRound->SetInteDress((pInterfaceWidget->GetInteDressLineEdit()->text()).toStdString()); - wellRound->SetAudit((pInterfaceWidget->GetAuditLineEdit()->text()).toStdString()); - wellRound->SetMudType((pInterfaceWidget->GetMudTypeComboBox()->currentText()).toStdString()); - wellRound->SetItem((pInterfaceWidget->GetItemComboBox()->currentText()).toStdString()); - wellRound->SetSerial((pInterfaceWidget->GetSerialComboBox()->currentText()).toStdString()); - wellRound->SetDate(pInterfaceWidget->GerDateEdit()->date().toString("yyyy年-MM月-dd日").toStdString()); - -} -void ImportDataDialog::AcceptOK() -{ - //whp del 2020.3.16 for 当井名不合理时,提示用户,然后回到解编界面,让用户修改,修改完后,再加载 - //disconnect(m_pImportDataUI->pushButton_2, SIGNAL(clicked()), 0,0); - m_ExistSameWellRoundName=false;//TODO 多模块可同时解析一个文件时,需要处理 - InterfaceWidget *pCurrentInterfaceWidget(NULL); - std::map< QWidget*,InterfaceWidget* >::iterator itor = m_TabInterWidget.find( m_pImportDataUI->tabWidget->currentWidget() ); - int index=m_pImportDataUI->tabWidget->currentIndex(); - if( itor != m_TabInterWidget.end() ) - { - pCurrentInterfaceWidget=itor->second; - } - if (!pCurrentInterfaceWidget) - return ; - //whp add 2020.3.16 - QString wellname=pCurrentInterfaceWidget->GetWellNameLineEdit()->text(); - if(wellname=="") - { - QMessageBox::warning(NULL,"提示","井名不能为空"); - return ; - } - if(!IsValidWellName(wellname)) - { - QMessageBox::warning(NULL,"提示","'"+wellname+"'不符合井名命名规则");return ; - } - // - //std::map >::iterator it=m_ConvertorWellLog.find(m_vConvertorVector[index]); - //更新井次和井信息 - UpdateWell(pCurrentInterfaceWidget,m_vConvertorVector[index]); - UpdateWellLogRound(pCurrentInterfaceWidget,m_vConvertorVector[index]); - - std::string wellLogRoundName=m_vConvertorVector[index]->GetWellLogRoundInfo()->GetWellName(); - - if(/*!wellName.length()||*/!wellLogRoundName.length()) - { - QMessageBox::about(NULL,"提示","井次名和井名不可为空!"); - return ; - } - WellCurve wc=((InterIConvertor *)m_vConvertorVector[index])->GetWellCurves(); - if(SelectAndDeleteWellLog(wc.Curve_Num,pCurrentInterfaceWidget,m_vConvertorVector[index]->m_ColumnCount,m_vConvertorVector[index])) - return; - //释放未被选取的解编器内存 - QDialog::accept(); -// ::GetObjectEvent().OnRefreshData(wellname,""); -} -//whp add 2019.10.12 -void ImportDataDialog::SelAll() -{ - InterfaceWidget *pCurrentInterfaceWidget(NULL); - std::map< QWidget*,InterfaceWidget* >::iterator itor = m_TabInterWidget.find( m_pImportDataUI->tabWidget->currentWidget() ); - int index=m_pImportDataUI->tabWidget->currentIndex(); - if( itor != m_TabInterWidget.end() ) - { - pCurrentInterfaceWidget=itor->second; - } - if (!pCurrentInterfaceWidget) - return ; - QTableWidget *tableWidget=pCurrentInterfaceWidget->GetDataSelectAreaWidget(); - int iRow=tableWidget->rowCount(); - for (int i=0;iitem(i,0)->setCheckState(Qt::Checked); - } -} -void ImportDataDialog::NotSelAll() -{ - InterfaceWidget *pCurrentInterfaceWidget(NULL); - std::map< QWidget*,InterfaceWidget* >::iterator itor = m_TabInterWidget.find( m_pImportDataUI->tabWidget->currentWidget() ); - int index=m_pImportDataUI->tabWidget->currentIndex(); - if( itor != m_TabInterWidget.end() ) - { - pCurrentInterfaceWidget=itor->second; - } - if (!pCurrentInterfaceWidget) - return ; - QTableWidget *tableWidget=pCurrentInterfaceWidget->GetDataSelectAreaWidget(); - int iRow=tableWidget->rowCount(); - for (int i=0;iitem(i,0)->setCheckState(Qt::Unchecked); - } -} -void ImportDataDialog::ReverseSel() -{ - InterfaceWidget *pCurrentInterfaceWidget(NULL); - std::map< QWidget*,InterfaceWidget* >::iterator itor = m_TabInterWidget.find( m_pImportDataUI->tabWidget->currentWidget() ); - int index=m_pImportDataUI->tabWidget->currentIndex(); - if( itor != m_TabInterWidget.end() ) - { - pCurrentInterfaceWidget=itor->second; - } - if (!pCurrentInterfaceWidget) - return ; - QTableWidget *tableWidget=pCurrentInterfaceWidget->GetDataSelectAreaWidget(); - int iRow=tableWidget->rowCount(); - for (int i=0;iitem(i,0)->checkState(); - if (eState==Qt::Checked)tableWidget->item(i,0)->setCheckState(Qt::Unchecked); - else tableWidget->item(i,0)->setCheckState(Qt::Checked); - } -} -void ImportDataDialog::DisplaySelectAreaData( InterfaceWidget *pInterface,const QStringList fileHead,IConvertor *pConvertor) -{ - int iRow(0),iOrder(0); - - vector CurveNames=((InterIConvertor*)pConvertor)->GetCurveNames(); - vector CurveUnits=((InterIConvertor*)pConvertor)->GetCurveUnits(); - WellCurve WellCurves= ((InterIConvertor*)pConvertor)->GetWellCurves(); - - //pConvertor->GetWellLogList(m_FilePath); - iRow=WellCurves.Curve_Num;//m_ConvertorWellLog[pConvertor].size(); - pInterface->GetDataSelectAreaWidget()->setColumnCount(fileHead.size()); - pInterface->GetDataSelectAreaWidget()->setRowCount(iRow); - for (int i=0;iGetDataSelectAreaWidget()->setColumnWidth(i,150); - if(i==1) pInterface->GetDataSelectAreaWidget()->setColumnWidth(i,80); - if(i==2) pInterface->GetDataSelectAreaWidget()->setColumnWidth(i,80); - if(i==3) pInterface->GetDataSelectAreaWidget()->setColumnWidth(i,150); - if (i==4) - { - pInterface->GetDataSelectAreaWidget()->setColumnWidth(i,80); - } - - pInterface->GetDataSelectAreaWidget()->horizontalHeader()->setStretchLastSection(true); - } - //pInterface->m_pInterfaceUI->widget->setFixedWidth(560); - pInterface->GetDataSelectAreaWidget()->setHorizontalHeaderLabels(fileHead); - QHeaderView* headerView = pInterface->GetDataSelectAreaWidget()->verticalHeader(); - //headerView->setHidden(true); - pInterface->GetDataSelectAreaWidget()->setAlternatingRowColors(true); - pInterface->GetDataSelectAreaWidget()->setSelectionBehavior(QAbstractItemView::SelectRows); - for (int i=0;isetCheckState(Qt::Checked); //加入复选框 - head->setFlags(head->flags() ^ Qt::ItemIsEditable); - head->setText(CurveNames[i]);//曲线名 - - pInterface->GetDataSelectAreaWidget()->setItem(i,0,head); //插入该Item - QString unit=QString::fromLocal8Bit(CurveUnits[i]); - pInterface->GetDataSelectAreaWidget()->setItem(i,1,new QTableWidgetItem(unit));//导入曲线单位 - pInterface->GetDataSelectAreaWidget()->setItem(i,2,new QTableWidgetItem(""));//family));// - pInterface->GetDataSelectAreaWidget()->setItem(i,3,new QTableWidgetItem(CurveNames[i]));//导入曲线名 - pInterface->GetDataSelectAreaWidget()->setItem(i,4,new QTableWidgetItem(unit));//导入曲线单位 - //whp add 2019.8.1 for 设置输入曲线单位列为只读 - auto rFlags = pInterface->GetDataSelectAreaWidget()->item(i,1)->flags(); - pInterface->GetDataSelectAreaWidget()->item(i,1)->setFlags(rFlags & (~Qt::ItemIsEditable)); - iOrder++; - } -} -bool ImportDataDialog::IsHaveSameCurve(int NumLog,vector &OutCurveNo,vector &OutCurve) -{ - QString str,mes=""; - int SameNameCurveNum=0; - QStringList ExistName; - for(int i=0;i=0)continue; - int no=0; - str="\r\n第"+QString::number(i+1)+"条和第"; - for(int j=i+1;j=0)) - { - if(no>0)str+="、"; - str+=QString::number(j+1); - no++; - } - } - if(no==0)continue; - ExistName.append(QString(QLatin1String(OutCurve[i]))); - SameNameCurveNum++; - if(SameNameCurveNum<30) mes+=str+"条输出曲线名字为"+QString(QLatin1String(OutCurve[i])); - else if(SameNameCurveNum==30) mes+="\n重名>=30条..."; - } - if(SameNameCurveNum>0) - { - /*str=CString("您所选择的解编曲线中存在下列同名曲线,请修改同名曲线,然后再解编\r\n\r\n")+mes; - AfxMessageBox(str); - return 1;*/ - QString inf="您所选择的解编曲线中存在下列同名曲线:\r\n\r\n"+mes+"\r\n\r\n是否对同名曲线进行解编?"; - QMessageBox box(QMessageBox::Warning,"提示",mes); - box.setStandardButtons (QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel); - box.setButtonText (QMessageBox::Yes,QString("自动重命名")); - box.setButtonText (QMessageBox::No,QString("跳过同名曲线")); - box.setButtonText (QMessageBox::Cancel,QString("返回、修改")); - int ret=box.exec(); - if(ret==QMessageBox::Cancel)return 1; - QStringList OutCurveList; - for(int i=0;i=0) - { - int no=1; - for(int j=i+1;j& OutCurveNo,vector& OutCurve) -{ //1-有输出曲线,需要继续输出,0-经跳过功能后,没有曲线要输出了,-1退回原界面 - CMemRdWt *logio=new CMemRdWt(); - if(!logio->Open(filename.toStdString().c_str(),CSlfIO::modeRead)) - { - delete logio; - return 1; - } - CString str,mes=""; - vector ExistCurveNo; - vector ExistCurve; - int ExistCurveNum=0; - for(int i=0;iFindObjectName(OutCurve[i],-1,-1,OBJECT_NORMAL); - if(logio->FindObjectName(OutCurve[i],-1,-1,OBJECT_NORMAL)<0)continue; - ExistCurve.push_back(OutCurve[i]); - ExistCurveNo.push_back(i); - } - if(ExistCurve.size()==0) - { - delete logio; - return 1; - } - TiShiDialog *dlg=new TiShiDialog(NULL); - dlg->init(ExistCurve,""); - if(dlg->exec()==Accepted) - { - if(dlg->flag==0)//跳过 - { - for(int i=0;iflag==1)//替换 - { - for(int i=0;iDiscardObject(ExistCurve[i]); - } - } - else if(dlg->flag==3)//另存 - { - QStringList OutCurveList; - for(int i=0;iGetObjectCount();i++) - { - char name[64]; - if(logio->GetObjectStatus(i)!=OBJECT_NORMAL)continue; - logio->GetObjectName(i,name); - OutCurveList.append(QString(name)); - } - for(int i=0;itoStdString()->c_str()); - delete temp; - } - } - delete logio; - delete dlg; - } - else - { - delete logio; - delete dlg; - return -1; - } - for(int i=0;i=0) return 1; - } - return 0; -} - -void CreateWellFile(CLogIO *logio,Slf_FILE_MESSAGE &mssage,QString wellFile,CObjWell *pWell) -{ - if(logio) { - CLogIO * logiowell=new CLogIO(); - Slf_FILE_MESSAGE ms=mssage; - strcpy(ms.Item,"井基本信息"); - logiowell->Open(wellFile.toStdString().c_str(),CSlfIO::modeWrite); - logiowell->SetFileMessage(ms); - QStringList azims=GetSimilarCurves("AZIM"); - int iAZIM=-1; - QString AZIM; - foreach(QString cname,azims) - { - iAZIM=logio->FindObjectName((char *)cname.toStdString().c_str()); - if(iAZIM>-1) { - AZIM=cname; - break; - } - } - int iDev=-1; - QStringList devis=GetSimilarCurves("DEVI"); - QString DEV; - foreach(QString cname,devis) - { - iDev=logio->FindObjectName((char *)cname.toStdString().c_str()); - if(iDev>-1) { - DEV=cname; - break; - } - } - // if(logio->FindObjectIndex("井基本信息")>-1) { - // logiowell->CopyFromFile((CSlfIO &)(*logio),"井基本信息"); - // } - if(iAZIM>-1)logiowell->CopyFromFile((CSlfIO &)(*logio),(char *)AZIM.toStdString().c_str()); - if(iDev>-1)logiowell->CopyFromFile((CSlfIO &)(*logio),(char *)DEV.toStdString().c_str()); - delete logiowell; - if(iDev>-1&&iAZIM>-1) { - pWell->ComputeTrajectory(pWell,wellFile); - } - } -} - -bool ImportDataDialog::SelectAndDeleteWellLog(int iRow,InterfaceWidget *pCurrentInterfaceWidget,int ColumnCount,IConvertor *pConvertor) -{ - InterIConvertor*tpConvertor=dynamic_cast(pConvertor); - if(!tpConvertor) return true; - QString outputfilename=GenerateSlfFileName(pCurrentInterfaceWidget); - if(outputfilename=="") { - QMessageBox::about(NULL,"提示","请先输入井名!"); - return 1; - } - vector OutCurveNo; - vector OutCurve; - vector strChineseName; - vector strUnit; - QLineEdit *edittop=pCurrentInterfaceWidget->GetEditTopDepth(); - QLineEdit *editbottom=pCurrentInterfaceWidget->GetEditBottomDepth(); - QTableWidget *tableWidget=pCurrentInterfaceWidget->GetDataSelectAreaWidget(); - iRow=tableWidget->rowCount(); - for (int i=0;iitem(i,0)) { - char *curvename = new char[10]; - strcpy(curvename, "ERROR"); - OutCurve.push_back(curvename); - strChineseName.push_back(curvename); - char *curveunit = new char[10]; - strcpy(curveunit,""); - strUnit.push_back(curveunit); - OutCurveNo.push_back(-1); - continue; - } - eState=tableWidget->item(i,0)->checkState(); - if (eState==Qt::Checked) - { - //修改曲线单位 - OutCurveNo.push_back(i); - } - else OutCurveNo.push_back(-1); - - QString tstr=tableWidget->item(i,3)->text(); - char *curvename = new char[strlen(tstr.toStdString().c_str())+10]; - strcpy(curvename,tstr.toStdString().c_str()); - OutCurve.push_back(curvename); - strChineseName.push_back(curvename); - tstr=tableWidget->item(i,4)->text(); - char *curveunit = new char[strlen(tstr.toStdString().c_str())+10]; - strcpy(curveunit,tstr.toStdString().c_str()); - strUnit.push_back(curveunit); - } - if(tpConvertor->m_TableName.isEmpty()&&IsHaveSameCurve(iRow,OutCurveNo,OutCurve)){ - for(int i=0;im_TableName.isEmpty()) { - HaveOut=CheckExistCurve(outputfilename,iRow,OutCurveNo,OutCurve); - } - else { - vector OutCurveNo; - vector OutCurve; - OutCurveNo.push_back(0); - char *buf=new char[strlen(tpConvertor->m_TableName.toStdString().c_str())+1]; - strcpy(buf,tpConvertor->m_TableName.toStdString().c_str()); - OutCurve.push_back(buf); - HaveOut=CheckExistCurve(outputfilename,1,OutCurveNo,OutCurve); - delete buf; - } - if(HaveOut==0){ - for(int i=0;iGetXCodeLineEdit(); - QLineEdit * yEdit=pCurrentInterfaceWidget->GetYCodeLineEdit(); - - int l=strlen(outfile)+1; - strcpy(&outfile[l],xEdit->text().toStdString().c_str());//x坐标 - - l+=strlen(&outfile[l])+1; - strcpy(&outfile[l],yEdit->text().toStdString().c_str());//y坐标 - - QString top=edittop->text(); - l+=strlen(&outfile[l])+1; - strcpy(&outfile[l],top.toStdString().c_str());//y坐标 - - QString bottom=editbottom->text(); - l+=strlen(&outfile[l])+1; - strcpy(&outfile[l],bottom.toStdString().c_str());//y坐标 - //TODO - l+=strlen(&outfile[l])+1; - *(int*)&outfile[l]=iRow; - - // QString strCh(logfilename); // 汉字路径转换 - // // QString strChOut(outfile); // 汉字路径转换 - if(((InterIConvertor*)(pCurrentInterfaceWidget->m_pConvertor))->Transfer(/*strCh.toLocal8Bit().data()*/UTF8ToGBK(logfilename).data(),outfile/*strChOut.toLocal8Bit().data()*/,&OutCurveNo[0],&OutCurve[0],&strChineseName[0],&strUnit[0],iRow)) - { - MyWelllogRound *wellRound=pCurrentInterfaceWidget->m_pConvertor->GetWellLogRoundInfo(); - if(wellRound) { - ((InterIConvertor*)(pCurrentInterfaceWidget->m_pConvertor))->InitWellInfo(outfile); - wellRound->SaveMeesge(outfile); - } - CDataImport::ChangetoSlf(outfile,NULL); - // ChangetoSlf(outfile,NULL,true); - } - for(int i=0;iGetWellNameLineEdit()->text(); - if(wellname.isEmpty()) return ""; - wellname=wellname.toUpper(); - QString filename=pCurrentInterfaceWidget->GetWellRoundNameLineEdit()->text(); - if(filename.isEmpty()) filename=wellname; - filename=filename.toUpper(); - // //CObjProject *pPrj=::GetProject(); - // if(!m_CurrentWellRoundName.isEmpty()) { - // int ret=QMessageBox::No; - // if(m_CurrentWellRoundName.compare(filename,Qt::CaseInsensitive)!=0) - // { - // ret=QMessageBox::warning(NULL,"提示","输入文件名与选中的井次名不一致,您确信要创建新井名?",QMessageBox::Yes,QMessageBox::No); - // } - // if(ret==QMessageBox::No) { - // CObjWelllogRound *pWR=dynamic_cast(pPrj->GetObjectByName(m_CurrentWellRoundName,GetClassID_WellLogRound())); - // if(pWR) - // { - // QString welln=pWR->GetSlfFileName(); - // if(!welln.isEmpty()) return welln; - // } - // } - // } - // PaiObject *pObj=pPrj->GetObjectByName(wellname,GetClassID_Well()); - // CObjWell *pWell=dynamic_cast(pObj); - // if(pWell) { - // QString slf=pWell->GetWellMessageFileName(); - // QString welln,path; - // GetWellNameAndPath(slf,welln,path); - // welln=path+"\\"+filename; - // welln+=".slf"; - // filename=welln; - // return welln; - // } -/* - //Type(GetClassID_WellsFolder()); - QList childs; - pObj->GetChildren(childs); - int wellnum=childs.count(); - foreach(PaiObject *pChild,childs) - { - CObjWell *pWell=dynamic_cast(pChild); - if(pWell) - { - QString well=pWell->GetName().toUpper(); - if(well==wellname) - { - QList childsRound; - pChild->GetChildren(childsRound); - foreach(PaiObject *pChildRound,childsRound) - { - CObjWelllogRound *pWellRound=dynamic_cast(pChildRound); - if(pWellRound) - { - QString file=pWellRound->GetName().toUpper(); - if(file==filename) - { - QString outname=pWellRound->GetSlfFileName(); - return outname; - } - } - } - } - } - } -#pragma endregion 检查该井名文件名是否存在 -*/ - // QString strWellName=""; - // CObjProject *pProject = ::GetProject(); - // if(pProject != NULL) - // { - // strWellName = pProject->GetName(); - // } - // QString dir=::GetLogdataPath(); - // QDir w; - // if(!strWellName.isEmpty()) { - // dir=dir+strWellName; - // w.mkdir(dir); - // dir+=QDir::separator(); - // } - // dir+="#"+wellname; - // bool a=w.mkdir(dir); - - // QFileInfo temDir(filename); - // QString tempWellName=temDir.completeBaseName(); - // QString ss=dir+QDir::separator()+tempWellName+".slf"; - // return ss; - // "D:/LogPlus/LogData/例子2/#JPH-307-1/JPH-307-1.slf"; - // QString wellSlfFile = "D:/LogPlus/LogData/"; - // wellSlfFile +=m_projectname + "/"+"#"+wellname + "/" + filename +".slf"; - QString wellSlfFile = GetLogdataPath() +m_projectname + "/"+"#"+wellname + "/" + filename +".slf"; - //QString wellSlfFile = GetLogdataPath() +m_projectname + "/"+"#"+wellname.toLocal8Bit() + "/" + filename.toLocal8Bit() +".slf"; - return wellSlfFile; -} - - -END_OSGGRAPHICS_NAMESPACE; - - +#include "ui_importdataDialog.h" +#include "ImportdataDialog.h" +#include "InterIConvertor.h" +#include "IConvertor.h" +//#include "ObjWelllogRound.h" +#include +#include +#include "DataImport.h" +#include "CStringType.h" +#include "MyWelllogRound.h" +#include "tishidialog.h" +#include "ui_interfaceWidget.h" +//#include "ObjectEvent.h" +#include "ObjWell.h" +#include "MemRdWt.h" +BEGIN_OSGGRAPHICS_NAMESPACE; +ImportDataDialog::ImportDataDialog(QWidget *parent,QString wellname,QString wellroundname): QDialog(parent),m_FilePath(""),m_ExistSameWellName(false),m_ExistSameWellRoundName(false) +{ + m_CurrentWellName=wellname; + m_CurrentWellRoundName=wellroundname; + m_pImportDataUI=new Ui::ImportData(); + m_pImportDataUI->setupUi(this); + m_pImportDataUI->tabWidget->removeTab(1); + m_pImportDataUI->tabWidget->removeTab(0); + connect(m_pImportDataUI->pushButton_2, SIGNAL(clicked()), this, SLOT(AcceptOK())); + connect(m_pImportDataUI->pushButton, SIGNAL(clicked()), this, SLOT(reject())); + //whp add 2019.10.12 + connect(m_pImportDataUI->pushButton_3, SIGNAL(clicked()), this, SLOT(SelAll())); + connect(m_pImportDataUI->pushButton_4, SIGNAL(clicked()), this, SLOT(NotSelAll())); + connect(m_pImportDataUI->pushButton_5, SIGNAL(clicked()), this, SLOT(ReverseSel())); + setAttribute( Qt::WA_DeleteOnClose ,true ); + setWindowTitle("Import Well-Logging-Data"); + m_pImportDataUI->pushButton_2->setIcon(QIcon( ::GetImagePath() + "icon/Import.png")); + m_pImportDataUI->pushButton->setIcon(QIcon( ::GetImagePath() + "icon/Exit.png")); +} + +ImportDataDialog::~ImportDataDialog() +{ + std::map::iterator itor=m_TabInterWidget.begin(); + for (;itor!=m_TabInterWidget.end();itor++) + { + InterfaceWidget *pIterWidget=itor->second; + if (pIterWidget) + { + delete pIterWidget; + pIterWidget=NULL; + } + } + m_TabInterWidget.clear(); + + if (m_pImportDataUI) + { + delete m_pImportDataUI; + m_pImportDataUI=NULL; + } +} + +void ImportDataDialog::DisplayFileInformationAreaData( const QVectorConvertorVector,const QString filePath ) +{ + m_vConvertorVector.clear(); + m_vConvertorVector=ConvertorVector; + std::map&mapBuilderType = + IConvertor::GetFatory().m_map; + std::map::iterator itor = + mapBuilderType.begin(); + m_FilePath=filePath; + + for (int i=0;itabWidget->addTab(tabWidget,QString()); + QHBoxLayout *Mainlayout=new QHBoxLayout(tabWidget); + QHBoxLayout *ScondLayout=new QHBoxLayout(); + Mainlayout->addLayout(ScondLayout); + ScondLayout->addWidget(pInterfaceWidget); + m_pImportDataUI->tabWidget->setTabText(i,ConvertorVector[i]->GetConvertorTypeName()); + pInterfaceWidget->GetDataPreviewArea()->setText(ConvertorVector[i]->GetFileContent(filePath)); + FamilyDelegate* familyDelegate=new FamilyDelegate(this); + pInterfaceWidget->GetDataSelectAreaWidget()->setItemDelegateForColumn(2,familyDelegate); + pInterfaceWidget->m_pConvertor=ConvertorVector[i]; + QStringList fileHead=ConvertorVector[i]->GetListHead(); + if(fileHead.isEmpty()) + fileHead<<"原始名称"<<"原始单位"<<"曲线类别"<<"输出名称"<<"输出单位"; + + ConvertorVector[i]->m_ColumnCount=fileHead.size(); + DisplaySelectAreaData(pInterfaceWidget,fileHead,ConvertorVector[i]); + + //初始化井和井次信息界面 + InitWell(pInterfaceWidget,ConvertorVector[i]); + InitWellLogRound(pInterfaceWidget,ConvertorVector[i]); + } +} +void ImportDataDialog::InitWell(InterfaceWidget *pInterfaceWidget,IConvertor*pConvertor) +{ + MyWelllogRound *wellinfo=pConvertor->GetWellLogRoundInfo(); + //无井代码 + if(m_CurrentWellName!="") + pInterfaceWidget->GetWellNameLineEdit()->insert(m_CurrentWellName); + else + { + QString tempWellName=QString::fromStdString(wellinfo->GetWellName());//whp add 2020.7.15 + tempWellName=tempWellName.simplified(); + //whp change 2020.3.3 井名提取应该不含".zh"之类的后缀,应该取文件的基本名 + //文件名中有一个以上的“."时,如3Oq.ZH.716,需要井名和文件名区分开,比如a.zh.716和a.wj.716同时解编,井名都取最前面的a,井次名分别为a.zh和a.wj + //pInterfaceWidget->GetWellNameLineEdit()->insert(QString::fromStdString(wellinfo->GetName())); + if(tempWellName=="") + { + QFileInfo temDir(QString::fromStdString(wellinfo->GetName())); + tempWellName=temDir.baseName(); + } + pInterfaceWidget->GetWellNameLineEdit()->insert(tempWellName); + } + pInterfaceWidget->GetWellCompanyNameLineEdit()->insert(QString::fromStdString(wellinfo->GetCompanyName())); + pInterfaceWidget->GetWellAreaNameLineEdit()->insert(QString::fromStdString(wellinfo->GetAreaName())); +// pInterfaceWidget->GetWellCodeLineEdit()->insert("井代码"); + pInterfaceWidget->GetXCodeLineEdit()->setText(QString::number(wellinfo->GetXCode(), 'f', 4)); + pInterfaceWidget->GetYCodeLineEdit()->setText(QString::number(wellinfo->GetYCode(), 'f', 4)); + pInterfaceWidget->GetAslLineEdit()->setText(QString::number(wellinfo->GetAsl(), 'f', 4)); + pInterfaceWidget->GetBslLineEdit()->setText(QString::number(wellinfo->GetBsl(), 'f', 4)); + pInterfaceWidget->GetCWMethodLineEdit()->insert(QString::fromStdString(wellinfo->GetCWMethod())); + pInterfaceWidget->GetBit1ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetBit1Prog())); + pInterfaceWidget->GetBit2ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetBit2Prog())); + pInterfaceWidget->GetBit3ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetBit3Prog())); + pInterfaceWidget->GetBit4ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetBit4Prog())); + pInterfaceWidget->GetBit5ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetBit5Prog())); + pInterfaceWidget->GetCas1ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetCas1Prog())); + pInterfaceWidget->GetCas2ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetCas2Prog())); + pInterfaceWidget->GetCas3ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetCas3Prog())); + pInterfaceWidget->GetCas4ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetCas4Prog())); + pInterfaceWidget->GetCas5ProgLineEdit()->insert(QString::fromStdString(wellinfo->GetCas5Prog())); + pInterfaceWidget->GetCas1ShotLineEdit()->setText(QString::number(wellinfo->GetCas1Shot(), 'f', 4)); + pInterfaceWidget->GetCas2ShotLineEdit()->setText(QString::number(wellinfo->GetCas2Shot(), 'f', 4)); + pInterfaceWidget->GetSC1SDepLineEdit()->setText(QString::number(wellinfo->GetSC1SDep(), 'f', 4)); + pInterfaceWidget->GetSC1EDepLineEdit()->setText(QString::number(wellinfo->GetSC1EDep(), 'f', 4)); + pInterfaceWidget->GetSC2SDepLineEdit()->setText(QString::number(wellinfo->GetSC2SDep(), 'f', 4)); + pInterfaceWidget->GetSC2EDepLineEdit()->setText(QString::number(wellinfo->GetSC2EDep(), 'f', 4)); + pInterfaceWidget->GetWellTypeComboBox()->addItem(QString::fromStdString("直井")); + pInterfaceWidget->GetWellTypeComboBox()->addItem(QString::fromStdString("斜井")); + + QDate SDrilltime; + SDrilltime=QDate::currentDate(); + pInterfaceWidget->GerSDrillDateEdit()->setDate(SDrilltime); + pInterfaceWidget ->GerSDrillDateEdit()->setDisplayFormat("yyyy年 MM月 dd日"); + + QDate EDrilltime; + EDrilltime=QDate::currentDate(); + pInterfaceWidget->GerEDrillDateEdit()->setDate(EDrilltime); + pInterfaceWidget ->GerEDrillDateEdit()->setDisplayFormat("yyyy年 MM月 dd日"); + + QDate Completetime; + Completetime=QDate::currentDate(); + pInterfaceWidget->GerCompleteDateEdit()->setDate(Completetime); + pInterfaceWidget ->GerCompleteDateEdit()->setDisplayFormat("yyyy年 MM月 dd日"); +} +void ImportDataDialog::InitWellLogRound(InterfaceWidget *pInterfaceWidget,IConvertor*pConvertor) +{ + MyWelllogRound *welllogRound=pConvertor->GetWellLogRoundInfo(); + //无测井剖面 + if(m_CurrentWellRoundName!="") + pInterfaceWidget->GetWellRoundNameLineEdit()->insert(m_CurrentWellRoundName); + else + pInterfaceWidget->GetWellRoundNameLineEdit()->insert(QString::fromStdString(welllogRound->GetName())); + pInterfaceWidget->GetCompanyNameLineEdit()->insert(QString::fromStdString(welllogRound->GetCompanyName())); + pInterfaceWidget->GetTeamLineEdit()->insert(QString::fromStdString(welllogRound->GetTeam())); + pInterfaceWidget->GetOperatorLineEdit()->insert(QString::fromStdString(welllogRound->GetOperator())); + pInterfaceWidget->GetMudViscosityLineEdit()->insert(QString::number(welllogRound->GetMudViscosity(), 'f', 4)); + pInterfaceWidget->GetRemarkTextEdit()->setText(QString::fromStdString(welllogRound->GetRemark())); + pInterfaceWidget->GetWaterLossLineEdit()->setText(QString::number(welllogRound->GetWaterLoss(), 'f', 4)); + pInterfaceWidget->GetDensityLineEdit()->setText(QString::number(welllogRound->GetDensity(), 'f', 4)); + pInterfaceWidget->GetResiLineEdit()->setText(QString::number(welllogRound->GetResi(), 'f', 4)); + pInterfaceWidget->GetTempLineEdit()->setText(QString::number(welllogRound->GetTemp(), 'f', 4)); + pInterfaceWidget->GetINTLogLineEdit()->insert(QString::fromStdString(welllogRound->GetINTLog())); + pInterfaceWidget->GetTempBotLineEdit()->setText(QString::number(welllogRound->GetTempBot(), 'f', 4)); + pInterfaceWidget->GetNITINTLineEdit()->insert(QString::fromStdString(welllogRound->GetNITINT())); + pInterfaceWidget->GetIntProgLineEdit()->insert(QString::fromStdString(welllogRound->GetIntProg())); + pInterfaceWidget->GetInteDressLineEdit()->insert(QString::fromStdString(welllogRound->GetInteDress())); + pInterfaceWidget->GetAuditLineEdit()->insert(QString::fromStdString(welllogRound->GetAudit())); + pInterfaceWidget->GetEditTopDepth()->setText("-99999."); + pInterfaceWidget->GetEditBottomDepth()->setText("-99999."); + QString temp_topDepth = (welllogRound->GetTopDepth() > -9999) ? QString::number(welllogRound->GetTopDepth(),'f',6) : "-99999."; + QString temp_botDepth = (welllogRound->GetBottomDepth() > -9999) ? QString::number(welllogRound->GetBottomDepth(),'f',6) : "-99999."; + pInterfaceWidget->GetEditFileSDepth()->setText(temp_topDepth); + pInterfaceWidget->GetEditFileEDepth()->setText(temp_botDepth); + + QDateTime time; + if (welllogRound->GetDate()=="") + { + time=QDateTime::currentDateTime(); + } + else + { + time =QDateTime::fromString(QString::fromStdString(welllogRound->GetDate()), "yyyy-MM-dd"); + } + pInterfaceWidget->GerDateEdit()->setDateTime (time); + pInterfaceWidget ->GerDateEdit()->setDisplayFormat("yyyy年 MM月 dd日"); + ComboxFromConfigFile(pInterfaceWidget->GetSerialComboBox(),"serial"); + ComboxFromConfigFile(pInterfaceWidget->GetItemComboBox(),"wellItem"); + ComboxFromConfigFile(pInterfaceWidget->GetMudTypeComboBox(),"mudType"); +} + + +// CObjWell * ImportDataDialog::GetWellBaseName( IConvertor *pConvertor,const std::string strWellName ) +// { +// CObjWell *pWell(NULL); +// { +// QString strName=QString::fromStdString(strWellName); +// if (!GetProject()) +// { +// if(!CProjectCommand::NewProject(true)) return NULL; +// } +// if( GetProject() ) +// { +// pWell = dynamic_cast( GetProject()->GetObjectByName(strName)); +// if (pWell) +// { +// //pWell->SetDBWell(pConvertor->GetWellInfo()); +// m_ExistSameWellName=true; +// } +// } +// if( !pWell ) +// { +// pWell = new CObjWell(); +// pWell->SetName( strName ); +// pWell->SetDBWell(*(pConvertor->GetWellInfo())); +// if( GetProject() ) +// { +// GetProject()->GetWellsFolder(true)->AddChild( pWell ); +// } +// } +// } + +// return pWell; +// } +void ImportDataDialog::UpdateWell(InterfaceWidget *pInterfaceWidget,IConvertor *pConvertor) +{ + if (!pInterfaceWidget||!pConvertor) + return ; + //井代码接口暂时没有 +// pai::ios::welllog::Well &wellInfo=pConvertor->GetWellInfo(); + InterIConvertor*pIC=dynamic_cast(pConvertor); + MyWelllogRound* wellInfo=pConvertor->GetWellLogRoundInfo(); + QString wellname=pInterfaceWidget->GetWellNameLineEdit()->text(); + wellname=wellname.toUpper(); + if(pIC) strcpy(pIC->FILE_MESSAGE.WellName,wellname.toLocal8Bit().data()); + wellInfo->SetWellName(wellname.toStdString()); + wellInfo->SetName(wellname.toStdString()); + // + wellInfo->SetCompanyName((pInterfaceWidget->GetWellCompanyNameLineEdit()->text()).toStdString()); + wellInfo->SetAreaName((pInterfaceWidget->GetWellAreaNameLineEdit()->text()).toStdString()); +// wellInfo->SetWellCode((pInterfaceWidget->GetWellCodeLineEdit()->text()).toStdString()); + wellInfo->SetCWMethod((pInterfaceWidget->GetCWMethodLineEdit()->text()).toStdString()); + wellInfo->SetXCode((pInterfaceWidget->GetXCodeLineEdit()->text()).toFloat()); + wellInfo->SetYCode((pInterfaceWidget->GetYCodeLineEdit()->text()).toFloat()); + wellInfo->SetAsl((pInterfaceWidget->GetAslLineEdit()->text()).toFloat()); + wellInfo->SetBsl((pInterfaceWidget->GetBslLineEdit()->text()).toFloat()); + wellInfo->SetBit1Prog((pInterfaceWidget->GetBit1ProgLineEdit()->text()).toStdString()); + wellInfo->SetBit2Prog((pInterfaceWidget->GetBit2ProgLineEdit()->text()).toStdString()); + wellInfo->SetBit3Prog((pInterfaceWidget->GetBit3ProgLineEdit()->text()).toStdString()); + wellInfo->SetBit4Prog((pInterfaceWidget->GetBit4ProgLineEdit()->text()).toStdString()); + wellInfo->SetBit5Prog((pInterfaceWidget->GetBit5ProgLineEdit()->text()).toStdString()); + wellInfo->SetCas1Prog((pInterfaceWidget->GetCas1ProgLineEdit()->text()).toStdString()); + wellInfo->SetCas2Prog((pInterfaceWidget->GetCas2ProgLineEdit()->text()).toStdString()); + wellInfo->SetCas3Prog((pInterfaceWidget->GetCas3ProgLineEdit()->text()).toStdString()); + wellInfo->SetCas4Prog((pInterfaceWidget->GetCas4ProgLineEdit()->text()).toStdString()); + wellInfo->SetCas5Prog((pInterfaceWidget->GetCas5ProgLineEdit()->text()).toStdString()); + wellInfo->SetCas1Shot((pInterfaceWidget->GetCas1ShotLineEdit()->text()).toFloat()); + wellInfo->SetCas2Shot((pInterfaceWidget->GetCas2ShotLineEdit()->text()).toFloat()); + wellInfo->SetSC1SDep((pInterfaceWidget->GetSC1SDepLineEdit()->text()).toFloat()); + wellInfo->SetSC1EDep((pInterfaceWidget->GetSC1EDepLineEdit()->text()).toFloat()); + wellInfo->SetSC2SDep((pInterfaceWidget->GetSC2SDepLineEdit()->text()).toFloat()); + wellInfo->SetSC2EDep((pInterfaceWidget->GetSC2EDepLineEdit()->text()).toFloat()); + wellInfo->SetSDrillDate(pInterfaceWidget->GerSDrillDateEdit()->date().toString("yyyy年-MM月-dd日").toStdString()); + wellInfo->SetEDrillDate(pInterfaceWidget->GerEDrillDateEdit()->date().toString("yyyy年-MM月-dd日").toStdString()); + wellInfo->SetCompleteDate(pInterfaceWidget->GerCompleteDateEdit()->date().toString("yyyy年-MM月-dd日").toStdString()); + wellInfo->SetWellType((pInterfaceWidget->GetWellTypeComboBox()->currentText()).toInt()); + +} + +void ImportDataDialog::UpdateWellLogRound(InterfaceWidget *pInterfaceWidget,IConvertor *pConvertor) +{ + if (!pInterfaceWidget||!pConvertor) + return ; + //剖面接口暂时没有 + MyWelllogRound *wellRound=pConvertor->GetWellLogRoundInfo(); + wellRound->SetCompanyName((pInterfaceWidget->GetCompanyNameLineEdit()->text()).toStdString()); + wellRound->SetTeam((pInterfaceWidget->GetTeamLineEdit()->text()).toStdString()); + wellRound->SetOperator((pInterfaceWidget->GetOperatorLineEdit()->text()).toStdString()); + wellRound->SetMudViscosity((pInterfaceWidget->GetMudViscosityLineEdit()->text()).toFloat()); + wellRound->SetRemark(pInterfaceWidget->GetRemarkTextEdit()->toPlainText().toStdString()); + wellRound->SetWaterLoss((pInterfaceWidget->GetWaterLossLineEdit()->text()).toFloat()); + wellRound->SetDensity((pInterfaceWidget->GetDensityLineEdit()->text()).toFloat()); + wellRound->SetResi((pInterfaceWidget->GetResiLineEdit()->text()).toFloat()); + wellRound->SetTemp((pInterfaceWidget->GetTempLineEdit()->text()).toFloat()); + wellRound->SetINTLog((pInterfaceWidget->GetINTLogLineEdit()->text()).toStdString()); + wellRound->SetTempBot((pInterfaceWidget->GetTempBotLineEdit()->text()).toFloat()); + wellRound->SetNITINT((pInterfaceWidget->GetNITINTLineEdit()->text()).toStdString()); + wellRound->SetIntProg((pInterfaceWidget->GetIntProgLineEdit()->text()).toStdString()); + wellRound->SetInteDress((pInterfaceWidget->GetInteDressLineEdit()->text()).toStdString()); + wellRound->SetAudit((pInterfaceWidget->GetAuditLineEdit()->text()).toStdString()); + wellRound->SetMudType((pInterfaceWidget->GetMudTypeComboBox()->currentText()).toStdString()); + wellRound->SetItem((pInterfaceWidget->GetItemComboBox()->currentText()).toStdString()); + wellRound->SetSerial((pInterfaceWidget->GetSerialComboBox()->currentText()).toStdString()); + wellRound->SetDate(pInterfaceWidget->GerDateEdit()->date().toString("yyyy年-MM月-dd日").toStdString()); + +} +void ImportDataDialog::AcceptOK() +{ + //whp del 2020.3.16 for 当井名不合理时,提示用户,然后回到解编界面,让用户修改,修改完后,再加载 + //disconnect(m_pImportDataUI->pushButton_2, SIGNAL(clicked()), 0,0); + m_ExistSameWellRoundName=false;//TODO 多模块可同时解析一个文件时,需要处理 + InterfaceWidget *pCurrentInterfaceWidget(NULL); + std::map< QWidget*,InterfaceWidget* >::iterator itor = m_TabInterWidget.find( m_pImportDataUI->tabWidget->currentWidget() ); + int index=m_pImportDataUI->tabWidget->currentIndex(); + if( itor != m_TabInterWidget.end() ) + { + pCurrentInterfaceWidget=itor->second; + } + if (!pCurrentInterfaceWidget) + return ; + //whp add 2020.3.16 + QString wellname=pCurrentInterfaceWidget->GetWellNameLineEdit()->text(); + if(wellname=="") + { + QMessageBox::warning(NULL,"提示","井名不能为空"); + return ; + } + if(!IsValidWellName(wellname)) + { + QMessageBox::warning(NULL,"提示","'"+wellname+"'不符合井名命名规则");return ; + } + // + //std::map >::iterator it=m_ConvertorWellLog.find(m_vConvertorVector[index]); + //更新井次和井信息 + UpdateWell(pCurrentInterfaceWidget,m_vConvertorVector[index]); + UpdateWellLogRound(pCurrentInterfaceWidget,m_vConvertorVector[index]); + + std::string wellLogRoundName=m_vConvertorVector[index]->GetWellLogRoundInfo()->GetWellName(); + + if(/*!wellName.length()||*/!wellLogRoundName.length()) + { + QMessageBox::about(NULL,"提示","井次名和井名不可为空!"); + return ; + } + WellCurve wc=((InterIConvertor *)m_vConvertorVector[index])->GetWellCurves(); + if(SelectAndDeleteWellLog(wc.Curve_Num,pCurrentInterfaceWidget,m_vConvertorVector[index]->m_ColumnCount,m_vConvertorVector[index])) + return; + //释放未被选取的解编器内存 + QDialog::accept(); +// ::GetObjectEvent().OnRefreshData(wellname,""); +} +//whp add 2019.10.12 +void ImportDataDialog::SelAll() +{ + InterfaceWidget *pCurrentInterfaceWidget(NULL); + std::map< QWidget*,InterfaceWidget* >::iterator itor = m_TabInterWidget.find( m_pImportDataUI->tabWidget->currentWidget() ); + int index=m_pImportDataUI->tabWidget->currentIndex(); + if( itor != m_TabInterWidget.end() ) + { + pCurrentInterfaceWidget=itor->second; + } + if (!pCurrentInterfaceWidget) + return ; + QTableWidget *tableWidget=pCurrentInterfaceWidget->GetDataSelectAreaWidget(); + int iRow=tableWidget->rowCount(); + for (int i=0;iitem(i,0)->setCheckState(Qt::Checked); + } +} +void ImportDataDialog::NotSelAll() +{ + InterfaceWidget *pCurrentInterfaceWidget(NULL); + std::map< QWidget*,InterfaceWidget* >::iterator itor = m_TabInterWidget.find( m_pImportDataUI->tabWidget->currentWidget() ); + int index=m_pImportDataUI->tabWidget->currentIndex(); + if( itor != m_TabInterWidget.end() ) + { + pCurrentInterfaceWidget=itor->second; + } + if (!pCurrentInterfaceWidget) + return ; + QTableWidget *tableWidget=pCurrentInterfaceWidget->GetDataSelectAreaWidget(); + int iRow=tableWidget->rowCount(); + for (int i=0;iitem(i,0)->setCheckState(Qt::Unchecked); + } +} +void ImportDataDialog::ReverseSel() +{ + InterfaceWidget *pCurrentInterfaceWidget(NULL); + std::map< QWidget*,InterfaceWidget* >::iterator itor = m_TabInterWidget.find( m_pImportDataUI->tabWidget->currentWidget() ); + int index=m_pImportDataUI->tabWidget->currentIndex(); + if( itor != m_TabInterWidget.end() ) + { + pCurrentInterfaceWidget=itor->second; + } + if (!pCurrentInterfaceWidget) + return ; + QTableWidget *tableWidget=pCurrentInterfaceWidget->GetDataSelectAreaWidget(); + int iRow=tableWidget->rowCount(); + for (int i=0;iitem(i,0)->checkState(); + if (eState==Qt::Checked)tableWidget->item(i,0)->setCheckState(Qt::Unchecked); + else tableWidget->item(i,0)->setCheckState(Qt::Checked); + } +} +void ImportDataDialog::DisplaySelectAreaData( InterfaceWidget *pInterface,const QStringList fileHead,IConvertor *pConvertor) +{ + int iRow(0),iOrder(0); + + vector CurveNames=((InterIConvertor*)pConvertor)->GetCurveNames(); + vector CurveUnits=((InterIConvertor*)pConvertor)->GetCurveUnits(); + WellCurve WellCurves= ((InterIConvertor*)pConvertor)->GetWellCurves(); + + //pConvertor->GetWellLogList(m_FilePath); + iRow=WellCurves.Curve_Num;//m_ConvertorWellLog[pConvertor].size(); + pInterface->GetDataSelectAreaWidget()->setColumnCount(fileHead.size()); + pInterface->GetDataSelectAreaWidget()->setRowCount(iRow); + for (int i=0;iGetDataSelectAreaWidget()->setColumnWidth(i,150); + if(i==1) pInterface->GetDataSelectAreaWidget()->setColumnWidth(i,80); + if(i==2) pInterface->GetDataSelectAreaWidget()->setColumnWidth(i,80); + if(i==3) pInterface->GetDataSelectAreaWidget()->setColumnWidth(i,150); + if (i==4) + { + pInterface->GetDataSelectAreaWidget()->setColumnWidth(i,80); + } + + pInterface->GetDataSelectAreaWidget()->horizontalHeader()->setStretchLastSection(true); + } + //pInterface->m_pInterfaceUI->widget->setFixedWidth(560); + pInterface->GetDataSelectAreaWidget()->setHorizontalHeaderLabels(fileHead); + QHeaderView* headerView = pInterface->GetDataSelectAreaWidget()->verticalHeader(); + //headerView->setHidden(true); + pInterface->GetDataSelectAreaWidget()->setAlternatingRowColors(true); + pInterface->GetDataSelectAreaWidget()->setSelectionBehavior(QAbstractItemView::SelectRows); + for (int i=0;isetCheckState(Qt::Checked); //加入复选框 + head->setFlags(head->flags() ^ Qt::ItemIsEditable); + head->setText(CurveNames[i]);//曲线名 + + pInterface->GetDataSelectAreaWidget()->setItem(i,0,head); //插入该Item + QString unit=QString::fromLocal8Bit(CurveUnits[i]); + pInterface->GetDataSelectAreaWidget()->setItem(i,1,new QTableWidgetItem(unit));//导入曲线单位 + pInterface->GetDataSelectAreaWidget()->setItem(i,2,new QTableWidgetItem(""));//family));// + pInterface->GetDataSelectAreaWidget()->setItem(i,3,new QTableWidgetItem(CurveNames[i]));//导入曲线名 + pInterface->GetDataSelectAreaWidget()->setItem(i,4,new QTableWidgetItem(unit));//导入曲线单位 + //whp add 2019.8.1 for 设置输入曲线单位列为只读 + auto rFlags = pInterface->GetDataSelectAreaWidget()->item(i,1)->flags(); + pInterface->GetDataSelectAreaWidget()->item(i,1)->setFlags(rFlags & (~Qt::ItemIsEditable)); + iOrder++; + } +} +bool ImportDataDialog::IsHaveSameCurve(int NumLog,vector &OutCurveNo,vector &OutCurve) +{ + QString str,mes=""; + int SameNameCurveNum=0; + QStringList ExistName; + for(int i=0;i=0)continue; + int no=0; + str="\r\n第"+QString::number(i+1)+"条和第"; + for(int j=i+1;j=0)) + { + if(no>0)str+="、"; + str+=QString::number(j+1); + no++; + } + } + if(no==0)continue; + ExistName.append(QString(QLatin1String(OutCurve[i]))); + SameNameCurveNum++; + if(SameNameCurveNum<30) mes+=str+"条输出曲线名字为"+QString(QLatin1String(OutCurve[i])); + else if(SameNameCurveNum==30) mes+="\n重名>=30条..."; + } + if(SameNameCurveNum>0) + { + /*str=CString("您所选择的解编曲线中存在下列同名曲线,请修改同名曲线,然后再解编\r\n\r\n")+mes; + AfxMessageBox(str); + return 1;*/ + QString inf="您所选择的解编曲线中存在下列同名曲线:\r\n\r\n"+mes+"\r\n\r\n是否对同名曲线进行解编?"; + QMessageBox box(QMessageBox::Warning,"提示",mes); + box.setStandardButtons (QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel); + box.setButtonText (QMessageBox::Yes,QString("自动重命名")); + box.setButtonText (QMessageBox::No,QString("跳过同名曲线")); + box.setButtonText (QMessageBox::Cancel,QString("返回、修改")); + int ret=box.exec(); + if(ret==QMessageBox::Cancel)return 1; + QStringList OutCurveList; + for(int i=0;i=0) + { + int no=1; + for(int j=i+1;j& OutCurveNo,vector& OutCurve) +{ //1-有输出曲线,需要继续输出,0-经跳过功能后,没有曲线要输出了,-1退回原界面 + CMemRdWt *logio=new CMemRdWt(); + if(!logio->Open(filename.toStdString().c_str(),CSlfIO::modeRead)) + { + delete logio; + return 1; + } + CString str,mes=""; + vector ExistCurveNo; + vector ExistCurve; + int ExistCurveNum=0; + for(int i=0;iFindObjectName(OutCurve[i],-1,-1,OBJECT_NORMAL); + if(logio->FindObjectName(OutCurve[i],-1,-1,OBJECT_NORMAL)<0)continue; + ExistCurve.push_back(OutCurve[i]); + ExistCurveNo.push_back(i); + } + if(ExistCurve.size()==0) + { + delete logio; + return 1; + } + TiShiDialog *dlg=new TiShiDialog(NULL); + dlg->init(ExistCurve,""); + if(dlg->exec()==Accepted) + { + if(dlg->flag==0)//跳过 + { + for(int i=0;iflag==1)//替换 + { + for(int i=0;iDiscardObject(ExistCurve[i]); + } + } + else if(dlg->flag==3)//另存 + { + QStringList OutCurveList; + for(int i=0;iGetObjectCount();i++) + { + char name[64]; + if(logio->GetObjectStatus(i)!=OBJECT_NORMAL)continue; + logio->GetObjectName(i,name); + OutCurveList.append(QString(name)); + } + for(int i=0;itoStdString()->c_str()); + delete temp; + } + } + delete logio; + delete dlg; + } + else + { + delete logio; + delete dlg; + return -1; + } + for(int i=0;i=0) return 1; + } + return 0; +} + +void CreateWellFile(CLogIO *logio,Slf_FILE_MESSAGE &mssage,QString wellFile,CObjWell *pWell) +{ + if(logio) { + CLogIO * logiowell=new CLogIO(); + Slf_FILE_MESSAGE ms=mssage; + strcpy(ms.Item,"井基本信息"); + logiowell->Open(wellFile.toStdString().c_str(),CSlfIO::modeWrite); + logiowell->SetFileMessage(ms); + QStringList azims=GetSimilarCurves("AZIM"); + int iAZIM=-1; + QString AZIM; + foreach(QString cname,azims) + { + iAZIM=logio->FindObjectName((char *)cname.toStdString().c_str()); + if(iAZIM>-1) { + AZIM=cname; + break; + } + } + int iDev=-1; + QStringList devis=GetSimilarCurves("DEVI"); + QString DEV; + foreach(QString cname,devis) + { + iDev=logio->FindObjectName((char *)cname.toStdString().c_str()); + if(iDev>-1) { + DEV=cname; + break; + } + } + // if(logio->FindObjectIndex("井基本信息")>-1) { + // logiowell->CopyFromFile((CSlfIO &)(*logio),"井基本信息"); + // } + if(iAZIM>-1)logiowell->CopyFromFile((CSlfIO &)(*logio),(char *)AZIM.toStdString().c_str()); + if(iDev>-1)logiowell->CopyFromFile((CSlfIO &)(*logio),(char *)DEV.toStdString().c_str()); + delete logiowell; + if(iDev>-1&&iAZIM>-1) { + pWell->ComputeTrajectory(pWell,wellFile); + } + } +} + +bool ImportDataDialog::SelectAndDeleteWellLog(int iRow,InterfaceWidget *pCurrentInterfaceWidget,int ColumnCount,IConvertor *pConvertor) +{ + InterIConvertor*tpConvertor=dynamic_cast(pConvertor); + if(!tpConvertor) return true; + QString outputfilename=GenerateSlfFileName(pCurrentInterfaceWidget); + if(outputfilename=="") { + QMessageBox::about(NULL,"提示","请先输入井名!"); + return 1; + } + vector OutCurveNo; + vector OutCurve; + vector strChineseName; + vector strUnit; + QLineEdit *edittop=pCurrentInterfaceWidget->GetEditTopDepth(); + QLineEdit *editbottom=pCurrentInterfaceWidget->GetEditBottomDepth(); + QTableWidget *tableWidget=pCurrentInterfaceWidget->GetDataSelectAreaWidget(); + iRow=tableWidget->rowCount(); + for (int i=0;iitem(i,0)) { + char *curvename = new char[10]; + strcpy(curvename, "ERROR"); + OutCurve.push_back(curvename); + strChineseName.push_back(curvename); + char *curveunit = new char[10]; + strcpy(curveunit,""); + strUnit.push_back(curveunit); + OutCurveNo.push_back(-1); + continue; + } + eState=tableWidget->item(i,0)->checkState(); + if (eState==Qt::Checked) + { + //修改曲线单位 + OutCurveNo.push_back(i); + } + else OutCurveNo.push_back(-1); + + QString tstr=tableWidget->item(i,3)->text(); + char *curvename = new char[strlen(tstr.toStdString().c_str())+10]; + strcpy(curvename,tstr.toStdString().c_str()); + OutCurve.push_back(curvename); + strChineseName.push_back(curvename); + tstr=tableWidget->item(i,4)->text(); + char *curveunit = new char[strlen(tstr.toStdString().c_str())+10]; + strcpy(curveunit,tstr.toStdString().c_str()); + strUnit.push_back(curveunit); + } + if(tpConvertor->m_TableName.isEmpty()&&IsHaveSameCurve(iRow,OutCurveNo,OutCurve)){ + for(int i=0;im_TableName.isEmpty()) { + HaveOut=CheckExistCurve(outputfilename,iRow,OutCurveNo,OutCurve); + } + else { + vector OutCurveNo; + vector OutCurve; + OutCurveNo.push_back(0); + char *buf=new char[strlen(tpConvertor->m_TableName.toStdString().c_str())+1]; + strcpy(buf,tpConvertor->m_TableName.toStdString().c_str()); + OutCurve.push_back(buf); + HaveOut=CheckExistCurve(outputfilename,1,OutCurveNo,OutCurve); + delete buf; + } + if(HaveOut==0){ + for(int i=0;iGetXCodeLineEdit(); + QLineEdit * yEdit=pCurrentInterfaceWidget->GetYCodeLineEdit(); + + int l=strlen(outfile)+1; + strcpy(&outfile[l],xEdit->text().toStdString().c_str());//x坐标 + + l+=strlen(&outfile[l])+1; + strcpy(&outfile[l],yEdit->text().toStdString().c_str());//y坐标 + + QString top=edittop->text(); + l+=strlen(&outfile[l])+1; + strcpy(&outfile[l],top.toStdString().c_str());//y坐标 + + QString bottom=editbottom->text(); + l+=strlen(&outfile[l])+1; + strcpy(&outfile[l],bottom.toStdString().c_str());//y坐标 + //TODO + l+=strlen(&outfile[l])+1; + *(int*)&outfile[l]=iRow; + + // QString strCh(logfilename); // 汉字路径转换 + // // QString strChOut(outfile); // 汉字路径转换 + if(((InterIConvertor*)(pCurrentInterfaceWidget->m_pConvertor))->Transfer(/*strCh.toLocal8Bit().data()*/UTF8ToGBK(logfilename).data(),outfile/*strChOut.toLocal8Bit().data()*/,&OutCurveNo[0],&OutCurve[0],&strChineseName[0],&strUnit[0],iRow)) + { + MyWelllogRound *wellRound=pCurrentInterfaceWidget->m_pConvertor->GetWellLogRoundInfo(); + if(wellRound) { + ((InterIConvertor*)(pCurrentInterfaceWidget->m_pConvertor))->InitWellInfo(outfile); + wellRound->SaveMeesge(outfile); + } + CDataImport::ChangetoSlf(outfile,NULL); + // ChangetoSlf(outfile,NULL,true); + } + for(int i=0;iGetWellNameLineEdit()->text(); + if(wellname.isEmpty()) return ""; + wellname=wellname.toUpper(); + QString filename=pCurrentInterfaceWidget->GetWellRoundNameLineEdit()->text(); + if(filename.isEmpty()) filename=wellname; + filename=filename.toUpper(); + // //CObjProject *pPrj=::GetProject(); + // if(!m_CurrentWellRoundName.isEmpty()) { + // int ret=QMessageBox::No; + // if(m_CurrentWellRoundName.compare(filename,Qt::CaseInsensitive)!=0) + // { + // ret=QMessageBox::warning(NULL,"提示","输入文件名与选中的井次名不一致,您确信要创建新井名?",QMessageBox::Yes,QMessageBox::No); + // } + // if(ret==QMessageBox::No) { + // CObjWelllogRound *pWR=dynamic_cast(pPrj->GetObjectByName(m_CurrentWellRoundName,GetClassID_WellLogRound())); + // if(pWR) + // { + // QString welln=pWR->GetSlfFileName(); + // if(!welln.isEmpty()) return welln; + // } + // } + // } + // PaiObject *pObj=pPrj->GetObjectByName(wellname,GetClassID_Well()); + // CObjWell *pWell=dynamic_cast(pObj); + // if(pWell) { + // QString slf=pWell->GetWellMessageFileName(); + // QString welln,path; + // GetWellNameAndPath(slf,welln,path); + // welln=path+"\\"+filename; + // welln+=".slf"; + // filename=welln; + // return welln; + // } +/* + //Type(GetClassID_WellsFolder()); + QList childs; + pObj->GetChildren(childs); + int wellnum=childs.count(); + foreach(PaiObject *pChild,childs) + { + CObjWell *pWell=dynamic_cast(pChild); + if(pWell) + { + QString well=pWell->GetName().toUpper(); + if(well==wellname) + { + QList childsRound; + pChild->GetChildren(childsRound); + foreach(PaiObject *pChildRound,childsRound) + { + CObjWelllogRound *pWellRound=dynamic_cast(pChildRound); + if(pWellRound) + { + QString file=pWellRound->GetName().toUpper(); + if(file==filename) + { + QString outname=pWellRound->GetSlfFileName(); + return outname; + } + } + } + } + } + } +#pragma endregion 检查该井名文件名是否存在 +*/ + // QString strWellName=""; + // CObjProject *pProject = ::GetProject(); + // if(pProject != NULL) + // { + // strWellName = pProject->GetName(); + // } + // QString dir=::GetLogdataPath(); + // QDir w; + // if(!strWellName.isEmpty()) { + // dir=dir+strWellName; + // w.mkdir(dir); + // dir+=QDir::separator(); + // } + // dir+="#"+wellname; + // bool a=w.mkdir(dir); + + // QFileInfo temDir(filename); + // QString tempWellName=temDir.completeBaseName(); + // QString ss=dir+QDir::separator()+tempWellName+".slf"; + // return ss; + // "D:/LogPlus/LogData/例子2/#JPH-307-1/JPH-307-1.slf"; + // QString wellSlfFile = "D:/LogPlus/LogData/"; + // wellSlfFile +=m_projectname + "/"+"#"+wellname + "/" + filename +".slf"; + QString wellSlfFile = GetLogdataPath() +m_projectname + "/"+"#"+wellname + "/" + filename +".slf"; + //QString wellSlfFile = GetLogdataPath() +m_projectname + "/"+"#"+wellname.toLocal8Bit() + "/" + filename.toLocal8Bit() +".slf"; + return wellSlfFile; +} + + +END_OSGGRAPHICS_NAMESPACE; + + diff --git a/ConvertorManager/src/InterIConvertor.cpp b/ConvertorManager/src/InterIConvertor.cpp index c62ed95..9739115 100644 --- a/ConvertorManager/src/InterIConvertor.cpp +++ b/ConvertorManager/src/InterIConvertor.cpp @@ -1,320 +1,320 @@ -#include -#include "InterIConvertor.h" -#include "MemRdWt.h" -#include "CStringType.h" -//#include "ObjWelllogWavefile.h" -#include "BaseFun.h" -#include "geometryutils.h" -#include -BEGIN_OSGGRAPHICS_NAMESPACE; - -InterIConvertor::InterIConvertor():IConvertor(),m_fileMessage(NULL), - m_DepthLength(0), - m_DimCurvefilePath("") -{ - memset(&WellDynamicInfo,0,sizeof(WELL_DYNAMIC_INFO)); - memset(&FILE_MESSAGE,0,sizeof(Slf_FILE_MESSAGE)); - memset(&WellStaticInfo,0,sizeof(WELL_STATIC_INFO)); - m_vCurverName.resize(MaxCurve); - for (int i=0;i::iterator itor=m_vCurverName.begin(); - for (;itor!=m_vCurverName.end();) - { - itor=m_vCurverName.erase(itor); - } - m_vCurverName.clear(); -///////ww - itor=m_vCurverUnit.begin(); - for (;itor!=m_vCurverUnit.end();) - { - itor=m_vCurverUnit.erase(itor); - } - m_vCurverUnit.clear(); -/////// - if (m_fileMessage) - { - delete[]m_fileMessage; - m_fileMessage=NULL; - } -} -////////////////// -/// -//用户配置文件后缀 dll文件同名的.cfg文件 -// example :aa.dll =>aa.cfg -// -QVector InterIConvertor::GetSupportFileExtensions() -{ - QVectorexts; - if(!m_thisModuleName.isEmpty()) - { - char *name=new char[1000]; - // D:\LogPlus\bin\ - GetBinDir(name); - QString path=m_thisModuleName; - path=name; - path+="/convertor/"; - path+=m_thisModuleName; - path+=".cfg"; - FILE *fp=fopen(path.toStdString().c_str(),"rt"); - if(fp) - { - while(!feof(fp)) - { - memset(name,0,1000); - fread(name,1000,1,fp); - QString line=name; - line.replace(","," "); - line.replace("\t"," "); - line.replace("\r"," "); - line.replace("\n"," "); - QStringList strs=line.split(" "); - strs.removeAll(""); - foreach(QString str,strs)exts.push_back(str); - } - fclose(fp); - } - delete name; - } - return exts; -} - -QString InterIConvertor::GetFileContent( const QString &filename ) -{ - if(strlen(m_fileMessage)) { - return m_fileMessage; - } - QFile file(filename); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) - return ""; - QString lineString(""); - //读取文件前50行 - for (int row=0;row<50;row++) - { - lineString += "\n"+file.readLine(); - } - return lineString; -} -bool InterIConvertor::Init() -{ - m_TableName=""; - IConvertor::Init(); - memset(&FILE_MESSAGE,0,sizeof(FILE_MESSAGE)); - memset(&WellDynamicInfo,0,sizeof(WELL_DYNAMIC_INFO)); - //whp add 2019.8.1 for 初始化井静态信息 - memset(&WellStaticInfo,0,sizeof(WELL_STATIC_INFO)); - m_DimCurvesList.clear(); - if(m_fileMessage) m_fileMessage[0]=0; - ////ww - for (int i=0;i(tempStr.c_str()); - // QString strCh(filePath); // 汉字路径转换 - int Value= ScanLogFile(UTF8ToGBK(filePath).data()/*strCh.toLocal8Bit().data()*/,m_fileMessage,&m_vCurverName[0],&m_vCurverUnit[0]); - m_CurveData.Curve_Num=Value; - if(Value<=0) return 0;//ww - return Value; -} - -QList pai::graphics::InterIConvertor::GetWellLogList( const QString &filename ) -{ - m_vWellLogCurve.clear(); - if(m_CurveData.Curve_Num<=0) return m_vWellLogCurve; -// GetWellLogMetas( m_vWellLogCurve, filename ); - InitWelllogRoundInfo(filename); - if(WellStaticInfo.XCoor)FILE_MESSAGE.Xcoor=WellStaticInfo.XCoor; - if(WellStaticInfo.YCoor)FILE_MESSAGE.Ycoor=WellStaticInfo.YCoor; - memmove(FILE_MESSAGE.Item,WellStaticInfo.MethodCWell,sizeof(FILE_MESSAGE.Item)); - if(*WellStaticInfo.WellName&&*WellStaticInfo.WellName!=' ')memmove(FILE_MESSAGE.WellName,WellStaticInfo.WellName,sizeof(FILE_MESSAGE.WellName)); - if(*WellStaticInfo.AreaName&&*WellStaticInfo.AreaName!=' ')memmove(FILE_MESSAGE.AreaName,WellStaticInfo.AreaName,sizeof(FILE_MESSAGE.AreaName)); - if(*WellStaticInfo.OilCompanyName&&*WellStaticInfo.OilCompanyName!=' ')memmove(FILE_MESSAGE.OilCompanyName,WellStaticInfo.OilCompanyName,sizeof(FILE_MESSAGE.OilCompanyName)); - if(WellStaticInfo.As1)FILE_MESSAGE.Altitude=WellStaticInfo.As1; - if(WellStaticInfo.Bs1)FILE_MESSAGE.Kelly=WellStaticInfo.Bs1; - if(strlen(WellStaticInfo.EndDrillDate))FILE_MESSAGE.EndDrillDate=StringToTime(WellStaticInfo.EndDrillDate); - if(strlen(WellStaticInfo.StartDrillDate))FILE_MESSAGE.StartDrillDate=StringToTime(WellStaticInfo.StartDrillDate); - if(WellStaticInfo.Sc1Edep)FILE_MESSAGE.StartDepth=WellStaticInfo.Sc1Edep; - if(WellStaticInfo.Sc2sdep)FILE_MESSAGE.EndDepth=WellStaticInfo.Sc2sdep; - if(*(float*)&WellStaticInfo.Remark[0])memmove(&FILE_MESSAGE.X0,&WellStaticInfo.Remark[0],4); - if(*(float*)&WellStaticInfo.Remark[4])memmove(&FILE_MESSAGE.Y0,&WellStaticInfo.Remark[4],4); - if(*(float*)&WellStaticInfo.Remark[8])memmove(&FILE_MESSAGE.TVD,&WellStaticInfo.Remark[8],4);//whp 2019.7.30 该语句会把解编模块扫描得到的TVD数据清空 - //已在ASCII模块中做了相应的处理,不知道别的模块中还有没有 - if(strlen(WellDynamicInfo.LogCompanyName))memmove(FILE_MESSAGE.LogCompanyName,WellDynamicInfo.LogCompanyName,sizeof(FILE_MESSAGE.LogCompanyName)); - if(strlen(WellDynamicInfo.Operator))memmove(FILE_MESSAGE.Operator,WellDynamicInfo.Operator,sizeof(FILE_MESSAGE.Operator)); - if(strlen(WellDynamicInfo.Item))memmove(FILE_MESSAGE.LoggingTeam,WellDynamicInfo.Item,sizeof(FILE_MESSAGE.LoggingTeam)); - if(strlen(WellDynamicInfo.Date))FILE_MESSAGE.LoggingDate=StringToTime(WellDynamicInfo.Date); - //add end - InitWellInfo(filename); - return m_vWellLogCurve; -} - - -QString InterIConvertor::GetfilePath(const char *FileName) -{ - QFileInfo fileInfo(QString::fromLocal8Bit(FileName)); - QDir dir(::GetImagePath()); - dir.cdUp(); - QString tempPath=dir.absolutePath()+"/"+fileInfo.completeBaseName()+".slf"; - - return tempPath; -} -// void InterIConvertor::GetWellLogMetas( QList &vWellLog, QString strWellLogPath) -// { -// //||m_CurveData.Curve_Step==0.0 -// if(m_CurveData.Curve_Num<=0) return;//ww -// for( long j = 0 ; jSetName(curveName); -// pWelllog->SetAliasName(curveName); -// QString curveUnit=QString::fromLocal8Bit(m_vCurverUnit[j] );//ww -// pWelllog->GetLogCurve().SetUnit(curveUnit.toStdString()); -// vWellLog.push_back(pWelllog); -// } - -// } -// void InterIConvertor::GetWellLogObjects( QList &vWellLog, QString strWellLogPath) -// { -// return; -// } - -void InterIConvertor::InitWelllogRoundInfo(QString FileName) -{ - //char LogRange[24],IntRange[24];char Section[16] SetAudit; - if(WellDynamicInfo.MudViscosity)m_WellLogRoundInfo->SetMudViscosity(WellDynamicInfo.MudViscosity); - else if(FILE_MESSAGE.Mud_Viscosity[0]) m_WellLogRoundInfo->SetMudViscosity(FILE_MESSAGE.Mud_Viscosity[0]); - QString LogCompanyName=WellDynamicInfo.LogCompanyName; - LogCompanyName=LogCompanyName.trimmed(); - if(LogCompanyName.length()) m_WellLogRoundInfo->SetCompanyName(WellDynamicInfo.LogCompanyName); - else m_WellLogRoundInfo->SetCompanyName(FILE_MESSAGE.LogCompanyName); - if(strlen(WellDynamicInfo.Date)) m_WellLogRoundInfo->SetDate(WellDynamicInfo.Date); - else { - QString str=ctime((time_t *)&FILE_MESSAGE.LoggingDate); - m_WellLogRoundInfo->SetDate(str.toStdString()); - } - if(WellDynamicInfo.TempBot)m_WellLogRoundInfo->SetTempBot(WellDynamicInfo.TempBot); - else m_WellLogRoundInfo->SetTempBot(FILE_MESSAGE.Well_Bottom_Temperature); - if(WellDynamicInfo.WaterLoss) m_WellLogRoundInfo->SetWaterLoss(WellDynamicInfo.WaterLoss); - else m_WellLogRoundInfo->SetWaterLoss(FILE_MESSAGE.WaterLoss); - if(WellDynamicInfo.MudDensity) m_WellLogRoundInfo->SetDensity(WellDynamicInfo.MudDensity); - else m_WellLogRoundInfo->SetDensity(FILE_MESSAGE.Mud_Density[0]); - - if(WellDynamicInfo.MudResi)m_WellLogRoundInfo->SetResi(WellDynamicInfo.MudResi); - else m_WellLogRoundInfo->SetResi(FILE_MESSAGE.Mud_Resistivity[0]); - if(WellDynamicInfo.MudTemp)m_WellLogRoundInfo->SetTemp(WellDynamicInfo.MudTemp); - else m_WellLogRoundInfo->SetTemp(FILE_MESSAGE.Mud_Temp); - if(WellDynamicInfo.MudType) m_WellLogRoundInfo->SetMudType(WellDynamicInfo.MudType); - else m_WellLogRoundInfo->SetMudType(FILE_MESSAGE.Mud_Property); - m_WellLogRoundInfo->SetIntProg(WellDynamicInfo.IntProg); - m_WellLogRoundInfo->SetInteDress(WellDynamicInfo.IntDress); - m_WellLogRoundInfo->SetRemark(WellDynamicInfo.Remark); - if(strlen(WellDynamicInfo.Operator))m_WellLogRoundInfo->SetOperator(WellDynamicInfo.Operator); - else m_WellLogRoundInfo->SetOperator(FILE_MESSAGE.Operator); - if(strlen(WellDynamicInfo.Serial)) m_WellLogRoundInfo->SetSerial(WellDynamicInfo.Serial); - else m_WellLogRoundInfo->SetSerial(FILE_MESSAGE.YqType); - if(strlen(WellDynamicInfo.Item))m_WellLogRoundInfo->SetItem(WellDynamicInfo.Item); - else m_WellLogRoundInfo->SetItem(FILE_MESSAGE.Item); - m_WellLogRoundInfo->SetINTLog(WellDynamicInfo.LogRange); - - int len=strlen(m_fileMessage); - char *p=m_fileMessage; - p+=len+1; - float sdep,edep; - len=strlen(p); - QString tempWellName; - if(len>1&&len<20) - { - sscanf(p,"%f",&sdep); - p+=strlen(p)+1; - sscanf(p,"%f",&edep); - p+=strlen(p)+1; - tempWellName=p; - } - else - {//解编模块中没有压回深度信息 - sdep=0; - edep=0; - tempWellName=""; - } - - m_WellLogRoundInfo->SetTopDepth(sdep); - m_WellLogRoundInfo->SetBottomDepth(edep); - - QFileInfo temDir(FileName); - if(tempWellName=="") tempWellName=temDir.completeBaseName(); - tempWellName.replace(" ","");//whp add 2020.3.3 删除井名中的空格 - m_WellLogRoundInfo->SetName(tempWellName.toStdString()); -} - -void InterIConvertor::InitWellInfo(const QString &filename) -{ - if(*FILE_MESSAGE.WellName)m_WellLogRoundInfo->SetWellName(FILE_MESSAGE.WellName);//whp add 2020.7.15 - if(*FILE_MESSAGE.AreaName)m_WellLogRoundInfo->SetAreaName(FILE_MESSAGE.AreaName); - if(*FILE_MESSAGE.OilCompanyName)m_WellLogRoundInfo->SetOilCompanyName(FILE_MESSAGE.OilCompanyName); - if(*FILE_MESSAGE.LogCompanyName)m_WellLogRoundInfo->SetCompanyName(FILE_MESSAGE.LogCompanyName); - if(FILE_MESSAGE.Xcoor)m_WellLogRoundInfo->SetXCode(FILE_MESSAGE.Xcoor); - if(FILE_MESSAGE.Ycoor)m_WellLogRoundInfo->SetYCode(FILE_MESSAGE.Ycoor); - if(FILE_MESSAGE.Altitude)m_WellLogRoundInfo->SetAsl(FILE_MESSAGE.Altitude); - if(FILE_MESSAGE.Kelly)m_WellLogRoundInfo->SetBsl(FILE_MESSAGE.Kelly); - if(FILE_MESSAGE.X0)m_WellLogRoundInfo->SetXOffset(FILE_MESSAGE.X0); - if(FILE_MESSAGE.Y0)m_WellLogRoundInfo->SetYOffset(FILE_MESSAGE.Y0); - if(FILE_MESSAGE.TVD)m_WellLogRoundInfo->SetTVD0(FILE_MESSAGE.TVD); - QString temp = ::GetConfPath()+"data.ini"; - QSettings settings(temp,QSettings::IniFormat,0); - settings.setIniCodec(QTextCodec::codecForName("UTF-8")); - QStringList serials=settings.value("wellType",0).toStringList(); - int i=serials.indexOf(FILE_MESSAGE.WellType); - if(i<0) i=0; - m_WellLogRoundInfo->SetWellType(i); - // - if(m_WellLogRoundInfo->GetName()=="")//whp add 2019.8.1 - {//???加此句是否合适?如果有文件名,就不再赋值,如JPH-307_core.txt中# WELL FILE: FILEJPH-307 - string wellName=string(FILE_MESSAGE.WellName); - if (wellName=="") - { - QFileInfo temDir(filename); - QString tempWellName=temDir.completeBaseName(); - tempWellName.replace(" ","");//whp add 2020.3.3 删除井名中的空格 - m_WellLogRoundInfo->SetName(tempWellName.toStdString()); - } - else - { - m_WellLogRoundInfo->SetName(FILE_MESSAGE.WellName); - } - } -} -END_OSGGRAPHICS_NAMESPACE; +#include +#include "InterIConvertor.h" +#include "MemRdWt.h" +#include "CStringType.h" +//#include "ObjWelllogWavefile.h" +#include "BaseFun.h" +#include "geometryutils.h" +#include +BEGIN_OSGGRAPHICS_NAMESPACE; + +InterIConvertor::InterIConvertor():IConvertor(),m_fileMessage(NULL), + m_DepthLength(0), + m_DimCurvefilePath("") +{ + memset(&WellDynamicInfo,0,sizeof(WELL_DYNAMIC_INFO)); + memset(&FILE_MESSAGE,0,sizeof(Slf_FILE_MESSAGE)); + memset(&WellStaticInfo,0,sizeof(WELL_STATIC_INFO)); + m_vCurverName.resize(MaxCurve); + for (int i=0;i::iterator itor=m_vCurverName.begin(); + for (;itor!=m_vCurverName.end();) + { + itor=m_vCurverName.erase(itor); + } + m_vCurverName.clear(); +///////ww + itor=m_vCurverUnit.begin(); + for (;itor!=m_vCurverUnit.end();) + { + itor=m_vCurverUnit.erase(itor); + } + m_vCurverUnit.clear(); +/////// + if (m_fileMessage) + { + delete[]m_fileMessage; + m_fileMessage=NULL; + } +} +////////////////// +/// +//用户配置文件后缀 dll文件同名的.cfg文件 +// example :aa.dll =>aa.cfg +// +QVector InterIConvertor::GetSupportFileExtensions() +{ + QVectorexts; + if(!m_thisModuleName.isEmpty()) + { + char *name=new char[1000]; + // D:\LogPlus\bin\ + GetBinDir(name); + QString path=m_thisModuleName; + path=name; + path+="/convertor/"; + path+=m_thisModuleName; + path+=".cfg"; + FILE *fp=fopen(path.toStdString().c_str(),"rt"); + if(fp) + { + while(!feof(fp)) + { + memset(name,0,1000); + fread(name,1000,1,fp); + QString line=name; + line.replace(","," "); + line.replace("\t"," "); + line.replace("\r"," "); + line.replace("\n"," "); + QStringList strs=line.split(" "); + strs.removeAll(""); + foreach(QString str,strs)exts.push_back(str); + } + fclose(fp); + } + delete name; + } + return exts; +} + +QString InterIConvertor::GetFileContent( const QString &filename ) +{ + if(strlen(m_fileMessage)) { + return m_fileMessage; + } + QFile file(filename); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) + return ""; + QString lineString(""); + //读取文件前50行 + for (int row=0;row<50;row++) + { + lineString += "\n"+file.readLine(); + } + return lineString; +} +bool InterIConvertor::Init() +{ + m_TableName=""; + IConvertor::Init(); + memset(&FILE_MESSAGE,0,sizeof(FILE_MESSAGE)); + memset(&WellDynamicInfo,0,sizeof(WELL_DYNAMIC_INFO)); + //whp add 2019.8.1 for 初始化井静态信息 + memset(&WellStaticInfo,0,sizeof(WELL_STATIC_INFO)); + m_DimCurvesList.clear(); + if(m_fileMessage) m_fileMessage[0]=0; + ////ww + for (int i=0;i(tempStr.c_str()); + // QString strCh(filePath); // 汉字路径转换 + int Value= ScanLogFile(UTF8ToGBK(filePath).data()/*strCh.toLocal8Bit().data()*/,m_fileMessage,&m_vCurverName[0],&m_vCurverUnit[0]); + m_CurveData.Curve_Num=Value; + if(Value<=0) return 0;//ww + return Value; +} + +QList pai::graphics::InterIConvertor::GetWellLogList( const QString &filename ) +{ + m_vWellLogCurve.clear(); + if(m_CurveData.Curve_Num<=0) return m_vWellLogCurve; +// GetWellLogMetas( m_vWellLogCurve, filename ); + InitWelllogRoundInfo(filename); + if(WellStaticInfo.XCoor)FILE_MESSAGE.Xcoor=WellStaticInfo.XCoor; + if(WellStaticInfo.YCoor)FILE_MESSAGE.Ycoor=WellStaticInfo.YCoor; + memmove(FILE_MESSAGE.Item,WellStaticInfo.MethodCWell,sizeof(FILE_MESSAGE.Item)); + if(*WellStaticInfo.WellName&&*WellStaticInfo.WellName!=' ')memmove(FILE_MESSAGE.WellName,WellStaticInfo.WellName,sizeof(FILE_MESSAGE.WellName)); + if(*WellStaticInfo.AreaName&&*WellStaticInfo.AreaName!=' ')memmove(FILE_MESSAGE.AreaName,WellStaticInfo.AreaName,sizeof(FILE_MESSAGE.AreaName)); + if(*WellStaticInfo.OilCompanyName&&*WellStaticInfo.OilCompanyName!=' ')memmove(FILE_MESSAGE.OilCompanyName,WellStaticInfo.OilCompanyName,sizeof(FILE_MESSAGE.OilCompanyName)); + if(WellStaticInfo.As1)FILE_MESSAGE.Altitude=WellStaticInfo.As1; + if(WellStaticInfo.Bs1)FILE_MESSAGE.Kelly=WellStaticInfo.Bs1; + if(strlen(WellStaticInfo.EndDrillDate))FILE_MESSAGE.EndDrillDate=StringToTime(WellStaticInfo.EndDrillDate); + if(strlen(WellStaticInfo.StartDrillDate))FILE_MESSAGE.StartDrillDate=StringToTime(WellStaticInfo.StartDrillDate); + if(WellStaticInfo.Sc1Edep)FILE_MESSAGE.StartDepth=WellStaticInfo.Sc1Edep; + if(WellStaticInfo.Sc2sdep)FILE_MESSAGE.EndDepth=WellStaticInfo.Sc2sdep; + if(*(float*)&WellStaticInfo.Remark[0])memmove(&FILE_MESSAGE.X0,&WellStaticInfo.Remark[0],4); + if(*(float*)&WellStaticInfo.Remark[4])memmove(&FILE_MESSAGE.Y0,&WellStaticInfo.Remark[4],4); + if(*(float*)&WellStaticInfo.Remark[8])memmove(&FILE_MESSAGE.TVD,&WellStaticInfo.Remark[8],4);//whp 2019.7.30 该语句会把解编模块扫描得到的TVD数据清空 + //已在ASCII模块中做了相应的处理,不知道别的模块中还有没有 + if(strlen(WellDynamicInfo.LogCompanyName))memmove(FILE_MESSAGE.LogCompanyName,WellDynamicInfo.LogCompanyName,sizeof(FILE_MESSAGE.LogCompanyName)); + if(strlen(WellDynamicInfo.Operator))memmove(FILE_MESSAGE.Operator,WellDynamicInfo.Operator,sizeof(FILE_MESSAGE.Operator)); + if(strlen(WellDynamicInfo.Item))memmove(FILE_MESSAGE.LoggingTeam,WellDynamicInfo.Item,sizeof(FILE_MESSAGE.LoggingTeam)); + if(strlen(WellDynamicInfo.Date))FILE_MESSAGE.LoggingDate=StringToTime(WellDynamicInfo.Date); + //add end + InitWellInfo(filename); + return m_vWellLogCurve; +} + + +QString InterIConvertor::GetfilePath(const char *FileName) +{ + QFileInfo fileInfo(QString::fromLocal8Bit(FileName)); + QDir dir(::GetImagePath()); + dir.cdUp(); + QString tempPath=dir.absolutePath()+"/"+fileInfo.completeBaseName()+".slf"; + + return tempPath; +} +// void InterIConvertor::GetWellLogMetas( QList &vWellLog, QString strWellLogPath) +// { +// //||m_CurveData.Curve_Step==0.0 +// if(m_CurveData.Curve_Num<=0) return;//ww +// for( long j = 0 ; jSetName(curveName); +// pWelllog->SetAliasName(curveName); +// QString curveUnit=QString::fromLocal8Bit(m_vCurverUnit[j] );//ww +// pWelllog->GetLogCurve().SetUnit(curveUnit.toStdString()); +// vWellLog.push_back(pWelllog); +// } + +// } +// void InterIConvertor::GetWellLogObjects( QList &vWellLog, QString strWellLogPath) +// { +// return; +// } + +void InterIConvertor::InitWelllogRoundInfo(QString FileName) +{ + //char LogRange[24],IntRange[24];char Section[16] SetAudit; + if(WellDynamicInfo.MudViscosity)m_WellLogRoundInfo->SetMudViscosity(WellDynamicInfo.MudViscosity); + else if(FILE_MESSAGE.Mud_Viscosity[0]) m_WellLogRoundInfo->SetMudViscosity(FILE_MESSAGE.Mud_Viscosity[0]); + QString LogCompanyName=WellDynamicInfo.LogCompanyName; + LogCompanyName=LogCompanyName.trimmed(); + if(LogCompanyName.length()) m_WellLogRoundInfo->SetCompanyName(WellDynamicInfo.LogCompanyName); + else m_WellLogRoundInfo->SetCompanyName(FILE_MESSAGE.LogCompanyName); + if(strlen(WellDynamicInfo.Date)) m_WellLogRoundInfo->SetDate(WellDynamicInfo.Date); + else { + QString str=ctime((time_t *)&FILE_MESSAGE.LoggingDate); + m_WellLogRoundInfo->SetDate(str.toStdString()); + } + if(WellDynamicInfo.TempBot)m_WellLogRoundInfo->SetTempBot(WellDynamicInfo.TempBot); + else m_WellLogRoundInfo->SetTempBot(FILE_MESSAGE.Well_Bottom_Temperature); + if(WellDynamicInfo.WaterLoss) m_WellLogRoundInfo->SetWaterLoss(WellDynamicInfo.WaterLoss); + else m_WellLogRoundInfo->SetWaterLoss(FILE_MESSAGE.WaterLoss); + if(WellDynamicInfo.MudDensity) m_WellLogRoundInfo->SetDensity(WellDynamicInfo.MudDensity); + else m_WellLogRoundInfo->SetDensity(FILE_MESSAGE.Mud_Density[0]); + + if(WellDynamicInfo.MudResi)m_WellLogRoundInfo->SetResi(WellDynamicInfo.MudResi); + else m_WellLogRoundInfo->SetResi(FILE_MESSAGE.Mud_Resistivity[0]); + if(WellDynamicInfo.MudTemp)m_WellLogRoundInfo->SetTemp(WellDynamicInfo.MudTemp); + else m_WellLogRoundInfo->SetTemp(FILE_MESSAGE.Mud_Temp); + if(WellDynamicInfo.MudType) m_WellLogRoundInfo->SetMudType(WellDynamicInfo.MudType); + else m_WellLogRoundInfo->SetMudType(FILE_MESSAGE.Mud_Property); + m_WellLogRoundInfo->SetIntProg(WellDynamicInfo.IntProg); + m_WellLogRoundInfo->SetInteDress(WellDynamicInfo.IntDress); + m_WellLogRoundInfo->SetRemark(WellDynamicInfo.Remark); + if(strlen(WellDynamicInfo.Operator))m_WellLogRoundInfo->SetOperator(WellDynamicInfo.Operator); + else m_WellLogRoundInfo->SetOperator(FILE_MESSAGE.Operator); + if(strlen(WellDynamicInfo.Serial)) m_WellLogRoundInfo->SetSerial(WellDynamicInfo.Serial); + else m_WellLogRoundInfo->SetSerial(FILE_MESSAGE.YqType); + if(strlen(WellDynamicInfo.Item))m_WellLogRoundInfo->SetItem(WellDynamicInfo.Item); + else m_WellLogRoundInfo->SetItem(FILE_MESSAGE.Item); + m_WellLogRoundInfo->SetINTLog(WellDynamicInfo.LogRange); + + int len=strlen(m_fileMessage); + char *p=m_fileMessage; + p+=len+1; + float sdep,edep; + len=strlen(p); + QString tempWellName; + if(len>1&&len<20) + { + sscanf(p,"%f",&sdep); + p+=strlen(p)+1; + sscanf(p,"%f",&edep); + p+=strlen(p)+1; + tempWellName=p; + } + else + {//解编模块中没有压回深度信息 + sdep=0; + edep=0; + tempWellName=""; + } + + m_WellLogRoundInfo->SetTopDepth(sdep); + m_WellLogRoundInfo->SetBottomDepth(edep); + + QFileInfo temDir(FileName); + if(tempWellName=="") tempWellName=temDir.completeBaseName(); + tempWellName.replace(" ","");//whp add 2020.3.3 删除井名中的空格 + m_WellLogRoundInfo->SetName(tempWellName.toStdString()); +} + +void InterIConvertor::InitWellInfo(const QString &filename) +{ + if(*FILE_MESSAGE.WellName)m_WellLogRoundInfo->SetWellName(FILE_MESSAGE.WellName);//whp add 2020.7.15 + if(*FILE_MESSAGE.AreaName)m_WellLogRoundInfo->SetAreaName(FILE_MESSAGE.AreaName); + if(*FILE_MESSAGE.OilCompanyName)m_WellLogRoundInfo->SetOilCompanyName(FILE_MESSAGE.OilCompanyName); + if(*FILE_MESSAGE.LogCompanyName)m_WellLogRoundInfo->SetCompanyName(FILE_MESSAGE.LogCompanyName); + if(FILE_MESSAGE.Xcoor)m_WellLogRoundInfo->SetXCode(FILE_MESSAGE.Xcoor); + if(FILE_MESSAGE.Ycoor)m_WellLogRoundInfo->SetYCode(FILE_MESSAGE.Ycoor); + if(FILE_MESSAGE.Altitude)m_WellLogRoundInfo->SetAsl(FILE_MESSAGE.Altitude); + if(FILE_MESSAGE.Kelly)m_WellLogRoundInfo->SetBsl(FILE_MESSAGE.Kelly); + if(FILE_MESSAGE.X0)m_WellLogRoundInfo->SetXOffset(FILE_MESSAGE.X0); + if(FILE_MESSAGE.Y0)m_WellLogRoundInfo->SetYOffset(FILE_MESSAGE.Y0); + if(FILE_MESSAGE.TVD)m_WellLogRoundInfo->SetTVD0(FILE_MESSAGE.TVD); + QString temp = ::GetConfPath()+"data.ini"; + QSettings settings(temp,QSettings::IniFormat,0); + settings.setIniCodec(QTextCodec::codecForName("UTF-8")); + QStringList serials=settings.value("wellType",0).toStringList(); + int i=serials.indexOf(FILE_MESSAGE.WellType); + if(i<0) i=0; + m_WellLogRoundInfo->SetWellType(i); + // + if(m_WellLogRoundInfo->GetName()=="")//whp add 2019.8.1 + {//???加此句是否合适?如果有文件名,就不再赋值,如JPH-307_core.txt中# WELL FILE: FILEJPH-307 + string wellName=string(FILE_MESSAGE.WellName); + if (wellName=="") + { + QFileInfo temDir(filename); + QString tempWellName=temDir.completeBaseName(); + tempWellName.replace(" ","");//whp add 2020.3.3 删除井名中的空格 + m_WellLogRoundInfo->SetName(tempWellName.toStdString()); + } + else + { + m_WellLogRoundInfo->SetName(FILE_MESSAGE.WellName); + } + } +} +END_OSGGRAPHICS_NAMESPACE; diff --git a/ConvertorManager/src/InterfaceWidget.cpp b/ConvertorManager/src/InterfaceWidget.cpp index 40d2a0a..6bddb2c 100644 --- a/ConvertorManager/src/InterfaceWidget.cpp +++ b/ConvertorManager/src/InterfaceWidget.cpp @@ -1,318 +1,318 @@ -#include "InterfaceWidget.h" -#include "ui_interfaceWidget.h" - -BEGIN_OSGGRAPHICS_NAMESPACE; - -InterfaceWidget::InterfaceWidget(QWidget *parent) - : QWidget(parent) -{ - m_pInterfaceUI=new Ui::Interface(); - m_pInterfaceUI->setupUi(this); - //m_pInterfaceUI->splitter->setMouseTracking(true); - //m_pInterfaceUI->tableWidget->horizontalHeader() - //m_pInterfaceUI->tableWidget->setFont(QFont("宋体")); - //m_pInterfaceUI->tabWidget->setTabText(1,"井信息"); - //m_pInterfaceUI->tabWidget->setTabText(0,"测井信息"); - - m_pInterfaceUI->widget_2->setVisible(false); - //m_pInterfaceUI->tableWidget->setHorizontalScrollBarPolicy() - m_pInterfaceUI->tableWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); -} - -void InterfaceWidget::showEvent(QShowEvent * pEvent) -{ - QWidget::showEvent(pEvent); - - - //m_pInterfaceUI->textEdit->setFixedWidth(width()-580); - -} - -InterfaceWidget::~InterfaceWidget() -{ - -} - -QTableWidget* InterfaceWidget::GetDataSelectAreaWidget() -{ - return m_pInterfaceUI->tableWidget; -} - -/*QTabWidget* InterfaceWidget::GetLogInformation() -{ - return m_pInterfaceUI->tabWidget; -}*/ - - QTextEdit* InterfaceWidget::GetDataPreviewArea() -{ - return m_pInterfaceUI->textEdit; -} - - QLineEdit * InterfaceWidget::GetXCodeLineEdit() - { - return m_pInterfaceUI->lineEdit_30; - } - - QLineEdit * InterfaceWidget::GetMudViscosityLineEdit() - { - return m_pInterfaceUI->lineEdit_25; - } - - QComboBox * InterfaceWidget::GetMudTypeComboBox() - { - - return m_pInterfaceUI->comboBox_2; - } - - QLineEdit * InterfaceWidget::GetCompanyNameLineEdit() - { - return m_pInterfaceUI->lineEdit_27; - } - - QLineEdit * InterfaceWidget::GetTeamLineEdit() - { - return m_pInterfaceUI->lineEdit_28; - } - - QLineEdit * InterfaceWidget::GetOperatorLineEdit() - { - return m_pInterfaceUI->lineEdit_11; - } - - QDateEdit * InterfaceWidget::GerDateEdit() - { - return m_pInterfaceUI->dateEdit_2; - } - - QComboBox * InterfaceWidget::GetSerialComboBox() - { - return m_pInterfaceUI->comboBox_4; - } - - QComboBox * InterfaceWidget::GetItemComboBox() - { - return m_pInterfaceUI->comboBox_5; - } - - QLineEdit * InterfaceWidget::GetProfileLineEdit() - { - return m_pInterfaceUI->lineEdit_12; - } - - QLineEdit * InterfaceWidget::GetWaterLossLineEdit() - { - return m_pInterfaceUI->lineEdit_8; - } - - QLineEdit * InterfaceWidget::GetDensityLineEdit() - { - return m_pInterfaceUI->lineEdit_24; - } - - QLineEdit * InterfaceWidget::GetResiLineEdit() - { - return m_pInterfaceUI->lineEdit_7; - } - - QLineEdit * InterfaceWidget::GetTempLineEdit() - { - return m_pInterfaceUI->lineEdit_5; - } - - QLineEdit * InterfaceWidget::GetINTLogLineEdit() - { - return m_pInterfaceUI->lineEdit_6; - } - - QLineEdit * InterfaceWidget::GetTempBotLineEdit() - { - return m_pInterfaceUI->lineEdit_23; - } - - QLineEdit * InterfaceWidget::GetNITINTLineEdit() - { - return m_pInterfaceUI->lineEdit_2; - } - - QLineEdit * InterfaceWidget::GetIntProgLineEdit() - { - return m_pInterfaceUI->lineEdit_4; - } - - QLineEdit * InterfaceWidget::GetInteDressLineEdit() - { - return m_pInterfaceUI->lineEdit_3; - } - - QLineEdit * InterfaceWidget::GetAuditLineEdit() - { - return m_pInterfaceUI->lineEdit; - } - - QTextEdit * InterfaceWidget::GetRemarkTextEdit() - { - return m_pInterfaceUI->textEdit_2; - } - - QLineEdit * InterfaceWidget::GetWellRoundNameLineEdit() - { - return m_pInterfaceUI->lineEdit_10; - } - ///////////////// - QLineEdit * InterfaceWidget::GetWellCompanyNameLineEdit() - { - return m_pInterfaceUI->lineEdit_26; - } - - QLineEdit * InterfaceWidget::GetWellNameLineEdit() - { - return m_pInterfaceUI->lineEdit_9; - } - - QLineEdit * InterfaceWidget::GetWellAreaNameLineEdit() - { - return m_pInterfaceUI->lineEdit_29; - } - - QLineEdit * InterfaceWidget::GetWellCodeLineEdit() - { - return m_pInterfaceUI->lineEdit_19; - } - - QLineEdit * InterfaceWidget::GetYCodeLineEdit() - { - return m_pInterfaceUI->lineEdit_18; - } - - QComboBox * InterfaceWidget::GetWellTypeComboBox() - { - return m_pInterfaceUI->comboBox_6; - } - - QLineEdit * InterfaceWidget::GetAslLineEdit() - { - return m_pInterfaceUI->lineEdit_16; - } - QLineEdit * InterfaceWidget::GetBslLineEdit() - { - return m_pInterfaceUI->lineEdit_17; - } - - QDateEdit * InterfaceWidget::GerSDrillDateEdit() - { - return m_pInterfaceUI->dateEdit; - } - QDateEdit * InterfaceWidget::GerEDrillDateEdit() - { - return m_pInterfaceUI->dateEdit_3; - } - - QDateEdit * InterfaceWidget::GerCompleteDateEdit() - { - return m_pInterfaceUI->dateEdit_4; - } - - QLineEdit * InterfaceWidget::GetCWMethodLineEdit() - { - return m_pInterfaceUI->lineEdit_14; - } - - QLineEdit * InterfaceWidget::GetBit1ProgLineEdit() - { - return m_pInterfaceUI->lineEdit_37; - } - - QLineEdit * InterfaceWidget::GetBit2ProgLineEdit() - { - return m_pInterfaceUI->lineEdit_36; - } - - QLineEdit * InterfaceWidget::GetBit3ProgLineEdit() - { - return m_pInterfaceUI->lineEdit_34; - } - - QLineEdit * InterfaceWidget::GetBit4ProgLineEdit() - { - return m_pInterfaceUI->lineEdit_35; - } - - QLineEdit * InterfaceWidget::GetBit5ProgLineEdit() - { - return m_pInterfaceUI->lineEdit_33; - } - - QLineEdit * InterfaceWidget::GetCas1ProgLineEdit() - { - return m_pInterfaceUI->lineEdit_41; - } - - QLineEdit * InterfaceWidget::GetCas2ProgLineEdit() - { - return m_pInterfaceUI->lineEdit_42; - } - - QLineEdit * InterfaceWidget::GetCas3ProgLineEdit() - { - return m_pInterfaceUI->lineEdit_40; - } - - QLineEdit * InterfaceWidget::GetCas4ProgLineEdit() - { - return m_pInterfaceUI->lineEdit_39; - } - - QLineEdit * InterfaceWidget::GetCas5ProgLineEdit() - { - return m_pInterfaceUI->lineEdit_38; - } - - QLineEdit * InterfaceWidget::GetCas1ShotLineEdit() - { - return m_pInterfaceUI->lineEdit_15; - } - - QLineEdit * InterfaceWidget::GetCas2ShotLineEdit() - { - return m_pInterfaceUI->lineEdit_22; - } - - QLineEdit * InterfaceWidget::GetSC1SDepLineEdit() - { - return m_pInterfaceUI->lineEdit_21; - } - - QLineEdit * InterfaceWidget::GetSC1EDepLineEdit() - { - return m_pInterfaceUI->lineEdit_31; - } - - QLineEdit * InterfaceWidget::GetSC2SDepLineEdit() - { - return m_pInterfaceUI->lineEdit_20; - } - - QLineEdit * InterfaceWidget::GetSC2EDepLineEdit() - { - return m_pInterfaceUI->lineEdit_32; - } - QLineEdit * InterfaceWidget::GetEditTopDepth() - { - return m_pInterfaceUI->edtTopDepth; - } - QLineEdit * InterfaceWidget::GetEditBottomDepth() - { - return m_pInterfaceUI->edtBottomDepth; - } - QLineEdit * InterfaceWidget::GetEditFileSDepth() - { - return m_pInterfaceUI->filestdepedit; - } - QLineEdit * InterfaceWidget::GetEditFileEDepth() - { - return m_pInterfaceUI->fileendepedit; - } - - - -END_OSGGRAPHICS_NAMESPACE; +#include "InterfaceWidget.h" +#include "ui_interfaceWidget.h" + +BEGIN_OSGGRAPHICS_NAMESPACE; + +InterfaceWidget::InterfaceWidget(QWidget *parent) + : QWidget(parent) +{ + m_pInterfaceUI=new Ui::Interface(); + m_pInterfaceUI->setupUi(this); + //m_pInterfaceUI->splitter->setMouseTracking(true); + //m_pInterfaceUI->tableWidget->horizontalHeader() + //m_pInterfaceUI->tableWidget->setFont(QFont("宋体")); + //m_pInterfaceUI->tabWidget->setTabText(1,"井信息"); + //m_pInterfaceUI->tabWidget->setTabText(0,"测井信息"); + + m_pInterfaceUI->widget_2->setVisible(false); + //m_pInterfaceUI->tableWidget->setHorizontalScrollBarPolicy() + m_pInterfaceUI->tableWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); +} + +void InterfaceWidget::showEvent(QShowEvent * pEvent) +{ + QWidget::showEvent(pEvent); + + + //m_pInterfaceUI->textEdit->setFixedWidth(width()-580); + +} + +InterfaceWidget::~InterfaceWidget() +{ + +} + +QTableWidget* InterfaceWidget::GetDataSelectAreaWidget() +{ + return m_pInterfaceUI->tableWidget; +} + +/*QTabWidget* InterfaceWidget::GetLogInformation() +{ + return m_pInterfaceUI->tabWidget; +}*/ + + QTextEdit* InterfaceWidget::GetDataPreviewArea() +{ + return m_pInterfaceUI->textEdit; +} + + QLineEdit * InterfaceWidget::GetXCodeLineEdit() + { + return m_pInterfaceUI->lineEdit_30; + } + + QLineEdit * InterfaceWidget::GetMudViscosityLineEdit() + { + return m_pInterfaceUI->lineEdit_25; + } + + QComboBox * InterfaceWidget::GetMudTypeComboBox() + { + + return m_pInterfaceUI->comboBox_2; + } + + QLineEdit * InterfaceWidget::GetCompanyNameLineEdit() + { + return m_pInterfaceUI->lineEdit_27; + } + + QLineEdit * InterfaceWidget::GetTeamLineEdit() + { + return m_pInterfaceUI->lineEdit_28; + } + + QLineEdit * InterfaceWidget::GetOperatorLineEdit() + { + return m_pInterfaceUI->lineEdit_11; + } + + QDateEdit * InterfaceWidget::GerDateEdit() + { + return m_pInterfaceUI->dateEdit_2; + } + + QComboBox * InterfaceWidget::GetSerialComboBox() + { + return m_pInterfaceUI->comboBox_4; + } + + QComboBox * InterfaceWidget::GetItemComboBox() + { + return m_pInterfaceUI->comboBox_5; + } + + QLineEdit * InterfaceWidget::GetProfileLineEdit() + { + return m_pInterfaceUI->lineEdit_12; + } + + QLineEdit * InterfaceWidget::GetWaterLossLineEdit() + { + return m_pInterfaceUI->lineEdit_8; + } + + QLineEdit * InterfaceWidget::GetDensityLineEdit() + { + return m_pInterfaceUI->lineEdit_24; + } + + QLineEdit * InterfaceWidget::GetResiLineEdit() + { + return m_pInterfaceUI->lineEdit_7; + } + + QLineEdit * InterfaceWidget::GetTempLineEdit() + { + return m_pInterfaceUI->lineEdit_5; + } + + QLineEdit * InterfaceWidget::GetINTLogLineEdit() + { + return m_pInterfaceUI->lineEdit_6; + } + + QLineEdit * InterfaceWidget::GetTempBotLineEdit() + { + return m_pInterfaceUI->lineEdit_23; + } + + QLineEdit * InterfaceWidget::GetNITINTLineEdit() + { + return m_pInterfaceUI->lineEdit_2; + } + + QLineEdit * InterfaceWidget::GetIntProgLineEdit() + { + return m_pInterfaceUI->lineEdit_4; + } + + QLineEdit * InterfaceWidget::GetInteDressLineEdit() + { + return m_pInterfaceUI->lineEdit_3; + } + + QLineEdit * InterfaceWidget::GetAuditLineEdit() + { + return m_pInterfaceUI->lineEdit; + } + + QTextEdit * InterfaceWidget::GetRemarkTextEdit() + { + return m_pInterfaceUI->textEdit_2; + } + + QLineEdit * InterfaceWidget::GetWellRoundNameLineEdit() + { + return m_pInterfaceUI->lineEdit_10; + } + ///////////////// + QLineEdit * InterfaceWidget::GetWellCompanyNameLineEdit() + { + return m_pInterfaceUI->lineEdit_26; + } + + QLineEdit * InterfaceWidget::GetWellNameLineEdit() + { + return m_pInterfaceUI->lineEdit_9; + } + + QLineEdit * InterfaceWidget::GetWellAreaNameLineEdit() + { + return m_pInterfaceUI->lineEdit_29; + } + + QLineEdit * InterfaceWidget::GetWellCodeLineEdit() + { + return m_pInterfaceUI->lineEdit_19; + } + + QLineEdit * InterfaceWidget::GetYCodeLineEdit() + { + return m_pInterfaceUI->lineEdit_18; + } + + QComboBox * InterfaceWidget::GetWellTypeComboBox() + { + return m_pInterfaceUI->comboBox_6; + } + + QLineEdit * InterfaceWidget::GetAslLineEdit() + { + return m_pInterfaceUI->lineEdit_16; + } + QLineEdit * InterfaceWidget::GetBslLineEdit() + { + return m_pInterfaceUI->lineEdit_17; + } + + QDateEdit * InterfaceWidget::GerSDrillDateEdit() + { + return m_pInterfaceUI->dateEdit; + } + QDateEdit * InterfaceWidget::GerEDrillDateEdit() + { + return m_pInterfaceUI->dateEdit_3; + } + + QDateEdit * InterfaceWidget::GerCompleteDateEdit() + { + return m_pInterfaceUI->dateEdit_4; + } + + QLineEdit * InterfaceWidget::GetCWMethodLineEdit() + { + return m_pInterfaceUI->lineEdit_14; + } + + QLineEdit * InterfaceWidget::GetBit1ProgLineEdit() + { + return m_pInterfaceUI->lineEdit_37; + } + + QLineEdit * InterfaceWidget::GetBit2ProgLineEdit() + { + return m_pInterfaceUI->lineEdit_36; + } + + QLineEdit * InterfaceWidget::GetBit3ProgLineEdit() + { + return m_pInterfaceUI->lineEdit_34; + } + + QLineEdit * InterfaceWidget::GetBit4ProgLineEdit() + { + return m_pInterfaceUI->lineEdit_35; + } + + QLineEdit * InterfaceWidget::GetBit5ProgLineEdit() + { + return m_pInterfaceUI->lineEdit_33; + } + + QLineEdit * InterfaceWidget::GetCas1ProgLineEdit() + { + return m_pInterfaceUI->lineEdit_41; + } + + QLineEdit * InterfaceWidget::GetCas2ProgLineEdit() + { + return m_pInterfaceUI->lineEdit_42; + } + + QLineEdit * InterfaceWidget::GetCas3ProgLineEdit() + { + return m_pInterfaceUI->lineEdit_40; + } + + QLineEdit * InterfaceWidget::GetCas4ProgLineEdit() + { + return m_pInterfaceUI->lineEdit_39; + } + + QLineEdit * InterfaceWidget::GetCas5ProgLineEdit() + { + return m_pInterfaceUI->lineEdit_38; + } + + QLineEdit * InterfaceWidget::GetCas1ShotLineEdit() + { + return m_pInterfaceUI->lineEdit_15; + } + + QLineEdit * InterfaceWidget::GetCas2ShotLineEdit() + { + return m_pInterfaceUI->lineEdit_22; + } + + QLineEdit * InterfaceWidget::GetSC1SDepLineEdit() + { + return m_pInterfaceUI->lineEdit_21; + } + + QLineEdit * InterfaceWidget::GetSC1EDepLineEdit() + { + return m_pInterfaceUI->lineEdit_31; + } + + QLineEdit * InterfaceWidget::GetSC2SDepLineEdit() + { + return m_pInterfaceUI->lineEdit_20; + } + + QLineEdit * InterfaceWidget::GetSC2EDepLineEdit() + { + return m_pInterfaceUI->lineEdit_32; + } + QLineEdit * InterfaceWidget::GetEditTopDepth() + { + return m_pInterfaceUI->edtTopDepth; + } + QLineEdit * InterfaceWidget::GetEditBottomDepth() + { + return m_pInterfaceUI->edtBottomDepth; + } + QLineEdit * InterfaceWidget::GetEditFileSDepth() + { + return m_pInterfaceUI->filestdepedit; + } + QLineEdit * InterfaceWidget::GetEditFileEDepth() + { + return m_pInterfaceUI->fileendepedit; + } + + + +END_OSGGRAPHICS_NAMESPACE; diff --git a/ConvertorManager/src/WisTableTran.cpp b/ConvertorManager/src/WisTableTran.cpp index c977d47..5beb20b 100644 --- a/ConvertorManager/src/WisTableTran.cpp +++ b/ConvertorManager/src/WisTableTran.cpp @@ -1,604 +1,604 @@ -/*#include "MyDlisLib.h" -#include "MyLisLib.h" -#include "MyXtfLib.h"*/ -#pragma once -#include "WisTableTran.h" -#include "BaseFun.h" -//#include "log.h" -//void AppendConsole(pai::log::Priority priority,const QString &output); -WisTableTran::WisTableTran() -{ - m_TranNum=0; - WisDefTable=NULL; - SlfDefTable=NULL; - outinf=NULL; -} -WisTableTran::~WisTableTran() -{ - if(m_TranNum) - { - //for(int i=0;i2)m_TTI.tinfo[m_TTI.ZdNum].ZdType=DataList.at(2); - if(DataList.count()>3)m_TTI.tinfo[m_TTI.ZdNum].ZdLen=DataList.at(3); - if(DataList.count()>4)m_TTI.tinfo[m_TTI.ZdNum].ZdAlias=DataList.at(4); - m_TTI.ZdNum++; - } -} -bool WisTableTran::GetTranTableInf() -{//读TableTran.ini - m_TranNum=0; - QString ConfigName = GetConfPath()+"TableTran.ini"; - QFile InFile(ConfigName); - if( !InFile.open(QIODevice::ReadOnly ) )return 0; - QTextStream textstream( &InFile ); - QString line; - while(!textstream.atEnd()) - { - line=textstream.readLine(); - if(line.indexOf("//")>=0)continue; - if(line.indexOf("#")>=0)m_TranNum++; - } - if(!m_TranNum){ - InFile.close(); - return 0; - } - InFile.seek(0); - m_TTI=new TRANTABLEINF[m_TranNum]; - - int num=-1; - QStringList temp; - while(!textstream.atEnd()) - { - line=textstream.readLine(); - if(line.indexOf("//")>=0)continue; - line=line.toUpper(); - if(line.indexOf("#")>=0) - { - if(num>=0) - { - GetTTI(m_TTI[num],temp); - temp.clear(); - } - num++; - line=line.replace("#",""); - QStringList DataList=GetStringList(line,1,1,1,1,1); - m_TTI[num].OutName=DataList.at(0); - m_TTI[num].InName=DataList.at(1); - if(DataList.count()>2)m_TTI[num].AliasName=DataList.at(2); - } - else temp.append(line); - } - GetTTI(m_TTI[num],temp); - InFile.close(); - for(int i=0;i0)tempName=tempName.replace("+",","); - if(tempName.indexOf("-")>0)tempName=tempName.replace("-",","); - QStringList tempList=tempName.split(","); - for(int m=0;m-1) { - ConfigName+=GetOilFieldName(); - iswis=1; - } - ConfigName+=table_inf; - QFile InFile(ConfigName); - if( !InFile.open(QIODevice::ReadOnly ) ) - { - QMessageBox::warning(NULL,"提示","打开缺省表配置文件"+ConfigName+"错误"); - return 0; - } - QTextStream textstream( &InFile ); - QString line; - - QString TableName,TableAliasName; - //int ZdNum; - QStringList ZdName,HzName,ZdUnit,ZdLen,ZdType,ZdRes,DataList; - - while(!textstream.atEnd()) - { - line=textstream.readLine(); - line=line.toUpper(); - while(line.indexOf("#")>=0) - { - line=line.replace("#",""); - DataList=GetStringList(line,1,1,1,1,1); - if(DataList.count()<2)continue; - TableName=DataList.at(0); - TableAliasName=DataList.at(1); - QString menuinfo[50]; - for(int m=0;m=0) - { - QString str=line; - str.trimmed(); - int len=str.length(); - if(len>-1&&str.at(len-1)==',') - { - while(!textstream.atEnd()) - { - line=textstream.readLine(); - str+=line; - str.trimmed(); - int len=str.length(); - if(len>-1&&str.at(len-1)!=',') break; - } - } - int ind=ZdName.size()-1; - if(ind>-1) menuinfo[ind]=str; - continue;//枚举行 - } - line=line.toUpper(); - if(line.indexOf("#")>=0) - { - break; - } - DataList=GetStringList(line,1,1,1,1,1); - if(DataList.count()<5)continue; - - ZdName.append(DataList.at(0)); - HzName.append(DataList.at(1)); - ZdUnit.append(DataList.at(2)); - - bool IsZdType=0; - for(int j=0;j<11;j++) - { - if(DataList.at(3)==QString(Rep_STR[j])) - { - ZdType.append(QString::number(j+1)); - IsZdType=1; - break; - } - } - if(!IsZdType)QMessageBox::warning(NULL,"提示","defauletable.ini文件中表"+TableName+"的字段名"+DataList.at(0)+"类型不正确"); - ZdLen.append(DataList.at(4)); - if(DataList.count()>5) { - if(DataList.at(5).toInt()>0) - { - QString filename=GetConfPath(); - switch(DataList.at(5).toInt()) - { - case 1: - filename+="RESULT.ini"; - break; - case 2: - filename+="GujingOrder.ini"; - break; - case 3: - filename+="CoreOil.ini"; - break; - case 4: - filename+="CoreLith.ini"; - break; - case 5: - filename+="Corecolor.ini"; - break; - case 6: - filename+="colorind.ini"; - break; - case 7: - filename+="GeoLith.ini"; - break; - } - FILE *fp1=fopen(filename.toStdString().c_str(),"r+t"); - QString str; - if(fp1) { - char buf1[100]; - int flag=0; - str="MENU="; - while(!feof(fp1)) { - int ret=fscanf(fp1,"%s",buf1); - if(ret<1) break; - if(flag) str+=","; - else flag=1; - str+=buf1; - } - fclose(fp1); - } - int ind=ZdRes.size(); - menuinfo[ind]=str; - } - ZdRes.append(DataList.at(5)); - } - else ZdRes.append("0"); - } - WisDefTable[m]=SetTableInf(TableName,TableAliasName,ZdName.count(),ZdName,HzName,ZdUnit,ZdType,ZdLen,ZdRes,menuinfo); - ZdName.clear(); - ZdLen.clear(); - ZdType.clear(); - HzName.clear(); - ZdUnit.clear(); - ZdRes.clear(); - for(int i=0;i<50;i++) - { - menuinfo[i]=""; - } - break; - } - } - } - } - InFile.close(); - if(iswis){ - //检查输出匹配表名是否在系统定义的缺省表中 - int nn=0,mm=0; - QString mes="TableTran.ini中定义的输出表名:\r\n"; - QString ZdMes=""; - for(int i=0;i=0)break; -#pragma region 相同字段 - //如果没有和缺省表名相同的表,检查是否有同结构的表,如要把GEOSTRATUM转成LAYER_DATA的表 - if(!IsS2W)DefTab=&WisDefTable[m]; - else DefTab=&SlfDefTable[m]; - if(fieldNum==DefTab->ZdNum)//m_TTI[m].OutName==TableName) - { - TranTable=m; - // 检查字段名、字段类型是否完全一致 - for(int k=0;ktinfo[k].Name,tableFieldInfo[k].Name)!=0 - ||DefTab->tinfo[k].RepCode!=tableFieldInfo[k].RepCode - ||DefTab->tinfo[k].CodeLength!=tableFieldInfo[k].Length) - { - TranTable=-1; - break; - } - } - if(TranTable>=0)break; - } -#pragma endregion 相同字段 - } - return TranTable; -} -void WisTableTran::GetOutInf(int TranTable) -{ - if(outinf)delete []outinf; - outinf=new OUTINF[m_TTI[TranTable].ZdNum]; - for(int n=0;n0||tempName.indexOf("-")>0) - { - if(tempName.indexOf("+")>0)outinf[n].Sep="+"; - if(tempName.indexOf("-")>0)outinf[n].Sep="-"; - tempNameList=tempName.split(outinf[n].Sep); - varnum=tempNameList.count(); - } - if(varnum==1)strcpy(outinf[n].InName1,tempName.toStdString().c_str()); - else - { - strcpy(outinf[n].InName1,tempNameList[0].toStdString().c_str()); - strcpy(outinf[n].InName2,tempNameList[1].toStdString().c_str()); - } - } -} -// -DEFAULTTABLE WisTableTran::SetTableInf(QString TableName,QString TableHzName,int num,QStringList ZdName,QStringList HzName,QStringList ZdUnit,QStringList ZdType,QStringList ZdLen,QStringList ZdRes,QString *menu) -{ - DEFAULTTABLE DefTable; - memset(&DefTable.tinfo,0,sizeof(DefTable.tinfo)); - DefTable.TableName=TableName; - DefTable.TableAliasName=TableHzName; - DefTable.ZdNum=num; - for(int i=0;i=0) - { - line=line.replace("#",""); - DataList=GetStringList(line,1,1,1,1,1); - if(DataList.count()<2)continue; - TableName=DataList.at(0); - TableAliasName=DataList.at(1); - for(int m=0;m=0)continue;//枚举行 - line=line.toUpper(); - if(line.indexOf("#")>=0) - { - break; - } - DataList=GetStringList(line,1,1,1,1,1); - if(DataList.count()<5)continue; - - ZdName.append(DataList.at(0));HzName.append(DataList.at(1));ZdUnit.append(DataList.at(2)); - - bool IsZdType=0; - for(int j=0;j<11;j++) - { - if(DataList.at(3)==QString(Rep_STR[j])) - { - ZdType.append(QString::number(j+1)); - IsZdType=1; - break; - } - } - if(!IsZdType)QMessageBox::warning(NULL,"提示","defauletable.ini文件中表"+TableName+"的字段名"+DataList.at(0)+"类型不正确"); - ZdLen.append(DataList.at(4)); - if(DataList.count()>5)ZdRes.append(DataList.at(5)); - else ZdRes.append("0"); - } - DEFAULTTABLE DefTable=SetTableInf(TableName,TableAliasName,ZdName.count(),ZdName,HzName,ZdUnit,ZdType,ZdLen,ZdRes,NULL); - if(IsWis) - { - //WisDefTable[m].tinfo=new Slf_OBJECT_FIELD[DefTable.ZdNum+1]; - memcpy(&WisDefTable[m],&DefTable,sizeof(DefTable)); - } - else - { - //SlfDefTable[m].tinfo=new Slf_OBJECT_FIELD[DefTable.ZdNum+1]; - memcpy(&SlfDefTable[m],&DefTable,sizeof(DefTable)); - } - ZdName.clear(),ZdLen.clear(),ZdType.clear(),HzName.clear();ZdUnit.clear(); - break; - } - } - } - } - InFile.close(); - return ; -} +/*#include "MyDlisLib.h" +#include "MyLisLib.h" +#include "MyXtfLib.h"*/ +#pragma once +#include "WisTableTran.h" +#include "BaseFun.h" +//#include "log.h" +//void AppendConsole(pai::log::Priority priority,const QString &output); +WisTableTran::WisTableTran() +{ + m_TranNum=0; + WisDefTable=NULL; + SlfDefTable=NULL; + outinf=NULL; +} +WisTableTran::~WisTableTran() +{ + if(m_TranNum) + { + //for(int i=0;i2)m_TTI.tinfo[m_TTI.ZdNum].ZdType=DataList.at(2); + if(DataList.count()>3)m_TTI.tinfo[m_TTI.ZdNum].ZdLen=DataList.at(3); + if(DataList.count()>4)m_TTI.tinfo[m_TTI.ZdNum].ZdAlias=DataList.at(4); + m_TTI.ZdNum++; + } +} +bool WisTableTran::GetTranTableInf() +{//读TableTran.ini + m_TranNum=0; + QString ConfigName = GetConfPath()+"TableTran.ini"; + QFile InFile(ConfigName); + if( !InFile.open(QIODevice::ReadOnly ) )return 0; + QTextStream textstream( &InFile ); + QString line; + while(!textstream.atEnd()) + { + line=textstream.readLine(); + if(line.indexOf("//")>=0)continue; + if(line.indexOf("#")>=0)m_TranNum++; + } + if(!m_TranNum){ + InFile.close(); + return 0; + } + InFile.seek(0); + m_TTI=new TRANTABLEINF[m_TranNum]; + + int num=-1; + QStringList temp; + while(!textstream.atEnd()) + { + line=textstream.readLine(); + if(line.indexOf("//")>=0)continue; + line=line.toUpper(); + if(line.indexOf("#")>=0) + { + if(num>=0) + { + GetTTI(m_TTI[num],temp); + temp.clear(); + } + num++; + line=line.replace("#",""); + QStringList DataList=GetStringList(line,1,1,1,1,1); + m_TTI[num].OutName=DataList.at(0); + m_TTI[num].InName=DataList.at(1); + if(DataList.count()>2)m_TTI[num].AliasName=DataList.at(2); + } + else temp.append(line); + } + GetTTI(m_TTI[num],temp); + InFile.close(); + for(int i=0;i0)tempName=tempName.replace("+",","); + if(tempName.indexOf("-")>0)tempName=tempName.replace("-",","); + QStringList tempList=tempName.split(","); + for(int m=0;m-1) { + ConfigName+=GetOilFieldName(); + iswis=1; + } + ConfigName+=table_inf; + QFile InFile(ConfigName); + if( !InFile.open(QIODevice::ReadOnly ) ) + { + QMessageBox::warning(NULL,"提示","打开缺省表配置文件"+ConfigName+"错误"); + return 0; + } + QTextStream textstream( &InFile ); + QString line; + + QString TableName,TableAliasName; + //int ZdNum; + QStringList ZdName,HzName,ZdUnit,ZdLen,ZdType,ZdRes,DataList; + + while(!textstream.atEnd()) + { + line=textstream.readLine(); + line=line.toUpper(); + while(line.indexOf("#")>=0) + { + line=line.replace("#",""); + DataList=GetStringList(line,1,1,1,1,1); + if(DataList.count()<2)continue; + TableName=DataList.at(0); + TableAliasName=DataList.at(1); + QString menuinfo[50]; + for(int m=0;m=0) + { + QString str=line; + str.trimmed(); + int len=str.length(); + if(len>-1&&str.at(len-1)==',') + { + while(!textstream.atEnd()) + { + line=textstream.readLine(); + str+=line; + str.trimmed(); + int len=str.length(); + if(len>-1&&str.at(len-1)!=',') break; + } + } + int ind=ZdName.size()-1; + if(ind>-1) menuinfo[ind]=str; + continue;//枚举行 + } + line=line.toUpper(); + if(line.indexOf("#")>=0) + { + break; + } + DataList=GetStringList(line,1,1,1,1,1); + if(DataList.count()<5)continue; + + ZdName.append(DataList.at(0)); + HzName.append(DataList.at(1)); + ZdUnit.append(DataList.at(2)); + + bool IsZdType=0; + for(int j=0;j<11;j++) + { + if(DataList.at(3)==QString(Rep_STR[j])) + { + ZdType.append(QString::number(j+1)); + IsZdType=1; + break; + } + } + if(!IsZdType)QMessageBox::warning(NULL,"提示","defauletable.ini文件中表"+TableName+"的字段名"+DataList.at(0)+"类型不正确"); + ZdLen.append(DataList.at(4)); + if(DataList.count()>5) { + if(DataList.at(5).toInt()>0) + { + QString filename=GetConfPath(); + switch(DataList.at(5).toInt()) + { + case 1: + filename+="RESULT.ini"; + break; + case 2: + filename+="GujingOrder.ini"; + break; + case 3: + filename+="CoreOil.ini"; + break; + case 4: + filename+="CoreLith.ini"; + break; + case 5: + filename+="Corecolor.ini"; + break; + case 6: + filename+="colorind.ini"; + break; + case 7: + filename+="GeoLith.ini"; + break; + } + FILE *fp1=fopen(filename.toStdString().c_str(),"r+t"); + QString str; + if(fp1) { + char buf1[100]; + int flag=0; + str="MENU="; + while(!feof(fp1)) { + int ret=fscanf(fp1,"%s",buf1); + if(ret<1) break; + if(flag) str+=","; + else flag=1; + str+=buf1; + } + fclose(fp1); + } + int ind=ZdRes.size(); + menuinfo[ind]=str; + } + ZdRes.append(DataList.at(5)); + } + else ZdRes.append("0"); + } + WisDefTable[m]=SetTableInf(TableName,TableAliasName,ZdName.count(),ZdName,HzName,ZdUnit,ZdType,ZdLen,ZdRes,menuinfo); + ZdName.clear(); + ZdLen.clear(); + ZdType.clear(); + HzName.clear(); + ZdUnit.clear(); + ZdRes.clear(); + for(int i=0;i<50;i++) + { + menuinfo[i]=""; + } + break; + } + } + } + } + InFile.close(); + if(iswis){ + //检查输出匹配表名是否在系统定义的缺省表中 + int nn=0,mm=0; + QString mes="TableTran.ini中定义的输出表名:\r\n"; + QString ZdMes=""; + for(int i=0;i=0)break; +#pragma region 相同字段 + //如果没有和缺省表名相同的表,检查是否有同结构的表,如要把GEOSTRATUM转成LAYER_DATA的表 + if(!IsS2W)DefTab=&WisDefTable[m]; + else DefTab=&SlfDefTable[m]; + if(fieldNum==DefTab->ZdNum)//m_TTI[m].OutName==TableName) + { + TranTable=m; + // 检查字段名、字段类型是否完全一致 + for(int k=0;ktinfo[k].Name,tableFieldInfo[k].Name)!=0 + ||DefTab->tinfo[k].RepCode!=tableFieldInfo[k].RepCode + ||DefTab->tinfo[k].CodeLength!=tableFieldInfo[k].Length) + { + TranTable=-1; + break; + } + } + if(TranTable>=0)break; + } +#pragma endregion 相同字段 + } + return TranTable; +} +void WisTableTran::GetOutInf(int TranTable) +{ + if(outinf)delete []outinf; + outinf=new OUTINF[m_TTI[TranTable].ZdNum]; + for(int n=0;n0||tempName.indexOf("-")>0) + { + if(tempName.indexOf("+")>0)outinf[n].Sep="+"; + if(tempName.indexOf("-")>0)outinf[n].Sep="-"; + tempNameList=tempName.split(outinf[n].Sep); + varnum=tempNameList.count(); + } + if(varnum==1)strcpy(outinf[n].InName1,tempName.toStdString().c_str()); + else + { + strcpy(outinf[n].InName1,tempNameList[0].toStdString().c_str()); + strcpy(outinf[n].InName2,tempNameList[1].toStdString().c_str()); + } + } +} +// +DEFAULTTABLE WisTableTran::SetTableInf(QString TableName,QString TableHzName,int num,QStringList ZdName,QStringList HzName,QStringList ZdUnit,QStringList ZdType,QStringList ZdLen,QStringList ZdRes,QString *menu) +{ + DEFAULTTABLE DefTable; + memset(&DefTable.tinfo,0,sizeof(DefTable.tinfo)); + DefTable.TableName=TableName; + DefTable.TableAliasName=TableHzName; + DefTable.ZdNum=num; + for(int i=0;i=0) + { + line=line.replace("#",""); + DataList=GetStringList(line,1,1,1,1,1); + if(DataList.count()<2)continue; + TableName=DataList.at(0); + TableAliasName=DataList.at(1); + for(int m=0;m=0)continue;//枚举行 + line=line.toUpper(); + if(line.indexOf("#")>=0) + { + break; + } + DataList=GetStringList(line,1,1,1,1,1); + if(DataList.count()<5)continue; + + ZdName.append(DataList.at(0));HzName.append(DataList.at(1));ZdUnit.append(DataList.at(2)); + + bool IsZdType=0; + for(int j=0;j<11;j++) + { + if(DataList.at(3)==QString(Rep_STR[j])) + { + ZdType.append(QString::number(j+1)); + IsZdType=1; + break; + } + } + if(!IsZdType)QMessageBox::warning(NULL,"提示","defauletable.ini文件中表"+TableName+"的字段名"+DataList.at(0)+"类型不正确"); + ZdLen.append(DataList.at(4)); + if(DataList.count()>5)ZdRes.append(DataList.at(5)); + else ZdRes.append("0"); + } + DEFAULTTABLE DefTable=SetTableInf(TableName,TableAliasName,ZdName.count(),ZdName,HzName,ZdUnit,ZdType,ZdLen,ZdRes,NULL); + if(IsWis) + { + //WisDefTable[m].tinfo=new Slf_OBJECT_FIELD[DefTable.ZdNum+1]; + memcpy(&WisDefTable[m],&DefTable,sizeof(DefTable)); + } + else + { + //SlfDefTable[m].tinfo=new Slf_OBJECT_FIELD[DefTable.ZdNum+1]; + memcpy(&SlfDefTable[m],&DefTable,sizeof(DefTable)); + } + ZdName.clear(),ZdLen.clear(),ZdType.clear(),HzName.clear();ZdUnit.clear(); + break; + } + } + } + } + InFile.close(); + return ; +} diff --git a/ConvertorManager/src/importdata.ui b/ConvertorManager/src/importdata.ui index 61b79ea..ee43c5f 100644 --- a/ConvertorManager/src/importdata.ui +++ b/ConvertorManager/src/importdata.ui @@ -1,53 +1,53 @@ - - - ImportData - - - - 0 - 0 - 766 - 721 - - - - ImportData - - - - - - - - 1 - - - - Tab_1 - - - - - - - - - - Tab 2 - - - - - - - - - - - - - - - - - + + + ImportData + + + + 0 + 0 + 766 + 721 + + + + ImportData + + + + + + + + 1 + + + + Tab_1 + + + + + + + + + + Tab 2 + + + + + + + + + + + + + + + + + diff --git a/ConvertorManager/src/importdataDialog.ui b/ConvertorManager/src/importdataDialog.ui index 385865a..a3ff4d2 100644 --- a/ConvertorManager/src/importdataDialog.ui +++ b/ConvertorManager/src/importdataDialog.ui @@ -1,200 +1,200 @@ - - - ImportData - - - - 0 - 0 - 1129 - 827 - - - - ImportData - - - - 0 - - - 0 - - - - - 0 - - - - - - 新宋体 - 10 - - - - 1 - - - - - 新宋体 - 10 - - - - Tab_1 - - - - - - 0 - - - - - - - - - 新宋体 - 10 - - - - Tab 2 - - - - - - 0 - - - - - - - - - - - 0 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 新宋体 - 12 - - - - 全选 - - - - - - - - 新宋体 - 12 - - - - 全不选 - - - - - - - - 新宋体 - 12 - - - - 反选 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 新宋体 - 12 - - - - 确定 - - - - - - - - 新宋体 - 12 - false - - - - 取消 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - + + + ImportData + + + + 0 + 0 + 1129 + 827 + + + + ImportData + + + + 0 + + + 0 + + + + + 0 + + + + + + 新宋体 + 10 + + + + 1 + + + + + 新宋体 + 10 + + + + Tab_1 + + + + + + 0 + + + + + + + + + 新宋体 + 10 + + + + Tab 2 + + + + + + 0 + + + + + + + + + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 新宋体 + 12 + + + + 全选 + + + + + + + + 新宋体 + 12 + + + + 全不选 + + + + + + + + 新宋体 + 12 + + + + 反选 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 新宋体 + 12 + + + + 确定 + + + + + + + + 新宋体 + 12 + false + + + + 取消 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + diff --git a/ConvertorManager/src/interface.ui b/ConvertorManager/src/interface.ui index 1086785..717364e 100644 --- a/ConvertorManager/src/interface.ui +++ b/ConvertorManager/src/interface.ui @@ -1,241 +1,241 @@ - - - Interface - - - - 0 - 0 - 784 - 727 - - - - Interface - - - - 0 - - - - - 0 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 华文宋体 - 14 - - - - 数据预览区 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 华文宋体 - 14 - - - - 测井基本信息 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - 0 - - - - - - - - - - - - - - 华文宋体 - 14 - - - - 数据选择区 - - - Qt::AlignCenter - - - - 0 - - - 0 - - - - - - - - - - - - - 反选 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 全选 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 全不选 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 确定 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 取消 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - + + + Interface + + + + 0 + 0 + 784 + 727 + + + + Interface + + + + 0 + + + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 华文宋体 + 14 + + + + 数据预览区 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 华文宋体 + 14 + + + + 测井基本信息 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 0 + + + + + + + + + + + + + + 华文宋体 + 14 + + + + 数据选择区 + + + Qt::AlignCenter + + + + 0 + + + 0 + + + + + + + + + + + + + 反选 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 全选 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 全不选 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 确定 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 取消 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + diff --git a/ConvertorManager/src/interfaceWidget.ui b/ConvertorManager/src/interfaceWidget.ui index 401f1de..61f8bef 100644 --- a/ConvertorManager/src/interfaceWidget.ui +++ b/ConvertorManager/src/interfaceWidget.ui @@ -1,1006 +1,1006 @@ - - - Interface - - - - 0 - 0 - 963 - 990 - - - - - 黑体 - - - - Interface - - - QLabel,QLineEdit,QComboBox,QDateEdit -{ -font:16px; -} -QHeaderView -{ -font:17px; -} - - - - - - - - - 0 - 0 - - - - - 600 - 0 - - - - - 590 - 16777215 - - - - - 1 - - - 1 - - - - - 12 - - - - - - 0 - - - 0 - - - - - 6 - - - 12 - - - - - - 0 - 0 - - - - 输入井 - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - 输入井次 - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - 操作日期 - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - 井类型 - - - - - - - - - - 0 - 0 - - - - - - - - 测井系列 - - - - - - - - 0 - 0 - - - - - - - - - - - 0 - 0 - - - - 输出深度 - - - - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - 文件深度 - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - 0 - 0 - - - - - - - - - - - - - - - 井代码 - - - - - - - - - - 地区名 - - - - - - - - - - 油公司名 - - - - - - - - - - - - - - x(m) - - - - - - - - - - y(m) - - - - - - - - - - 地面海拔 - - - - - - - - - - 补心海拔 - - - - - - - - - - - - - - 开钻日期 - - - - - - - - - - 完钻日期 - - - - - - - - - - - - - - 完井日期 - - - - - - - - - - 完井方法 - - - - - - - - - - - - - - 测井公司 - - - - - - - - - - 测井小队 - - - - - - - - - - - - - - 操作员 - - - - - - - - - - 测井项目 - - - - - - - - - - - - - - - 20 - 0 - - - - 测井剖面 - - - - - - - - - - 井底温度: - - - - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'黑体'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'SimSun'; font-size:12pt; vertical-align:super;">0</span><span style=" font-family:'SimSun'; font-size:12pt;">C</span></p></body></html> - - - - - - - - - - - - - - 70 - 10 - 481 - 20 - - - - - - - 1 - - - - - - - 2 - - - - - - - 3 - - - - - - - 4 - - - - - - - 5 - - - - - - - - - 10 - 60 - 541 - 29 - - - - - - - 套管程序 - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 - 30 - 541 - 29 - - - - - - - 钻头程序 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 泥浆 - - - - - 30 - 40 - 531 - 43 - - - - - - - 密度 - - - - - - - - - - G/CM3 - - - - - - - 温度 - - - - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'黑体'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'SimSun'; font-size:12pt; vertical-align:super;">0</span><span style=" font-family:'SimSun'; font-size:12pt;">C</span></p></body></html> - - - - - - - 电阻率 - - - - - - - - - - OHMM/M - - - - - - - - - 30 - 10 - 531 - 43 - - - - - - - 粘度 - - - - - - - - - - S - - - - - - - - 100 - 100 - - - - - 20 - 20 - - - - 类型 - - - - - - - - - - 失水量 - - - - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'SimSun'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt;">%</span></p></body></html> - - - - - - - - - - - 短套 - - - - - 10 - 30 - 541 - 29 - - - - - - - 短套1 - - - - - - - - - - - - - - - - - - - - - - 10 - 60 - 541 - 29 - - - - - - - 短套2 - - - - - - - - - - - - - - - - - - - - - - 60 - 10 - 491 - 20 - - - - - - - 长度 - - - - - - - 起始深度 - - - - - - - 终止深度 - - - - - - - - - - - - - 测井井段 - - - - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'黑体'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'SimSun'; font-size:12pt;">m</span></p></body></html> - - - - - - - 解释井段 - - - - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'黑体'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'SimSun'; font-size:12pt;">m</span></p></body></html> - - - - - - - - - - - 解释程序 - - - - - - - - - - 解释员 - - - - - - - - - - 审核: - - - - - - - - - - - - - - - 0 - - - - - 备注: - - - - - - - - 0 - 40 - - - - 50 - - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - QTextEdit::NoWrap - - - - - - - - - - - + + + Interface + + + + 0 + 0 + 963 + 990 + + + + + 黑体 + + + + Interface + + + QLabel,QLineEdit,QComboBox,QDateEdit +{ +font:16px; +} +QHeaderView +{ +font:17px; +} + + + + + + + + + 0 + 0 + + + + + 600 + 0 + + + + + 590 + 16777215 + + + + + 1 + + + 1 + + + + + 12 + + + + + + 0 + + + 0 + + + + + 6 + + + 12 + + + + + + 0 + 0 + + + + 输入井 + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + 输入井次 + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + 操作日期 + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + 井类型 + + + + + + + + + + 0 + 0 + + + + + + + + 测井系列 + + + + + + + + 0 + 0 + + + + + + + + + + + 0 + 0 + + + + 输出深度 + + + + + + + + + + + 0 + 0 + + + + - + + + + + + + + + + 文件深度 + + + + + + + + + + - + + + + + + + + + + + + + + + true + + + + 0 + 0 + + + + + + + + + + + + + + + 井代码 + + + + + + + + + + 地区名 + + + + + + + + + + 油公司名 + + + + + + + + + + + + + + x(m) + + + + + + + + + + y(m) + + + + + + + + + + 地面海拔 + + + + + + + + + + 补心海拔 + + + + + + + + + + + + + + 开钻日期 + + + + + + + + + + 完钻日期 + + + + + + + + + + + + + + 完井日期 + + + + + + + + + + 完井方法 + + + + + + + + + + + + + + 测井公司 + + + + + + + + + + 测井小队 + + + + + + + + + + + + + + 操作员 + + + + + + + + + + 测井项目 + + + + + + + + + + + + + + + 20 + 0 + + + + 测井剖面 + + + + + + + + + + 井底温度: + + + + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'黑体'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'SimSun'; font-size:12pt; vertical-align:super;">0</span><span style=" font-family:'SimSun'; font-size:12pt;">C</span></p></body></html> + + + + + + + + + + + + + + 70 + 10 + 481 + 20 + + + + + + + 1 + + + + + + + 2 + + + + + + + 3 + + + + + + + 4 + + + + + + + 5 + + + + + + + + + 10 + 60 + 541 + 29 + + + + + + + 套管程序 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 + 30 + 541 + 29 + + + + + + + 钻头程序 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 泥浆 + + + + + 30 + 40 + 531 + 43 + + + + + + + 密度 + + + + + + + + + + G/CM3 + + + + + + + 温度 + + + + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'黑体'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'SimSun'; font-size:12pt; vertical-align:super;">0</span><span style=" font-family:'SimSun'; font-size:12pt;">C</span></p></body></html> + + + + + + + 电阻率 + + + + + + + + + + OHMM/M + + + + + + + + + 30 + 10 + 531 + 43 + + + + + + + 粘度 + + + + + + + + + + S + + + + + + + + 100 + 100 + + + + + 20 + 20 + + + + 类型 + + + + + + + + + + 失水量 + + + + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'SimSun'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt;">%</span></p></body></html> + + + + + + + + + + + 短套 + + + + + 10 + 30 + 541 + 29 + + + + + + + 短套1 + + + + + + + + + + + + + + + + + + + + + + 10 + 60 + 541 + 29 + + + + + + + 短套2 + + + + + + + + + + + + + + + + + + + + + + 60 + 10 + 491 + 20 + + + + + + + 长度 + + + + + + + 起始深度 + + + + + + + 终止深度 + + + + + + + + + + + + + 测井井段 + + + + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'黑体'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'SimSun'; font-size:12pt;">m</span></p></body></html> + + + + + + + 解释井段 + + + + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'黑体'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'SimSun'; font-size:12pt;">m</span></p></body></html> + + + + + + + + + + + 解释程序 + + + + + + + + + + 解释员 + + + + + + + + + + 审核: + + + + + + + + + + + + + + + 0 + + + + + 备注: + + + + + + + + 0 + 40 + + + + 50 + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + QTextEdit::NoWrap + + + + + + + + + + + diff --git a/ConvertorManager/src/tishidialog.cpp b/ConvertorManager/src/tishidialog.cpp index 05d69cf..1eec199 100644 --- a/ConvertorManager/src/tishidialog.cpp +++ b/ConvertorManager/src/tishidialog.cpp @@ -1,55 +1,55 @@ -#include "tishidialog.h" - -TiShiDialog::TiShiDialog(QWidget *parent) - : QDialog(parent) -{ - m_pUI.setupUi(this); - QObject::connect(m_pUI.pushButtonTH, SIGNAL(clicked()), this, SLOT(slotTH())); - QObject::connect(m_pUI.pushButtonHB, SIGNAL(clicked()), this, SLOT(slotHB())); - QObject::connect(m_pUI.pushButtonLC, SIGNAL(clicked()), this, SLOT(slotLC())); - QObject::connect(m_pUI.pushButtonTG, SIGNAL(clicked()), this, SLOT(slotTG())); - QObject::connect(m_pUI.checkBox, SIGNAL(clicked()), this, SLOT(slotCheck())); - check=0; - m_pUI.checkBox->setCheckState(Qt::Unchecked); -} -void TiShiDialog::slotCheck() -{ - if(m_pUI.checkBox->checkState()==Qt::Unchecked)check=0; - else check=1; -} -TiShiDialog::~TiShiDialog() -{ - -} -void TiShiDialog::slotTH() -{ - flag=1; - accept(); - return ; -} -void TiShiDialog::slotHB() -{ - flag=2; - accept(); - return ; -} -void TiShiDialog::slotLC() -{ - flag=3; - accept(); - return ; -} -void TiShiDialog::slotTG() -{ - flag=0; - accept(); - return ; -} -void TiShiDialog::init(std::vector OutCurve,QString qss) -{ - for(int i=0;iappend(QString(OutCurve[i])); - } - m_pUI.label->setText(qss+"井次中下列数据已存在"); +#include "tishidialog.h" + +TiShiDialog::TiShiDialog(QWidget *parent) + : QDialog(parent) +{ + m_pUI.setupUi(this); + QObject::connect(m_pUI.pushButtonTH, SIGNAL(clicked()), this, SLOT(slotTH())); + QObject::connect(m_pUI.pushButtonHB, SIGNAL(clicked()), this, SLOT(slotHB())); + QObject::connect(m_pUI.pushButtonLC, SIGNAL(clicked()), this, SLOT(slotLC())); + QObject::connect(m_pUI.pushButtonTG, SIGNAL(clicked()), this, SLOT(slotTG())); + QObject::connect(m_pUI.checkBox, SIGNAL(clicked()), this, SLOT(slotCheck())); + check=0; + m_pUI.checkBox->setCheckState(Qt::Unchecked); +} +void TiShiDialog::slotCheck() +{ + if(m_pUI.checkBox->checkState()==Qt::Unchecked)check=0; + else check=1; +} +TiShiDialog::~TiShiDialog() +{ + +} +void TiShiDialog::slotTH() +{ + flag=1; + accept(); + return ; +} +void TiShiDialog::slotHB() +{ + flag=2; + accept(); + return ; +} +void TiShiDialog::slotLC() +{ + flag=3; + accept(); + return ; +} +void TiShiDialog::slotTG() +{ + flag=0; + accept(); + return ; +} +void TiShiDialog::init(std::vector OutCurve,QString qss) +{ + for(int i=0;iappend(QString(OutCurve[i])); + } + m_pUI.label->setText(qss+"井次中下列数据已存在"); } \ No newline at end of file diff --git a/ConvertorManager/src/tishidialog.h b/ConvertorManager/src/tishidialog.h index fa41aa9..38d9252 100644 --- a/ConvertorManager/src/tishidialog.h +++ b/ConvertorManager/src/tishidialog.h @@ -1,28 +1,28 @@ -#ifndef TISHIDIALOG_H -#define TISHIDIALOG_H - -#include -#include "ui_tishidialog.h" -#include -#pragma execution_character_set("utf-8") -class TiShiDialog : public QDialog -{ - Q_OBJECT - -public: - TiShiDialog(QWidget *parent = 0); - ~TiShiDialog(); - void init(std::vector OutCurve,QString); - int flag; - int check; -private: - Ui::TiShiDialog m_pUI; -private slots: - void slotTH(); - void slotHB(); - void slotLC(); - void slotTG(); - void slotCheck(); -}; - -#endif // TISHIDIALOG_H +#ifndef TISHIDIALOG_H +#define TISHIDIALOG_H + +#include +#include "ui_tishidialog.h" +#include +#pragma execution_character_set("utf-8") +class TiShiDialog : public QDialog +{ + Q_OBJECT + +public: + TiShiDialog(QWidget *parent = 0); + ~TiShiDialog(); + void init(std::vector OutCurve,QString); + int flag; + int check; +private: + Ui::TiShiDialog m_pUI; +private slots: + void slotTH(); + void slotHB(); + void slotLC(); + void slotTG(); + void slotCheck(); +}; + +#endif // TISHIDIALOG_H diff --git a/ConvertorManager/src/tishidialog.ui b/ConvertorManager/src/tishidialog.ui index 2804b89..eb33a1c 100644 --- a/ConvertorManager/src/tishidialog.ui +++ b/ConvertorManager/src/tishidialog.ui @@ -1,180 +1,180 @@ - - - TiShiDialog - - - - 0 - 0 - 382 - 333 - - - - TiShiDialog - - - - - - - - 当前井次中下列数据已存在 - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 200 - 0 - - - - - - - - 后面所有井均执行此操作 - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 0 - 0 - - - - 替换 - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 0 - 0 - - - - 合并 - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 0 - 0 - - - - 另存 - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 0 - 0 - - - - 跳过 - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - + + + TiShiDialog + + + + 0 + 0 + 382 + 333 + + + + TiShiDialog + + + + + + + + 当前井次中下列数据已存在 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + + + + + 后面所有井均执行此操作 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + 替换 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + 合并 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + 另存 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + 跳过 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + diff --git a/common/geometryutils.cpp b/common/geometryutils.cpp index db1f2d7..ed03dfa 100644 --- a/common/geometryutils.cpp +++ b/common/geometryutils.cpp @@ -10,6 +10,7 @@ #include #include "LogIO.h" #include "MemRdWt.h" +#include float mLineWidth=0.75; QString OilField; @@ -150,6 +151,7 @@ QString GetProjectFolder() { index = index1; } + // QString strProjectDir; strProjectDir = applicationDirPath.mid(0,index+1) + "project/"; @@ -159,7 +161,6 @@ QString GetProjectFolder() { dir.mkdir(strProjectDir); } - return strProjectDir ; } @@ -176,7 +177,7 @@ QString GetLogdataPath() } // QString strImagePath; - strImagePath = applicationDirPath.mid(0,index+1) + "Logdata/"; + strImagePath = applicationDirPath.mid(0,index+1) + "LogData/"; // QDir dir(strImagePath); if( !dir.exists( strImagePath ) )