diff --git a/ModuleConsole/src/ParameterEditorModel.cpp b/ModuleConsole/src/ParameterEditorModel.cpp index 728a45b..1a8ed83 100644 --- a/ModuleConsole/src/ParameterEditorModel.cpp +++ b/ModuleConsole/src/ParameterEditorModel.cpp @@ -894,7 +894,7 @@ void ParameterEditorModel::ChangeMXParam(float depth,float minX,float maxX,QStri } if(no<0||no>9) { if(paramName=="SHFG") continue; -// AfxMessageBox("SHFG无对应曲线或对应曲线不唯一!,无法设置极值!\n您可采用选中待改字段,在曲线窗口用CCTRL+鼠标左击进行修正!"); +// QMessageBox::information(NULL,"提示","SHFG无对应曲线或对应曲线不唯一!,无法设置极值!\n您可采用选中待改字段,在曲线窗口用CCTRL+鼠标左击进行修正!"); } //else { @@ -973,7 +973,7 @@ void ParameterEditorModel::AddDepth(float sdep,QString ID) CCompositeParameterItem* Zones=pArrayItem; int count=Zones->GetChildCount(); if(count<1) { - AfxMessageBox("初始参数缺失,不能生成层段!"); + QMessageBox::information(NULL,"提示","初始参数缺失,不能生成层段!"); return; } for(int i=0;iGetStringValue().c_str(); float val1=val.toFloat(); if(sdep==val1) { - AfxMessageBox("当前深度段已存在!"); + QMessageBox::information(NULL,"提示","当前深度段已存在!"); return; } sdeps.push_back(val1); val=pItem2->GetStringValue().c_str(); val1=val.toFloat(); if(sdep==val1) { - AfxMessageBox("当前深度段已存在!"); + QMessageBox::information(NULL,"提示","当前深度段已存在!"); return; } edeps.push_back(val1); @@ -1220,7 +1220,7 @@ void ParameterEditorModel::DeleteDepth(float sdep,QString ID) CCompositeParameterItem* Zones=pArrayItem; int count=Zones->GetChildCount(); if(count<2) { - AfxMessageBox("当前层段数小于2段,不可以删除!"); + QMessageBox::information(NULL,"提示","当前层段数小于2段,不可以删除!"); return; } for(int i=0;iGetChildCount()<2) { - AfxMessageBox("层段数为1,不可以删除!"); + QMessageBox::information(NULL,"提示","层段数为1,不可以删除!"); return; } ParameterProperty *pP1=ParameterPropertyFromIndex(m_currentindex); diff --git a/WellLogModule/src/PELibraryModule.cpp b/WellLogModule/src/PELibraryModule.cpp index 6e6418e..e4c0c2a 100644 --- a/WellLogModule/src/PELibraryModule.cpp +++ b/WellLogModule/src/PELibraryModule.cpp @@ -16,6 +16,8 @@ #include "ParameterItem.h" #include #include +#include + // void OSGFRAMEWORK_EXPORT AppendConsole(pai::log::Priority priority,const QString &output); using namespace pai::module; @@ -134,7 +136,7 @@ float PELibraryModule::GetFloatParam(CModuleParameter * pModulePara,QString &par QStringList strlst=str1.split("/"); int no=strlst.indexOf(val); if(no<0) { - AfxMessageBox("设计错误:选择项"+val+"不存在!"); + QMessageBox::information(NULL,"提示","设计错误:选择项"+val+"不存在!"); no=0; } str=QString::number(no); @@ -147,7 +149,7 @@ float PELibraryModule::GetFloatParam(CModuleParameter * pModulePara,QString &par int no=strlst.indexOf(val); if(no<0) { str=val; -// AfxMessageBox("设计错误:选择项"+val+"不存在!"); +// QMessageBox::information(NULL,"提示","设计错误:选择项"+val+"不存在!"); no=0; } else str=QString::number(no); @@ -170,7 +172,7 @@ float PELibraryModule::GetFloatParam(CModuleParameter * pModulePara,QString &par QString name=paramName; int i=paramName.lastIndexOf("."); if(i>-1) name=paramName.mid(i+1); -// AfxMessageBox("参数"+name+"不存在!"); +// QMessageBox::information(NULL,"提示","参数"+name+"不存在!"); str="0"; return 0.0; } @@ -312,7 +314,7 @@ bool PELibraryModule::LoadParamFromLines(QStringList lines) } if(!flag) { - AfxMessageBox("错误,参数卡为空或无效值!\n请修改参数卡保存后,执行刷新参数或重新打开处理模块!"); + QMessageBox::information(NULL,"提示","错误,参数卡为空或无效值!\n请修改参数卡保存后,执行刷新参数或重新打开处理模块!"); } return true; } @@ -751,7 +753,7 @@ bool PELibraryModule::InitProcessMessage(struct INC_STRU *Inc,struct OUTC_STRU QString anames=incnames.join(","); QString errorMsg=QString::fromStdString(GetMetaData()->GetName())+m_libraryfilename+"_"+strDLLFun+":模块编写不正常,其输入曲线定义与数目不匹配:"+"\n"; errorMsg=errorMsg+"输入曲线名为:"+ anames +"\n" +"输入曲线数目为:"+QString::number(Inc->Noi); - AfxMessageBox(errorMsg); + QMessageBox::information(NULL,"提示",errorMsg); // AppendConsole(pai::log::PAI_WARN,errorMsg); return false; } @@ -779,7 +781,7 @@ bool PELibraryModule::InitProcessMessage(struct INC_STRU *Inc,struct OUTC_STRU QString errorMsg=QString::fromStdString(GetMetaData()->GetName())+m_libraryfilename+"_"+strDLLFun+":模块编写异常,其输出曲线定义与数目不匹配:"+"\n"; errorMsg=errorMsg+"输出曲线名为:"+ anames +"\n" +"输出曲线数为:"+QString::number(Outc->Noo); // AppendConsole(pai::log::PAI_WARN,errorMsg); - AfxMessageBox(errorMsg); + QMessageBox::information(NULL,"提示",errorMsg); return false; } if(Outc){ @@ -977,7 +979,7 @@ UINT PELibraryModule::ProcessDLL1(LPVOID pPram,float sdep,float edep)//只用公 lpfnDllFunc = (LPFNDLLFUNC)(Methodlib.resolve(strDLLFun.toStdString().c_str()));//strDLLFun.toStdString().c_str()) if(!lpfnDllFunc) { - AfxMessageBox("处理函数"+strDLLFun+"不存在,请检查配置文件!"); + QMessageBox::information(NULL,"提示","处理函数"+strDLLFun+"不存在,请检查配置文件!"); m_pMemRdWt->Close(); return 0; //入口函数不存在 @@ -986,7 +988,7 @@ UINT PELibraryModule::ProcessDLL1(LPVOID pPram,float sdep,float edep)//只用公 m_pMemRdWt->ZoneSdep=sdep; m_pMemRdWt->ZoneEdep=edep; if(m_pMemRdWt->Const()<0) { - AfxMessageBox("参数卡有误,运行被停止!"); + QMessageBox::information(NULL,"提示","参数卡有误,运行被停止!"); m_pMemRdWt->Close(); return 0; } @@ -994,7 +996,7 @@ UINT PELibraryModule::ProcessDLL1(LPVOID pPram,float sdep,float edep)//只用公 if(errorinf) { if(errorinf->ErrorNo<0) { - AfxMessageBox(errorinf->ErrorStr); + QMessageBox::information(NULL,"提示",errorinf->ErrorStr); m_pMemRdWt->Close(); return 0; } @@ -1012,7 +1014,7 @@ UINT PELibraryModule::ProcessDLL1(LPVOID pPram,float sdep,float edep)//只用公 //mDP.CreatProgress(Hd->Stdep,Hd->Endep); DepthProgress DepthProgress; DepthProgress.CreatProgress(Hd->Stdep,Hd->Endep,"数据处理中...."); - CString cs; + QString cs; int flag=1; while ( 1 ) { @@ -1023,7 +1025,8 @@ UINT PELibraryModule::ProcessDLL1(LPVOID pPram,float sdep,float edep)//只用公 { if ( errorinf->ErrorNo <=0 ) { - cs.Format("提示 : %s ",errorinf->ErrorStr); + cs = QString("提示 : %s ").arg(errorinf->ErrorStr); +// cs.Format("提示 : %s ",errorinf->ErrorStr); if(i<0)flag=i; else flag=errorinf->ErrorNo; break; @@ -1067,7 +1070,7 @@ UINT PELibraryModule::ProcessDLL1(LPVOID pPram,float sdep,float edep)//只用公 if(flag>=0) { cs="处理完毕!"; } - else AfxMessageBox(cs); + else QMessageBox::information(NULL,"提示",cs); return flag; } UINT PELibraryModule::ProcessDLL2(LPVOID pPram,float sdep,float edep)//自控模块(DLL) @@ -1077,7 +1080,7 @@ UINT PELibraryModule::ProcessDLL2(LPVOID pPram,float sdep,float edep)//自控模 lpfnDllFunc = (LPFNDLLFUNC)(Methodlib.resolve(strDLLFun.toStdString().c_str()));//strDLLFun.toStdString().c_str()) if(!lpfnDllFunc) { - AfxMessageBox("处理函数"+strDLLFun+"不存在,请检查配置文件!"); + QMessageBox::information(NULL,"提示","处理函数"+strDLLFun+"不存在,请检查配置文件!"); //入口函数不存在 m_pMemRdWt->Close(); return 0; @@ -1094,7 +1097,7 @@ UINT PELibraryModule::ProcessDLL2(LPVOID pPram,float sdep,float edep)//自控模 m_pMemRdWt->ZoneSdep=sdep; m_pMemRdWt->ZoneEdep=edep; if(m_pMemRdWt->Const()<0) { - AfxMessageBox("参数卡有误,运行被停止!"); + QMessageBox::information(NULL,"提示","参数卡有误,运行被停止!"); m_pMemRdWt->Close(); return 0; } @@ -1102,12 +1105,13 @@ UINT PELibraryModule::ProcessDLL2(LPVOID pPram,float sdep,float edep)//自控模 if(edep!=-99999) Hd->EndDep=edep; int i = lpfnDllFunc(); - CString cs; + QString cs; if ( i < 0||(errorinf&&errorinf->ErrorNo<0) ) //运算出错 { if ( errorinf&&errorinf->ErrorNo <=0 ) { - cs.Format("提示 : %s ",errorinf->ErrorStr); + cs = QString("提示 : %s ").arg(errorinf->ErrorStr); +// cs.Format("提示 : %s ",errorinf->ErrorStr); if(i<0)flag=i; else flag=errorinf->ErrorNo; } @@ -1141,7 +1145,7 @@ UINT PELibraryModule::ProcessDLL2(LPVOID pPram,float sdep,float edep)//自控模 // } if(flag>=0) { } - else AfxMessageBox(cs); + else QMessageBox::information(NULL,"提示",cs); return flag; } @@ -1317,7 +1321,7 @@ bool PELibraryModule::InitModule(QWidget*pWidget) m_pMemRdWt=NULL; if(strlen(errorinf->ErrorStr)) { - AfxMessageBox(errorinf->ErrorStr); + QMessageBox::information(NULL,"提示",errorinf->ErrorStr); } Methodlib.unload(); iscreatemem=0; @@ -1383,7 +1387,7 @@ bool PELibraryModule::InitModule(QWidget*pWidget) // 如果dll中的输出曲线条数和名称数对不上则退出 // 如果dll中的参数个数和名称数对不上则退出 if(!Conc) { - // AfxMessageBox("处理模块缺少参数名结构CONC_STRCT!"); + // QMessageBox::information(NULL,"提示","处理模块缺少参数名结构CONC_STRCT!"); if(parDialog) { parDialog->setParent(NULL); @@ -1856,7 +1860,7 @@ QString PELibraryModule::GetINPParamCard(CMemRdWt *pMemrdWt,char *p,bool isSave } strcpy(tempcon.stryy,stryy.toStdString().c_str()); } - else AfxMessageBox("内部错误:井段"+QString(strPartIndex.c_str())); + else QMessageBox::information(NULL,"提示","内部错误:井段"+QString(strPartIndex.c_str())); } if(toTable){ char strTmp[5] = "EDEP"; @@ -1868,7 +1872,7 @@ QString PELibraryModule::GetINPParamCard(CMemRdWt *pMemrdWt,char *p,bool isSave if(zoneCount<1) { result="0 0\r\n"; - if(Conc->Noc>0) AfxMessageBox("可视化参数为空!"); + if(Conc->Noc>0) QMessageBox::information(NULL,"提示","可视化参数为空!"); } result=result+"END\r\n"; if(isSaveToEdit&&pEdit) { @@ -2014,7 +2018,7 @@ bool PELibraryModule::GetPARAM_TAB() } if(!m_pMemRdWt->Open(GetSlfFileName().toStdString().c_str())) { - //AfxMessageBox("您还没有选择井文件或井文件不存在!在您运行之前,请选择井文件!"); + //QMessageBox::information(NULL,"提示","您还没有选择井文件或井文件不存在!在您运行之前,请选择井文件!"); return false; } QString parmacard=GetINPParamCard(NULL,NULL,false); @@ -2031,7 +2035,7 @@ bool PELibraryModule::InitMemRdWt(double sdep,double edep,char*Zone,bool isSaveC } if(!m_pMemRdWt->Open(GetSlfFileName().toStdString().c_str())) { - //AfxMessageBox("您还没有选择井文件或井文件不存在!在您运行之前,请选择井文件!"); + //QMessageBox::information(NULL,"提示","您还没有选择井文件或井文件不存在!在您运行之前,请选择井文件!"); return false; } @@ -2118,7 +2122,7 @@ QString PELibraryModule::ReadParamCardFromSLF(CMemRdWt *pMemRdWt,char *pParamNam QFile file( paramSettingFileName ); if(!file.exists()) { -// AfxMessageBox(paramSettingFileName+"常用参数配置文件不存在!"); +// QMessageBox::information(NULL,"提示",paramSettingFileName+"常用参数配置文件不存在!"); } if (file.exists()&& file.open( QIODevice::ReadOnly ) ) { QTextStream stream( &file ); diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 8a307d2..2cdcb65 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -179,6 +179,7 @@ void FormDraw::setDrawData(QStringList listdt, QJsonObject objInfo) } else { + curv->m_bX2Y = false; //curv->initWave2(m_strSlfName, strLineName); curv->changePropertyWaveUpdate(); } @@ -3005,6 +3006,7 @@ void FormDraw::s_addWave(QString strUuid, QString strSlfName, QString strWellNam //绑定m_formTrack,方便关联formInfo curv->m_formTrack = m_formTrack; curv->m_strUuid = m_strUuid; + curv->m_bX2Y = false; //背景设置成透明色 curv->setBackground(Qt::transparent); curv->setStyleSheet("background: transparent;"); @@ -4868,19 +4870,22 @@ void FormDraw::initWave_3D(QMyCustomPlot *widget, QString strSlfName, QString st widget->m_iY1 = m_iY1; widget->m_iY2 = m_iY2; // - widget->xAxis->setRange(vmin, vmax); - widget->yAxis->setRange(m_iY1, m_iY2); - widget->axisRect()->setupFullAxesBox(); - // - widget->xAxis->ticker()->setTickCount(10);//x个主刻度 - widget->yAxis->ticker()->setTickCount(60);//y个主刻度 - - //对调XY轴,在最前面设置 - QCPAxis *yAxis = widget->yAxis; - QCPAxis *xAxis = widget->xAxis; - widget->xAxis = yAxis; - widget->yAxis = xAxis; + if (!widget->m_bX2Y) + { + widget->xAxis->setRange(vmin, vmax); + widget->yAxis->setRange(m_iY1, m_iY2); + widget->axisRect()->setupFullAxesBox(); + // + widget->xAxis->ticker()->setTickCount(10);//x个主刻度 + widget->yAxis->ticker()->setTickCount(60);//y个主刻度 + //对调XY轴,在最前面设置 + QCPAxis *yAxis = widget->yAxis; + QCPAxis *xAxis = widget->xAxis; + widget->xAxis = yAxis; + widget->yAxis = xAxis; + widget->m_bX2Y = true; + } // // 横向点数,全部绘制 int nPoint = _nSamples; @@ -5666,14 +5671,14 @@ void FormDraw::initResult(QMyCustomPlot *widget, QString strSlfName, QString str m_LeftVal = 0; m_RightVal = 90; //隐藏刻度 - widget->xAxis->setTicks(true); - widget->yAxis->setTicks(true); - widget->xAxis2->setTicks(true); - widget->yAxis2->setTicks(true); - widget->xAxis->setTickLabels(true); - widget->yAxis->setTickLabels(true); - widget->xAxis2->setTickLabels(true); - widget->xAxis2->setTickLabels(true); + widget->xAxis->setTicks(false); + widget->yAxis->setTicks(false); + widget->xAxis2->setTicks(false); + widget->yAxis2->setTicks(false); + widget->xAxis->setTickLabels(false); + widget->yAxis->setTickLabels(false); + widget->xAxis2->setTickLabels(false); + widget->xAxis2->setTickLabels(false); // LoadFromSLF_Result(widget, strSlfName, strLineName); @@ -5947,6 +5952,7 @@ void FormDraw::initDepth(QMyCustomPlot *curv) curv->xAxis->setSubTicks(false); curv->xAxis->setTickLabels(false); + curv->yAxis->setTicks(true); curv->yAxis->setTickLabels(true); curv->yAxis->setTickLabelSide(QCPAxis::lsInside); QFont font1("微软雅黑", 8); diff --git a/logPlus/forminfo.h b/logPlus/forminfo.h index c594e5d..d50c2ba 100644 --- a/logPlus/forminfo.h +++ b/logPlus/forminfo.h @@ -146,7 +146,7 @@ public: bool m_bShowScale; // 显示刻度 float m_fWaveBase = 0.0f; // 波列基值 - int m_nWaveJg = 100; // 波形间隔 + int m_nWaveJg = 10; // 波形间隔 float m_fWaveHei = 1; // 波形高度 int m_nColorNum = 256; // 调色板参数设置-变密度颜色级数 diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index abf537c..437a54f 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -65,9 +65,14 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel yAxis->setTickLabels(false); } // - xAxis->setTickLabels(false); - xAxis2->setTickLabels(false); - yAxis2->setTickLabels(false); + xAxis->setTicks(false); + yAxis->setTicks(false); + xAxis2->setTicks(false); + yAxis2->setTicks(false); + xAxis->setTickLabels(false); + yAxis->setTickLabels(false); + xAxis2->setTickLabels(false); + xAxis2->setTickLabels(false); //套管组件 zoneOrder_Tubing.clear(); @@ -212,11 +217,13 @@ void QMyCustomPlot::changePropertyWaveUpdate() else if (m_nDrawType == 2) { if (this->m_colorMap) + { this->m_colorMap->setVisible(true); + this->m_colorMap->data()->clear(); + } clearGraphs(); clearItems(); - this->m_bX2Y = true; this->initWave(m_strSlfName, m_strLineName); } } @@ -238,12 +245,15 @@ void QMyCustomPlot::initWave(QString strSlfName, QString strWaveName) float _SDep, _EDep, _Rlev; _SDep = _wave.StartDepth; _EDep = _wave.EndDepth; + m_SDep = _SDep; + m_EDep = _EDep; // _SDep = 0.0 - m_iY2; // _EDep = 0.0 - m_iY1; _Rlev = _wave.DepLevel; int m_Record = (float)(fabs((_EDep - _SDep) / _Rlev + 0.5)); int _nSamples = _wave.TimeSamples; + m_nSamples = _nSamples; if (m_fScaleV <= 0.0f) m_fScaleV = _nSamples; char *value = new char[(_nSamples + 1)*m_Record*_wave.CodeLen + 1]; @@ -263,7 +273,26 @@ void QMyCustomPlot::initWave(QString strSlfName, QString strWaveName) m_nWaveJg = 10; float m_r = _Rlev * m_nWaveJg; float m_MoveDep = 0.0f; - QVector< QVector > vecWave; + + float yscale = 1; + if (m_nWaveHei > 1) + { + float DifBase = 1; + if (m_nDrawType == 2 || m_nDrawType == 6 || m_nDrawType == 10) { + DifBase = (m_MaxRange - m_Base) / m_nColorNum; + } + else { + DifBase = (m_MaxRange - m_Base) / 1; + } + if (fabs(DifBase) <= 1e-6) DifBase = 1; + + yscale = m_nWaveHei + DifBase; + yscale = yscale / DifBase; + } + + + //QVector< QVector > vecWave; + m_vecWaveData.clear(); for (float dep1 = detp - 10 * m_r; dep1 < edepc + m_MoveDep + 10 * m_r; dep1 += m_r) { int iIndex = Slf_Int(dep1 + m_MoveDep, _SDep, _Rlev); @@ -278,7 +307,8 @@ void QMyCustomPlot::initWave(QString strSlfName, QString strWaveName) for (int kk = 0; kk < _nSamples; kk++) { double val = GetData(_wave.RepCode, (char *)&value[iIndex * _nSamples*_wave.CodeLen + kk * _wave.CodeLen]); - ve[kk] = val; + //ve[kk] = val; + ve[kk] = (int)((val - m_Base)*yscale); if (val == -9999) { continue; @@ -294,7 +324,7 @@ void QMyCustomPlot::initWave(QString strSlfName, QString strWaveName) if (vmax < val)vmax = val; if (vmin > val)vmin = val; } - vecWave << ve; + m_vecWaveData << ve; } #else @@ -330,24 +360,31 @@ void QMyCustomPlot::initWave(QString strSlfName, QString strWaveName) widget->m_iY1 = m_iY1; widget->m_iY2 = m_iY2; // - widget->xAxis->setRange(vmin, vmax); - widget->yAxis->setRange(m_iY1, m_iY2); - widget->axisRect()->setupFullAxesBox(); - // - widget->xAxis->ticker()->setTickCount(10);//x个主刻度 - widget->yAxis->ticker()->setTickCount(60);//y个主刻度 + if (!widget->m_bX2Y) + { + widget->xAxis->setRange(vmin, vmax); + widget->yAxis->setRange(m_iY1, m_iY2); + widget->axisRect()->setupFullAxesBox(); + // + widget->xAxis->ticker()->setTickCount(10);//x个主刻度 + widget->yAxis->ticker()->setTickCount(60);//y个主刻度 - widget->xAxis->setTicks(false); - widget->yAxis->setTicks(false); - widget->xAxis2->setTicks(false); - widget->yAxis2->setTicks(false); - - //对调XY轴,在最前面设置 - QCPAxis *yAxis = widget->yAxis; - QCPAxis *xAxis = widget->xAxis; - widget->xAxis = yAxis; - widget->yAxis = xAxis; + widget->xAxis->setTicks(false); + widget->yAxis->setTicks(false); + widget->xAxis2->setTicks(false); + widget->yAxis2->setTicks(false); + widget->xAxis->setTickLabels(false); + widget->yAxis->setTickLabels(false); + widget->xAxis2->setTickLabels(false); + widget->xAxis2->setTickLabels(false); + //对调XY轴,在最前面设置 + QCPAxis *yAxis = widget->yAxis; + QCPAxis *xAxis = widget->xAxis; + widget->xAxis = yAxis; + widget->yAxis = xAxis; + widget->m_bX2Y = true; + } widget->m_fmin = vmin; widget->m_fmax = vmax * f; @@ -358,53 +395,8 @@ void QMyCustomPlot::initWave(QString strSlfName, QString strWaveName) QCPColorMap *colorMap = new QCPColorMap(widget->xAxis, widget->yAxis); widget->m_colorMap = colorMap; - int nx = m_Record; - int ny = _nSamples; -#ifdef W_NEW - nx = vecWave.size(); -#endif - colorMap->data()->setSize(nx, ny); // 我们希望彩色地图有nx*ny的数据点 - //colorMap->data()->setRange(QCPRange(m_iY1, m_iY2), QCPRange(vmin, vmax)); // 并在键(x)和值(y)维上跨越坐标范围-4..4 - colorMap->data()->setRange(QCPRange(0 - _EDep, 0 - _SDep), QCPRange(vmin, widget->m_fmax)); -#ifdef W_NEW - double x, y, z; - for (int xIndex = 0; xIndex < nx; ++xIndex) - { - for (int yIndex = 0; yIndex < ny; ++yIndex) - { - double dz = vecWave[xIndex][yIndex]; - if (m_nMode == 0) - { - if (dz == -9999) - { - dz = m_fmax; - } - } - else if (m_nMode == 1) - { - if (dz == -9999) - { - dz = m_fmin; - } - } - else if (m_nMode == 2) - { - if (dz == -9999) - { - dz = m_fmax; - } - else - { - dz = m_fmin; - } - } - m_colorMap->data()->setCell(nx - xIndex - 1, yIndex, dz); - } - } -#else // :现在,我们通过访问颜色贴图的QCPColorMapData实例来分配一些数据: this->updateWave(); -#endif // W_NEW // 添加色标: QCPColorScale *colorScale = new QCPColorScale(widget); @@ -441,11 +433,6 @@ void QMyCustomPlot::initWave2(QString strSlfName, QString strWaveName) widget->xAxis->setRange(vmin, vmax); widget->yAxis->setRange(m_iY1, m_iY2); widget->axisRect()->setupFullAxesBox(); - // - widget->xAxis->setTicks(false); - widget->yAxis->setTicks(false); - widget->xAxis2->setTicks(false); - widget->yAxis2->setTicks(false); //注意,不对调XY轴 widget->m_bX2Y = false; @@ -664,33 +651,34 @@ double** QMyCustomPlot::getWavedata(int nrow, int ncol) QCPColorMap * QMyCustomPlot::updateWave() { - int nx = m_nCol; - int ny = m_nRow; + int nx = m_vecWaveData.size(); + int ny = m_nSamples; + + m_colorMap->data()->setSize(nx, ny); // 我们希望彩色地图有nx*ny的数据点 + m_colorMap->data()->setRange(QCPRange(0 - m_EDep, 0 - m_SDep), QCPRange(this->m_fmin, this->m_fmax)); - // :现在,我们通过访问颜色贴图的QCPColorMapData实例来分配一些数据: - double x, y, z; for (int xIndex = 0; xIndex < nx; ++xIndex) { for (int yIndex = 0; yIndex < ny; ++yIndex) { - double dz = m_wavedata[yIndex][xIndex]; + double dz = m_vecWaveData[xIndex][yIndex]; if (m_nMode == 0) { - if (m_wavedata[yIndex][xIndex] == -9999) + if (dz == -9999) { dz = m_fmax; } } else if (m_nMode == 1) { - if (m_wavedata[yIndex][xIndex] == -9999) + if (dz == -9999) { dz = m_fmin; } } else if (m_nMode == 2) { - if (m_wavedata[yIndex][xIndex] == -9999) + if (dz == -9999) { dz = m_fmax; } @@ -702,6 +690,44 @@ QCPColorMap * QMyCustomPlot::updateWave() m_colorMap->data()->setCell(nx - xIndex - 1, yIndex, dz); } } + //int nx = m_nCol; + //int ny = m_nRow; + + //// :现在,我们通过访问颜色贴图的QCPColorMapData实例来分配一些数据: + //double x, y, z; + //for (int xIndex = 0; xIndex < nx; ++xIndex) + //{ + // for (int yIndex = 0; yIndex < ny; ++yIndex) + // { + // double dz = m_wavedata[yIndex][xIndex]; + // if (m_nMode == 0) + // { + // if (m_wavedata[yIndex][xIndex] == -9999) + // { + // dz = m_fmax; + // } + // } + // else if (m_nMode == 1) + // { + // if (m_wavedata[yIndex][xIndex] == -9999) + // { + // dz = m_fmin; + // } + // } + // else if (m_nMode == 2) + // { + // if (m_wavedata[yIndex][xIndex] == -9999) + // { + // dz = m_fmax; + // } + // else + // { + // dz = m_fmin; + // } + // } + // m_colorMap->data()->setCell(nx - xIndex - 1, yIndex, dz); + // } + //} return m_colorMap; } diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index 69ef4c6..98b10b7 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -153,6 +153,7 @@ public: QCPColorMap *m_colorMap = NULL; QCPColorScale * m_colorScale = NULL; double** m_wavedata = NULL; + QVector< QVector > m_vecWaveData; int m_nRow = 0; int m_nCol = 0; int m_nDrawType = 2; // 绘图类型 @@ -636,6 +637,7 @@ public: QString m_qsWellName,m_qsTable; QString m_qsDepth,m_qsDIP,m_qsDIR,m_qsID,m_qsProperty; // 控制曲线 float m_SDep,m_EDep,m_Rlev; + int m_nSamples = 0; // csCurveGrad曲线名 LeftVal3最小值 RightVal3最大值 nArc扇形 nR圆半径 crArc圆颜色 nArcLineWidth圆线宽度 bFill是否填充 void fgrqDraw(QString csCurveGrad, double LeftVal3, double RightVal3, int nArc, double nR, QColor crArc, int nArcLineWidth, bool bFill, QColor crFill, int lineNumber, double lineHeight, int lineThickness, QColor lineColor, bool drawAnnotation, bool drawHistogram,