diff --git a/CallManage/CallManage.h b/CallManage/CallManage.h index 27f2dd6..57f5cdb 100644 --- a/CallManage/CallManage.h +++ b/CallManage/CallManage.h @@ -205,6 +205,9 @@ signals: //向左侧树图,追加固井结论表格 void sig_AddGujingToTree(QString strSlfName, QString strWellName, QString strLineName); + //改变固井曲线名 + void sig_changeGujingLine(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strNewLineName); + // //void sig_addImageToPlot(QMyCustomPlot* customPlot, double left_Low, double right_Hight, QString imagePath); diff --git a/DataMgr/src/DataHelper.h b/DataMgr/src/DataHelper.h deleted file mode 100644 index e03bb9f..0000000 --- a/DataMgr/src/DataHelper.h +++ /dev/null @@ -1,115 +0,0 @@ -#ifndef DATAHELPER_H -#define DATAHELPER_H - -#ifdef WIN32 - #include -#endif // WIN32 - -#include -#include -#include "MemRdWt.h" -#include "DataManagerDefs.h" -#pragma execution_character_set("utf-8") -//#define DefTabNum 10//9 whp change 2020.5.25 -//for 曲线计算 -#define MaxArg 26 // 最大自变量数 -#define DELIMITER 1 -#define VARIABLE 2 -#define MNUMBER 3 -struct DEFAULTTABLE -{ -public: - QString TableName; - QString TableAliasName; - int ZdNum; - Slf_OBJECT_FIELD *tinfo; - //Slf_TABLE_FIELD *tinfo; -}; - -#pragma endregion 导入表数据定义的函数,可以单独建立动态库文件 - - -class DATAMGS_EXPORT DataHelper -{ -public: - DataHelper(); - ~DataHelper(); - #pragma region 导入表数据定义的函数,可以单独建立动态库文件 - //whp change 2020.3.9 for 统一离散数据入口 - //static QStringList GetVlidTable(QStringList listFiles);//过滤掉无效数据表 - static QStringList GetVlidTable(int curitemType,QStringList listFiles,QStringList &BadlistFiles);//过滤掉无效数据表 - static int StrType(QString str);//IsNumberStr(QString str)判断字符串是否为数值,是整数还是浮点数 - - static DEFAULTTABLE SetTableInf(QString TableName,QString TableHzName,int num,QStringList ZdName,QStringList HzName,QStringList ZdUnit,QStringList ZdType,QStringList ZdLen,QStringList ZdRes); - static void InitDefauleTable(); - - static void DelDefauleTable(); - - static int GetSimilarTable(int ZdNum,int *FieldType);//匹配缺省表,返回缺省表序号m=1,BOOL IsSem=1,BOOL DelDubSpa=1); - static bool IsNullLine(QByteArray line); - static bool m_IsGc; - static QStringList GetAllWellName(); - static QStringList GetAllWellRoundName(QString WellName,QStringList& WellRoundFileNameList); - static QMap > m_qmapWellFiles; -}; -class Function -{ -public: - CMemRdWt *Slffile; - float val[10]; - //whp add 2011.7.19 for字符型字段计算 - char cval[10][30]; - char *prog; - //int d_iProgramInCurvePos[MaxCurve]; - // float xx[MaxCurve]; - // ----------------------------- - // 计算产生新曲线定义开始 - //char *prog; - char token[80]; - char tok_type; - char vars[MaxArg]; - // A-Z 26 user's variable - // 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - int get_exp(float *result); - int level2(float *result); - int level3(float *result); - int level4(float *result); - int level5(float *result); - int level6(float *result); - int primitive(float *result); - void get_token(); - void arith(char o,float *r,float *h); - void unary(char o,float *r); - void serror(int error); - void putback(); - int level1(float *result); - float find_var(char *s,int *ret); - int is_in(char ch,char *s); - int isdelim(char c); - int iswhite(char c); - //int ComputeCurve(CString csExpress,float sdeps,float edeps,BOOL IsCurrentOpen); -// BOOL GetKey(); -// BOOL CheckKey(); - int GetCodeLen(int Code); - //add whp - QString csName[MaxArg],csOutName; - char TempProg[150]; - int GetExpress(QString csExpress);//返回输入变量个数(曲线条数) - // 计算产生新曲线定义结束 -}; -class Resample -{ -public: - static float GetXstep(float x2,float x1); - static void Linear(float *x,float *y,int n,float *a,float *b); - static void Parabola(float *x,float *y,int n,float *a,float *b,float *c); - static void Akima(float *x,float *y,int n,float *a,float *b,float *c,float *d); - static bool LReSampling(float *aDep,float *aVal,int anp,float *tDep,float *curve,int tnp,int method); - static void qs(float *datx,float*mr,int left,int right,int Col); - static void qs(float *datx,short*mr,int left,int right,int Col); - static void ReOrder(float *mr,int Row,int Col,float *tDep); - static void ReOrder(short *mr,int Row,int Col,float *tDep); - static void ReSampling(float *mr,int Row,int Col,float *aDep,float *tDep,int tnp); - static void ReSampling(short *mr,int Row,int Col,float *aDep,float *tDep,int tnp); -}; -#endif diff --git a/DataMgr/src/DataManagger.h b/DataMgr/src/DataManagger.h deleted file mode 100644 index 81238c9..0000000 --- a/DataMgr/src/DataManagger.h +++ /dev/null @@ -1,106 +0,0 @@ -#pragma once -#include -#include -#include -#include "DataManagerDefs.h" -#include "slf.h" -// #include "objwelllogRound.h" -// #include "ObjWelllog.h" -#pragma execution_character_set("utf-8") -class DEFAULTTABLE; -class DATAMGS_EXPORT CDataManagger:public QObject -{ - Q_OBJECT - -public: - CDataManagger(); - ~CDataManagger(); - int GetDefTabNum(); - DEFAULTTABLE *GetDefauleTable(); - void SetWellFiles(QMap > &mapWellFiles); -//whp change 2020.3.9 for 统一离散数据入口 - //交互导入数据表 - //void execInDefTable(int curitemType,const QString& showWellName,const QString& wellFileName); - void execInDefTable(int curitemType,const QString& showWellName,const QString& wellFileName,const QString& inFile); - //数据表自动导入 - //void dataInTable(const QStringList& lst ); - //QStringList dataInTable(int curitemType,const QString& showWellName,const QString& wellFileName);//返回不能识别的非定式的数据文件列表 - void dataInTable(int curitemType,QString& showWellName,QString& wellFileName); - void CopyObject(int curitemType,const QString& WellName,const QString& wellFileName); -// - //曲线属性编辑 - void CurvePropertyEdit(int Type,const QString& FileName,const QString& CurveName); - //whp add 2020.4.9 for 波列曲线预览 - void DisplayWave(const QString& FileName,const QString& CurveName); - //whp add 2020.5.12 for 常规曲线预览 - void DisplayCurve(const QString& FileName,const QString& CurveName); - //曲线数值统计 - void DataStatistics(int Type,const QString& FileName,const QString& CurveName); - //创建新曲线 - QString CreateNewCurve(const QString& wellname); - //whp 2020.7.21 - //创建新表 - QString CreateNewTable(const QString& wellname); - //2020.7.21 表属性编辑 - QString TableProEdit(const QString& wellname,const QString& tablename); - //2021.3.19 表转曲线 - QString Table2Curve(const QString& wellname,const QString& tablename); - //2021.3.23曲线转结论表格 - QString Curve2ResultTable(const QString& wellname,const QString& tablename); - //曲线计算 - // void CurveCompute(QListobjs,int No=0); - - void CurveCompute(const QString& FileName,const QStringList& CurveNameList); - //whp add 2020.4.14 合成阵列曲线 - QString WaveCompose(const QString& FileName,const QStringList& CurveNameList); - //单位转换 - void UnitConvert(const QString& Filename);//,CObjWelllogRound* pround); - //通用列表函数 - //void ListMessage(const QString& listName,const QStringList& header,const QStringList& listMessage); - //外部接口 - //曲线数值统计 - void CallDisplayWaveOrCurve(int Type, - const QString& FileName, - const QString& CurveName, - QWidget* parent); - //曲线数值统计 - //20210111 GZL add 纵滑块联动 - void CallDisplayCurveVerChange(int Type, - const QString& FileName, - const QString& CurveName, - QWidget* parent, - int value, - float tipValue); - void sendTableP2Mgr(QWidget* parent, QScrollBar *p, QTableWidget *t); - - void DataStatistics(int Type, - const QString& FileName, - const QString& CurveName, - QWidget* parent); - //曲线属性编辑 - void CurvePropertyEdit(int Type, - const QString& FileName, - const QString& CurveName, - QWidget* parent); - //曲线计算 - void CurveCompute(const QString& FileName, - const QStringList& CurveNameList, - QWidget* parent); - QString m_CurveName,m_FileName; - QLineEdit *m_edit1,*m_edit2,*m_edit3; - QDialog *m_pDialog; - //void curveViewMousePress(int pos); -signals: - //void mousePressPos(int); - -private slots: - void slotCurveComputeGc(QStringList listCurveNames); - void slotCurvePropertyGc(); - void accept1(); - void accept2(); -private: - QString m_fileName; - QStringList m_CurveNameList; - // QList m_ObjList; -}; - diff --git a/DataMgr/src/DataMgr.pro b/DataMgr/src/DataMgr.pro index dec80f9..774c86d 100644 --- a/DataMgr/src/DataMgr.pro +++ b/DataMgr/src/DataMgr.pro @@ -78,8 +78,6 @@ HEADERS += \ CurveComputePage.h \ CurveComputerDlg.h \ CurvePropertyEdit.h \ - DataHelper.h \ - DataManagger.h \ DrawCurveView.h \ DrawWaveView.h \ GeneratedFiles/SmoothTool.h \ diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index 8098183..0ce466d 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -90,11 +90,36 @@ void PropertyWidget::InitCurrentViewInfo(bool bAll) } } +//处理通用属性 +void PropertyWidget::CommonPropertyChanged( QtProperty *pProperty, const QVariant &variant ) +{ + if("显示名称" == m_propertyData[pProperty]) + { + QString newAliasName = variant.value(); + m_formInfo->m_strAliasName = newAliasName; + m_formInfo->update(); + } + else if("字体" == m_propertyData[pProperty]) + { + //字体 + // 假设variant已经被设置为包含QColor + QFont newFont = variant.value(); + m_formInfo->m_curveNameFont = newFont; + m_formInfo->update(); + } + else if("颜色" == m_propertyData[pProperty]) + { + QColor newColor = variant.value(); + m_formInfo->m_lineColor = newColor; + m_formInfo->update(); + } +} + void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant &variant ) { if(m_strCurrentProperty == "") return; - if (m_strCurrentProperty == Table_Property) + if (m_strCurrentProperty == Table_Property)//解释结论 { bool bDraw = false; QStringList slist; @@ -200,29 +225,54 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant } return; } -// else if (m_strCurrentProperty == Table_Property) -// { -// if("显示名称" == m_propertyData[pProperty]) -// { -// QString newAliasName = variant.value(); -// m_formInfo->m_strAliasName = newAliasName; -// m_formInfo->update(); -// } -// else if("字体" == m_propertyData[pProperty]) -// { -// //字体 -// // 假设variant已经被设置为包含QColor -// QFont newFont = variant.value(); -// m_formInfo->m_curveNameFont = newFont; -// m_formInfo->update(); -// } -// else if("颜色" == m_propertyData[pProperty]) -// { -// QColor newColor = variant.value(); -// m_formInfo->m_lineColor = newColor; -// m_formInfo->update(); -// } -// } + else if (m_strCurrentProperty == Gujing_Property)//固井结论道 + { + //先处理通用属性 + CommonPropertyChanged(pProperty, variant); + + // + if("选择井曲线" == m_propertyData[pProperty]) + { + QString sFilePath = variant.value(); + if(sFilePath.indexOf("@")>-1) + { + int ind=sFilePath.indexOf("@"); + QString strLineName = sFilePath.left(ind); + sFilePath=sFilePath.mid(ind+1); + sFilePath.trimmed(); + //只支持以下名称 + if (strLineName == "GUJING1_RESULT" || strLineName == "GUJING2_RESULT" || strLineName == "GUJING3_RESULT") + { + QString strOldLineName = m_formInfo->m_strLineName; + QString strOldSlfName = m_formInfo->m_strSlfName; + //暂时不允许改变slf井次名称,不然不在同一口井绘制 + if(strOldSlfName != sFilePath) + { + QMessageBox::information(nullptr,"提示","不允许改变slf井次名称"); + return; + } + //名称不变 + if(strOldLineName == strLineName) + { + return; + } + + // + m_formInfo->m_strLineName = strLineName; + //m_formInfo->m_strSlfName = sFilePath; + m_formInfo->update(); + + //改变固井曲线名 + emit CallManage::getInstance()->sig_changeGujingLine(m_formInfo->m_strUuid, m_formInfo->m_strSlfName, m_formInfo->m_strWellName, m_formInfo->m_strTrackName, strOldLineName, strLineName); + } + } + } + } + else if (m_strCurrentProperty == SwallCore_Property)//井壁取心 + { + //先处理通用属性 + CommonPropertyChanged(pProperty, variant); + } else if (m_strCurrentProperty == GujingItem_Property) { //固井结论item @@ -263,6 +313,95 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant } } } + else if (m_strCurrentProperty == SwallCoreItem_Property) + { + //井壁取心item + if("深度" == m_propertyData[pProperty]) + { + //qDebug() << "深度->改变"; + if(m_tdSwallCore) + { + double lower = variant.value(); + // 设置初始范围 + double h = SideWallCoreHeight * g_dPixelPerCm; //0.4cm //40; + double x1 = m_tdSwallCore->mPlot->xAxis->coordToPixel(-lower); + // + double Depth2 = m_tdSwallCore->mPlot->xAxis->pixelToCoord(x1-h); + m_tdSwallCore->setRange(-lower, Depth2); + //保存 + m_tdSwallCore->mPlot->SaveToSLF_SwallCore(); + } + } + else if("岩性" == m_propertyData[pProperty]) + { + //qDebug() << "岩性->改变"; + if(m_tdSwallCore) + { + QString newResult = variant.value(); + m_tdSwallCore->setLith(newResult); + // + QCPRange currentRange = m_tdSwallCore->getRange(); + m_tdSwallCore->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdSwallCore->mPlot->SaveToSLF_SwallCore(); + } + } + else if("油气" == m_propertyData[pProperty]) + { + //qDebug() << "油气->改变"; + if(m_tdSwallCore) + { + QString newResult = variant.value(); + m_tdSwallCore->setOil(newResult); + // + QCPRange currentRange = m_tdSwallCore->getRange(); + m_tdSwallCore->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdSwallCore->mPlot->SaveToSLF_SwallCore(); + } + } + else if("颜色" == m_propertyData[pProperty]) + { + //qDebug() << "颜色->改变"; + if(m_tdSwallCore) + { + QString ColorImage = variant.value(); + + QString name = ""; + int CoreColor = 0; + ColorImage.replace("\\","/"); + int l=ColorImage.lastIndexOf("/"); + if(l>-1) name=ColorImage.mid(l+1); + + l=name.indexOf("."); + if(l>-1)name=name.left(l); + int ind=m_tdSwallCore->mPlot->colors_SWallCore.indexOf(name); + if(ind<0||ind>=m_tdSwallCore->mPlot->colorinds_SWallCore.size()) CoreColor=0; + else CoreColor=m_tdSwallCore->mPlot->colorinds_SWallCore[ind].toInt(); + + m_tdSwallCore->setTitle(QString::number(CoreColor)); + // + QCPRange currentRange = m_tdSwallCore->getRange(); + m_tdSwallCore->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdSwallCore->mPlot->SaveToSLF_SwallCore(); + } + } + else if("起始位置" == m_propertyData[pProperty]) + { + //qDebug() << "起始位置->改变"; + if(m_tdSwallCore) + { + double Sideleft = variant.value(); + m_tdSwallCore->m_fLeftSpace = Sideleft*g_dPixelPerCm; + // + QCPRange currentRange = m_tdSwallCore->getRange(); + m_tdSwallCore->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdSwallCore->mPlot->SaveToSLF_SwallCore(); + } + } + } if("深度比例尺" == m_propertyData[pProperty]) { @@ -1375,6 +1514,11 @@ void PropertyWidget::initProperty(FormInfo *formInfo) //固井结论 this->initGujingProperty(formInfo); } + else if (m_strLineName == "SWALL_CORE") + { + //井壁取心 + this->initSwallCoreProperty(formInfo); + } else{ this->initTableProperty(formInfo); } @@ -1510,6 +1654,35 @@ void PropertyWidget::initWaveProperty(FormInfo *formInfo, int nType) m_strCurrentProperty = Wave_Property; } +void PropertyWidget::initSwallCoreProperty(FormInfo *formInfo) +{ + _CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String); + + _CreateVariantPropertyItem("对象", "显示名称", formInfo->m_strAliasName, QVariant::String); + _CreateVariantPropertyItem("对象", "字体", formInfo->m_curveNameFont, QVariant::Font); + _CreateVariantPropertyItem("对象", "颜色", formInfo->m_lineColor, QVariant::Color); + + m_strCurrentProperty = SwallCore_Property; +} + +void PropertyWidget::initSwallCoreItemProperty(TransparentDraggableSwallCore* tdSwallCore, double Depth, QString LithologyImage, QString OilGasImage, QString ColorImage, double Sideleft, double width, int iColor) +{ + //初始化,清空 + InitCurrentViewInfo(); + + //当前属性类型 + m_strCurrentProperty = SwallCoreItem_Property; + m_tdSwallCore = tdSwallCore; + + // + _CreateVariantPropertyItem("当前项", "深度", -Depth, QVariant::Double); + _CreateVariantPropertyItem("当前项", "岩性", LithologyImage, VariantManager::filePathTypeId()); + _CreateVariantPropertyItem("当前项", "油气", OilGasImage, VariantManager::filePathTypeId()); + _CreateVariantPropertyItem("当前项", "颜色", ColorImage, VariantManager::filePathTypeId()); + _CreateVariantPropertyItem("当前项", "起始位置", Sideleft, QVariant::Double); + //_CreateVariantPropertyItem("当前项", "宽度", -Depth, QVariant::Double); +} + void PropertyWidget::initGujingProperty(FormInfo *formInfo) { _CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String); @@ -1518,7 +1691,7 @@ void PropertyWidget::initGujingProperty(FormInfo *formInfo) _CreateVariantPropertyItem("对象", "字体", formInfo->m_curveNameFont, QVariant::Font); _CreateVariantPropertyItem("对象", "颜色", formInfo->m_lineColor, QVariant::Color); - m_strCurrentProperty = Table_Property; + m_strCurrentProperty = Gujing_Property; } void PropertyWidget::initGujingItemProperty(TransparentDraggableGujing* tdGujing, double lower, double upper, QString strResult) diff --git a/logPlus/PropertyWidget.h b/logPlus/PropertyWidget.h index f44446d..5c00c12 100644 --- a/logPlus/PropertyWidget.h +++ b/logPlus/PropertyWidget.h @@ -21,6 +21,7 @@ #include "qmytablewidget.h" #include "formtracktop.h" #include "TransparentDraggableGujing.h" +#include "TransparentDraggableSwallCore.h" //当前曲线类型 #define Widget_Property "Widget_Property" @@ -28,11 +29,14 @@ #define Track_Property "Track_Property" //道 #define Curve_Property "Curve_Property" //曲线 #define Wave_Property "Wave_Property" //波列 -#define Table_Property "Table_Property" //表格曲线 -#define Head_Property "Head_Property" //图头,单元格 -#define GujingItem_Property "GujingItem_Property" //固井item - #define Table_Property "Table_Property" //解释结论 +#define Head_Property "Head_Property" //图头,单元格 + +#define Gujing_Property "Gujing_Property" //固井结论 +#define GujingItem_Property "GujingItem_Property" //固井item + +#define SwallCore_Property "SwallCore_Property" //井壁取心 +#define SwallCoreItem_Property "SwallCoreItem_Property" //井壁取心item #pragma execution_character_set("utf-8") @@ -98,7 +102,8 @@ public: bool m_bSelfChange=false; // - TransparentDraggableGujing* m_tdGujing; + TransparentDraggableGujing* m_tdGujing; + TransparentDraggableSwallCore* m_tdSwallCore; public: QWidget* GetPropertyWidget(); @@ -133,12 +138,19 @@ public: void initGujingProperty(FormInfo *formInfo); void initGujingItemProperty(TransparentDraggableGujing* tdGujing, double lower, double upper, QString strResult); + // 井壁取心属性 + void initSwallCoreProperty(FormInfo *formInfo); + void initSwallCoreItemProperty(TransparentDraggableSwallCore* tdSwallCore, double Depth, QString LithologyImage, QString OilGasImage, QString ColorImage, double Sideleft, double width, int iColor); + void ChangFillProperty();//填充属性改变 void ChangHeadItemProperty();//图头项改变 + //处理通用属性 + void CommonPropertyChanged(QtProperty *pProperty, const QVariant &variant); + public slots: - void SlotPropertyChanged( QtProperty *property, const QVariant &variant ); + void SlotPropertyChanged(QtProperty *property, const QVariant &variant); void SlotPropertyChanged(QtProperty *property, const int &val, bool islinestyle); }; diff --git a/logPlus/TransparentDraggableGujing.cpp b/logPlus/TransparentDraggableGujing.cpp index 7bdfcc9..26c9578 100644 --- a/logPlus/TransparentDraggableGujing.cpp +++ b/logPlus/TransparentDraggableGujing.cpp @@ -323,7 +323,7 @@ void TransparentDraggableGujing::onSplitRect() mPlot->SaveToSLF_Gujing(); //取消所有选中单元格 - emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 1, ""); + emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, ""); } //删除 @@ -380,7 +380,7 @@ void TransparentDraggableGujing::setItemDepthOffset() PropertyService()->InitCurrentViewInfo(); //取消所有选中单元格 - emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 1, ""); + emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, ""); } } @@ -606,7 +606,7 @@ void TransparentDraggableGujing::onMouseRelease(QMouseEvent *event) mPlot->SaveToSLF_Gujing(); //取消所有选中单元格 - emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 1, ""); + emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, ""); } //避免二次绘制框图 diff --git a/logPlus/TransparentDraggableSwallCore.cpp b/logPlus/TransparentDraggableSwallCore.cpp index 73da993..a8b443a 100644 --- a/logPlus/TransparentDraggableSwallCore.cpp +++ b/logPlus/TransparentDraggableSwallCore.cpp @@ -9,6 +9,11 @@ TransparentDraggableSwallCore::TransparentDraggableSwallCore(QMyCustomPlot *pare : QObject(parentPlot), mPlot(parentPlot), mstrTitle(strTitle), mMinWidth(minWidth) { m_strUuid = strUuid; + + //图片高度(需要根据高度宏定义,重新计算) +// double h = SideWallCoreHeight * g_dPixelPerCm; //0.4cm //40; +// m_fImageHeight = h/2.0; + // initRect(); } @@ -530,8 +535,18 @@ void TransparentDraggableSwallCore::onMousePress(QMouseEvent *event) //event->accept(); double low = mRect->topLeft->coords().x(); - double hight = mRect->bottomRight->coords().x(); - //PropertyService()->initSwallCoreItemProperty(this, low, hight, m_Result); + //double hight = mRect->bottomRight->coords().x(); + QString ColorImage = ""; + int ind=mPlot->colorinds_SWallCore.indexOf(mstrTitle); + if (ind>-1&&indcolors_SWallCore.size()) + { + ColorImage=::GetColorSymbolDir()+""+mPlot->colors_SWallCore[ind]+".svg"; + } + else { + ColorImage=""; + } + + PropertyService()->initSwallCoreItemProperty(this, low, m_Lith, m_Oil, ColorImage, m_fLeftSpace / g_dPixelPerCm, 1, mstrTitle.toInt()); QMenu menu(nullptr); menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "删除选中对象", this, &TransparentDraggableSwallCore::onDelRect); @@ -701,10 +716,6 @@ void TransparentDraggableSwallCore::setItemDepthOffset() setRange(newRange.lower, newRange.upper); { -// double low = mRect->topLeft->coords().x(); -// double hight = mRect->bottomRight->coords().x(); -// PropertyService()->initGujingItemProperty(this, low, hight, m_Result); - //保存 mPlot->SaveToSLF_SwallCore(); @@ -712,7 +723,7 @@ void TransparentDraggableSwallCore::setItemDepthOffset() PropertyService()->InitCurrentViewInfo(); //取消所有选中单元格 - emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 1, ""); + emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, ""); } } @@ -720,6 +731,29 @@ void TransparentDraggableSwallCore::onMouseRelease(QMouseEvent *event) { if(event->button() == Qt::LeftButton && mDragMode != DragNone) { event->accept(); + //属性 + //if(mDragMode == DragRect) + { + double low = mRect->topLeft->coords().x(); + QString ColorImage = ""; + int ind=mPlot->colorinds_SWallCore.indexOf(mstrTitle); + if (ind>-1&&indcolors_SWallCore.size()) + { + ColorImage=::GetColorSymbolDir()+""+mPlot->colors_SWallCore[ind]+".svg"; + } + else { + ColorImage=""; + } + + PropertyService()->initSwallCoreItemProperty(this, low, m_Lith, m_Oil, ColorImage, m_fLeftSpace / g_dPixelPerCm, 1, mstrTitle.toInt()); + + //保存 + mPlot->SaveToSLF_SwallCore(); + + //取消所有选中单元格 + emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 0, ""); + } + //避免二次绘制框图 mPlot->m_bDrawRect = false; //emit rangeChanged(getRange()); diff --git a/logPlus/TransparentDraggableSwallCore.h b/logPlus/TransparentDraggableSwallCore.h index d59161e..91aebfc 100644 --- a/logPlus/TransparentDraggableSwallCore.h +++ b/logPlus/TransparentDraggableSwallCore.h @@ -102,7 +102,7 @@ public: float m_fTriangleLen=40;//三角形长度 // float m_fImageWidth=70;//图片长度 - float m_fImageHeight=20;//图片高度 + float m_fImageHeight=20;//图片高度(需要根据高度宏定义,重新计算) // float m_fColorWordLen=40;//颜色文字长度 }; diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index e7feb49..1b51467 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -298,7 +298,12 @@ void FormDraw::DisplayLines(QJsonArray linesArray) if (strLineName == "GUJING1_RESULT" || strLineName == "GUJING2_RESULT" || strLineName == "GUJING3_RESULT") { //固井结论 - DisplayType_Gujing(lineObjInfo); + DisplayTable_One(lineObjInfo); + } + else if (strLineName == "SWALL_CORE") + { + //井壁取心 + DisplayTable_One(lineObjInfo); } } else @@ -311,8 +316,8 @@ void FormDraw::DisplayLines(QJsonArray linesArray) } } -//固井结论 -void FormDraw::DisplayType_Gujing(QJsonObject lineObjInfo) +//结论 +void FormDraw::DisplayTable_One(QJsonObject lineObjInfo) { QString strSlfName = ""; QString strWellName = ""; @@ -385,10 +390,10 @@ void FormDraw::DisplayType_Gujing(QJsonObject lineObjInfo) if (strLineName != "") { QStringList listOtherProperty; - listOtherProperty.append(strAliasName);//固井别名 - listOtherProperty.append(lineColor.name());//固井名称颜色 - listOtherProperty.append(curveNameFont.toString());//固井名称字体 - //固井结论 + listOtherProperty.append(strAliasName);//别名 + listOtherProperty.append(lineColor.name());//名称颜色 + listOtherProperty.append(curveNameFont.toString());//名称字体 + //结论 this->addTableLine(m_strUuid, strSlfName, strWellName, m_strTrackName, strLineName, listOtherProperty); } } @@ -820,7 +825,17 @@ QMyCustomPlot* FormDraw::addTableLine(QString strUuid, QString strSlfName, QStri else if (strLineName == "SWALL_CORE") { //井壁取心 - initSwallCore(curv, strSlfName, strLineName); + if(listOtherProperty.size()>=3) + { + QString strAliasName = listOtherProperty[0]; + QColor newlineColor=QColor(0,0,0); + newlineColor.setNamedColor(listOtherProperty[1]); + initSwallCore(curv, strSlfName, strLineName, strAliasName, newlineColor, listOtherProperty); + } + else + { + initSwallCore(curv, strSlfName, strLineName); + } } else if (strLineName == "GUJING1_RESULT" || strLineName == "GUJING2_RESULT" || strLineName == "GUJING3_RESULT") { @@ -4097,7 +4112,7 @@ bool FormDraw::LoadFromSLF_GeoLith(QMyCustomPlot *widget, QString strSlfName, QS } //井壁取心 -void FormDraw::initSwallCore(QMyCustomPlot *widget, QString strSlfName, QString strLineName) +void FormDraw::initSwallCore(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName, QColor newlineColor, QStringList listOtherProperty) { int iMyWidth = widget->axisRect(0)->width(); @@ -4132,13 +4147,16 @@ void FormDraw::initSwallCore(QMyCustomPlot *widget, QString strSlfName, QString // widget->LoadFromSLF_SwallCore(strSlfName, strLineName); - QString strAliasName = ""; + if(listOtherProperty.size()>=3) + { + strAliasName = listOtherProperty[0]; + newlineColor.setNamedColor(listOtherProperty[1]); + } QString strUnit = ""; - QColor newlineColor=QColor(0,0,0); double width=2; QString strScaleType = ""; //道-对象 - m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_RightVal, m_LeftVal, strScaleType, "tableObject"); + m_formTrack->Add(strSlfName, m_strWellName, m_strTrackName, strLineName, strAliasName, strUnit, newlineColor, width, m_RightVal, m_LeftVal, strScaleType, "tableObject", listOtherProperty); } diff --git a/logPlus/formdraw.h b/logPlus/formdraw.h index 85f8dd7..ef5ce32 100644 --- a/logPlus/formdraw.h +++ b/logPlus/formdraw.h @@ -57,7 +57,7 @@ public: void DisplayLines(QJsonArray linesArray); void DisplayLine_One(QJsonObject lineObjInfo); void DisplayType_One(QJsonObject objInfo); - void DisplayType_Gujing(QJsonObject lineObjInfo);//固井结论 + void DisplayTable_One(QJsonObject lineObjInfo); //结论 private: Ui::FormDraw *ui; @@ -185,7 +185,7 @@ public: bool LoadFromSLF_GeoLith(QMyCustomPlot *widget, QString strSlfName, QString strLineName); //井壁取心 - void initSwallCore(QMyCustomPlot *widget, QString strSlfName, QString strLineName); + void initSwallCore(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName = "井壁取心", QColor newlineColor=QColor(0,0,0), QStringList listOtherProperty={}); //固井结论 void initGujing(QMyCustomPlot *widget, QString strSlfName, QString strLineName, QString strAliasName = "固井结论", QColor newlineColor=QColor(0,0,0), QStringList listOtherProperty={}); diff --git a/logPlus/forminfo.cpp b/logPlus/forminfo.cpp index 0e32ca1..cbe583c 100644 --- a/logPlus/forminfo.cpp +++ b/logPlus/forminfo.cpp @@ -141,6 +141,15 @@ QJsonObject FormInfo::makeJson() //item属性写入slf文件,不需要此次记录 return rootObj; } + else if (m_strLineName == "SWALL_CORE") + { + //井壁取心 + rootObj["Type"] = m_strType; + rootObj["curveNameFont"] = m_curveNameFont.toString(); + rootObj["lineColor"] = m_lineColor.name(); + //item属性写入slf文件,不需要此次记录 + return rootObj; + } } rootObj["Unit"] = m_strUnit; @@ -416,7 +425,7 @@ void FormInfo::paintEvent(QPaintEvent* event) else if(m_strLineName=="SWALL_CORE") { //井壁取心,不绘制左右范围 - painter.drawText(rect.left(), rect.top()+rect.height()/3, rect.width(), rect.height()/3 ,Qt::AlignCenter, "井壁取心"); + //painter.drawText(rect.left(), rect.top()+rect.height()/3, rect.width(), rect.height()/3 ,Qt::AlignCenter, "井壁取心"); } else if(m_strLineName == "GUJING1_RESULT" || m_strLineName == "GUJING2_RESULT" || m_strLineName == "GUJING3_RESULT") { diff --git a/logPlus/formtrack.cpp b/logPlus/formtrack.cpp index d909ed6..7a65b5b 100644 --- a/logPlus/formtrack.cpp +++ b/logPlus/formtrack.cpp @@ -533,9 +533,10 @@ void FormTrack::s_AddTableLine(QString strSlfName, QString strWellName, QString formInfo->setVMin(vmin); formInfo->setFrontColor(QColor(0,0,0)); formInfo->setBackColor(QColor(255,255,255)); - if(strLineName == "GUJING1_RESULT" || strLineName == "GUJING2_RESULT" || strLineName == "GUJING3_RESULT") + if(strLineName == "GUJING1_RESULT" || strLineName == "GUJING2_RESULT" || strLineName == "GUJING3_RESULT" + || strLineName == "SWALL_CORE") { - //固井结论 + //固井结论/ 井壁取心 if(listOtherProperty.size()>=3) { QFont curveNameFont("微软雅黑", 10); // 名称字体 diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index d9533ac..655b917 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -2146,6 +2146,11 @@ QStringList MainWindowCurve::getSelectWell_New() QString strSlfName = m_SelectTableItem.m_strSlfName; QString strWellName = m_SelectTableItem.m_strWellName; + if(strSlfName=="" || strWellName=="") + { + QMessageBox::warning(this, "提示", "请先选中待处理井次!"); + return sret; + } sret << strWellName << strSlfName; return sret; } @@ -2500,7 +2505,7 @@ void MainWindowCurve::mousePressEvent(QMouseEvent *event) PropertyService()->initWidgetProperty(m_strUuid, m_iScale); //取消所有选中单元格 - emit CallManage::getInstance()->sig_Raise(m_strUuid, "", "", "", "", 1, ""); + emit CallManage::getInstance()->sig_Raise(m_strUuid, "", "", "", "", 0, ""); } void MainWindowCurve::s_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int iTableType, QString strFormInfoType) @@ -2550,7 +2555,7 @@ void MainWindowCurve::onItemClicked(QTableWidgetItem* item) PropertyService()->initWellProperty(m_strUuid, strSlfName, strWellName, m_iY1, m_iY2); //取消所有选中单元格 - emit CallManage::getInstance()->sig_Raise(m_strUuid, strSlfName, strWellName, "", "", 1, ""); + emit CallManage::getInstance()->sig_Raise(m_strUuid, strSlfName, strWellName, "", "", 0, ""); } diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index c32289f..79567fb 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -121,6 +121,8 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel connect(CallManage::getInstance(), SIGNAL(sig_ReloadPlot(QString, QString, QString)), this, SLOT(s_ReloadPlot(QString, QString, QString))); connect(CallManage::getInstance(), SIGNAL(sig_changeDrawProperty(QVariantList)), this, SLOT(s_changeDrawProperty(QVariantList))); + //改变固井曲线名 + connect(CallManage::getInstance(), SIGNAL(sig_changeGujingLine(QString, QString, QString, QString, QString, QString)), this, SLOT(s_changeGujingLine(QString, QString, QString, QString, QString, QString))); } void QMyCustomPlot::initGeometry(QString strUuid, int nscale, int nW) @@ -1560,37 +1562,7 @@ void QMyCustomPlot::moveItems_SWallCore() //从剪切板文本数据粘贴 void QMyCustomPlot::addItems_SWallCore() -{ - //清空 - liths_SWallCore.clear(); - oils_SWallCore.clear(); - colors_SWallCore.clear(); - colorinds_SWallCore.clear(); - - QString cs=GetConfPath(); - QString color; - for(int j=0;j<4;j++) - { - if(j==0) color=cs+"corecolor.ini"; - else if(j==1) color=cs+"corelith.ini"; - else if(j==2) color=cs+"coreoil.ini"; - else color=cs+"colorind.ini"; - FILE *fp=fopen(color.toStdString().c_str(),"rt"); - QStringList ss; - char buf[100]; - if(fp) { - while(!feof(fp)) { - fscanf(fp,"%s",buf); - ss.append(buf); - } - fclose(fp); - } - if(j==0) colors_SWallCore=ss; - else if(j==1) liths_SWallCore=ss; - else if(j==2) oils_SWallCore=ss; - else colorinds_SWallCore=ss; - } - +{ QClipboard *clipboard = QApplication::clipboard(); //获取系统剪贴板指针 QString originalText = clipboard->text(); //获取剪贴板上文本信息 int isspace=originalText.indexOf(" "); @@ -1770,10 +1742,11 @@ bool QMyCustomPlot::LoadFromSLF_SwallCore(QString strSlfName, QString strLineNam return false; } - QStringList liths; - QStringList oils; - QStringList colors; - QStringList colorinds; + //清空 + liths_SWallCore.clear(); + oils_SWallCore.clear(); + colors_SWallCore.clear(); + colorinds_SWallCore.clear(); QString cs=GetConfPath(); QString color; @@ -1793,10 +1766,10 @@ bool QMyCustomPlot::LoadFromSLF_SwallCore(QString strSlfName, QString strLineNam } fclose(fp); } - if(j==0) colors=ss; - else if(j==1) liths=ss; - else if(j==2) oils=ss; - else colorinds=ss; + if(j==0) colors_SWallCore=ss; + else if(j==1) liths_SWallCore=ss; + else if(j==2) oils_SWallCore=ss; + else colorinds_SWallCore=ss; } // @@ -1817,25 +1790,25 @@ bool QMyCustomPlot::LoadFromSLF_SwallCore(QString strSlfName, QString strLineNam if(m_Result.CoreLith<1) { LithologyImage=""; } - else if (liths.size()>=m_Result.CoreLith) + else if (liths_SWallCore.size()>=m_Result.CoreLith) { - LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths[m_Result.CoreLith-1]+".svg"; + LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".svg"; QDir ss(LithologyImage); if(!ss.exists()) { - LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths[m_Result.CoreLith-1]+".png"; + LithologyImage=::GetSymbolDir()+"/取心岩性符号/"+liths_SWallCore[m_Result.CoreLith-1]+".png"; } } - if (m_Result.CoreOil>0&&oils.size()>=m_Result.CoreOil) + if (m_Result.CoreOil>0&&oils_SWallCore.size()>=m_Result.CoreOil) { - OilGasImage=::GetGasSymbolDir()+""+oils[m_Result.CoreOil-1]+".svg"; + OilGasImage=::GetGasSymbolDir()+""+oils_SWallCore[m_Result.CoreOil-1]+".svg"; } else { OilGasImage=""; } - int ind=colorinds.indexOf(QString::number(m_Result.CoreColor)); - if (ind>-1&&ind-1&&ind