TDT 效果实现, 读取slf文件中的数据, 绘制TDT效果。
This commit is contained in:
parent
dda5d51cfa
commit
22582ee340
|
|
@ -248,6 +248,18 @@ typedef struct tagSlf_CORE
|
|||
char Remark[64];
|
||||
} Slf_CORE;
|
||||
|
||||
typedef struct tagSlf_TDTResult
|
||||
{
|
||||
double m_topDepth = 0.0; //顶深
|
||||
double m_bottomDepth = 0.0;//底深
|
||||
int Order;
|
||||
float depth;
|
||||
float Number;
|
||||
QVector<QString> FieldNames;
|
||||
QVector<QVector<float>> CoreValues;
|
||||
QVector<QVector<float>> ValueTypes;
|
||||
}TDTResultItem;
|
||||
|
||||
typedef struct tagSlf_TDT
|
||||
{
|
||||
char Name[64];
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ FormDraw::FormDraw(QWidget *parent, QString strWellName, QString strTrackName) :
|
|||
connect(CallManage::getInstance(), SIGNAL(sig_AddTubingstring(QString, QString, QString, QString, QString, int)), this, SLOT(s_addTubingstring(QString, QString, QString, QString, QString,int)));
|
||||
|
||||
//TDT
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_AddTDT(QString, QString, QString, QString, QString, int)), this, SLOT(s_addTDT(QString, QString, QString, QString, QString,int)));
|
||||
// connect(CallManage::getInstance(), SIGNAL(sig_AddTDT(QString, QString, QString, QString, QString, int)), this, SLOT(s_addTDT(QString, QString, QString, QString, QString,int)));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -164,6 +164,20 @@ void FormDraw::setDrawData(QStringList listdt)
|
|||
{
|
||||
initDCA(curv);
|
||||
}
|
||||
else if("tdtObject" == strType)
|
||||
{
|
||||
initTDT(curv);
|
||||
|
||||
if(m_iY1 == 0.0)
|
||||
{
|
||||
QTimer::singleShot(200, this, [=]() {
|
||||
m_iY2 = -2000;
|
||||
m_iY1 = -2030;
|
||||
emit CallManage::getInstance()->sig_changeDepth(m_strUuid, m_strSlfName, m_strWellName, m_iY1, m_iY2);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
curv->replot();
|
||||
|
||||
connect(curv, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
|
||||
|
|
@ -1919,9 +1933,9 @@ void FormDraw::s_addTubingstring(QString strUuid, QString strSlfName, QString st
|
|||
}
|
||||
|
||||
//TDT
|
||||
void FormDraw::s_addTDT(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW)
|
||||
{
|
||||
}
|
||||
// void FormDraw::s_addTDT(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW)
|
||||
// {
|
||||
// }
|
||||
|
||||
void FormDraw::initForm(QMyCustomPlot *widget, QString strSlfName, QString strLineName,
|
||||
double newLeftScale, double newRightScale, QString strScaleType, QColor lineColor, double width, Qt::PenStyle lineStyle)
|
||||
|
|
@ -4882,6 +4896,211 @@ float FormDraw::ComputeCurvePos(float flVal, float lsc, float rsc, float lps, fl
|
|||
return x;
|
||||
}
|
||||
|
||||
TDTResultItem* FormDraw::LoadTDTResult_SLF(QString strSlfName)
|
||||
{
|
||||
CMemRdWt *logio=new CMemRdWt();
|
||||
if(!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead))
|
||||
{
|
||||
delete logio;
|
||||
return false;
|
||||
}
|
||||
QStringList slist;
|
||||
slist<<"U1_DOT"<<"U2_DOT"<<"U3_DOT"<<"U4_DOT"<<"U5_DOT"<<"U6_DOT"<<"U7_DOT"
|
||||
<< "D1_DOT"<<"D2_DOT"<<"D3_DOT"<<"D4_DOT"<<"D5_DOT"<<"D6_DOT";
|
||||
|
||||
TDTResultItem* pResult = new TDTResultItem();
|
||||
pResult->FieldNames.resize(slist.size());
|
||||
for(int k=0;k<slist.size();k++)
|
||||
{
|
||||
pResult->FieldNames[k] = slist.at(k);
|
||||
int iIndex=logio->OpenTDT(slist.at(k).toStdString().c_str());
|
||||
if(iIndex>-1) {
|
||||
Slf_TDT Info;
|
||||
logio->GetTDTInfo(iIndex,&Info);
|
||||
logio->IsChange=true;
|
||||
TDT_DATA* pTdt=new TDT_DATA[Info.MaxLogSamples];
|
||||
unsigned int LogTime;
|
||||
int n=0;
|
||||
for(int i=0;i<Info.TotalLogNumber;i++)
|
||||
{
|
||||
// if(k&&i>=m_childrenItems.size()) continue;
|
||||
if(i > 0) continue;
|
||||
n=logio->ReadTDT(iIndex,i+1, &LogTime,pTdt);
|
||||
if(pResult->m_topDepth <= 0.0)
|
||||
{
|
||||
// double top=*(float*)&LogTime;
|
||||
// double bottom=*(float*)&LogTime;
|
||||
pResult->m_topDepth =*(float*)&LogTime;
|
||||
pResult->m_bottomDepth = pResult->m_topDepth;
|
||||
}
|
||||
// TDTResultItem* pResult=dynamic_cast<TDTResultItem*>(k?m_childrenItems[i]:AddItem(top,bottom));
|
||||
if(pResult) {
|
||||
pResult->Order=i;
|
||||
pResult->depth=pTdt[0].Depth;
|
||||
pResult->Number=*(float*)&LogTime;
|
||||
QVector<float> CoreValues;
|
||||
CoreValues.resize(n);
|
||||
for(int j=0;j<n;j++) CoreValues[j]=pTdt[j].Value;
|
||||
pResult->CoreValues.append(CoreValues);
|
||||
QVector<float > ValueTypes;
|
||||
ValueTypes.resize(n);
|
||||
for(int j=0;j<n;j++) ValueTypes[j]=pTdt[j].Time;
|
||||
pResult->ValueTypes.append(ValueTypes);
|
||||
}
|
||||
}
|
||||
logio->CloseTDT(iIndex);
|
||||
delete pTdt;
|
||||
}
|
||||
}
|
||||
|
||||
return pResult;
|
||||
}
|
||||
|
||||
void FormDraw::initTDT(QMyCustomPlot *curv)
|
||||
{
|
||||
TDTResultItem* pResult = this->LoadTDTResult_SLF(curv->m_strSlfName);
|
||||
if(pResult == NULL)
|
||||
return;
|
||||
|
||||
// curv->yAxis->setTickLabels(true);
|
||||
// curv->yAxis->setTickLabelSide(QCPAxis::lsInside);
|
||||
// QFont font1("微软雅黑", 16); //fontSize 10
|
||||
// curv->yAxis->setTickLabelFont(font1);
|
||||
curv->yAxis->setTicks(false);
|
||||
|
||||
curv->m_iX1 = 0;
|
||||
curv->m_iX2 = 400;
|
||||
curv->m_iY1 = m_iY1;
|
||||
curv->m_iY2 = m_iY2;
|
||||
//
|
||||
curv->xAxis->setRange(curv->m_iX1, curv->m_iX2);
|
||||
curv->yAxis->setRange(m_iY1, m_iY2);
|
||||
//
|
||||
// curv->xAxis->ticker()->setTickCount(10);//x个主刻度
|
||||
// curv->yAxis->ticker()->setTickCount(60);//y个主刻度
|
||||
curv->m_bX2Y = false;
|
||||
//对调XY轴,在最前面设置
|
||||
// QCPAxis *yAxis = curv->yAxis;
|
||||
// QCPAxis *xAxis = curv->xAxis;
|
||||
// curv->xAxis = yAxis;
|
||||
// curv->yAxis = xAxis;
|
||||
|
||||
QStringList listColor;
|
||||
listColor << "#0102FB" << "#017F01" << "#F60100" << "#04007F";
|
||||
listColor << "#573370" << "#EF9D12" << "#FC05F9" << "#000000";
|
||||
listColor << "#04FD06" << "#810000" << "#c046ed" << "#028181";
|
||||
listColor << "#bf0707" << "#7D0380" << "#2024db" << "#5eac60";
|
||||
float h=8;//m_pViewInfoTDT->GetrHeight();
|
||||
// h *= g_dPixelPerCm;
|
||||
float m_LeftVal = 0.0f;
|
||||
float m_RightVal = 139.7f;
|
||||
float timemin= 0.0f;
|
||||
float timemax= 0.0f;
|
||||
float fdepth = (pResult->m_topDepth+h)*-1;
|
||||
float fstartX = 40;
|
||||
float fendX = curv->m_iX2 -20;
|
||||
bool bDrawLegend = true;
|
||||
|
||||
if(true/*m_pViewInfoTDT->GetautoTime()*/)
|
||||
{
|
||||
int n=pResult->CoreValues[0].size();
|
||||
timemin=pResult->ValueTypes[0][0];
|
||||
timemax=pResult->ValueTypes[0][n-1];
|
||||
}
|
||||
float dtime=timemax-timemin;
|
||||
|
||||
QPen pen(Qt::gray);
|
||||
int fnum = 5;
|
||||
for(int i=0;i<fnum+1;i++)//时间方向/水平方向 // 垂直线
|
||||
{
|
||||
float fx = fstartX+(fendX-fstartX)/fnum*i;
|
||||
QCPItemLine *line = new QCPItemLine(curv);
|
||||
line->setPen(pen);
|
||||
line->start->setCoords(fx, fdepth+h);//
|
||||
line->end->setCoords(fx, fdepth-0.01);//
|
||||
|
||||
QCPItemText* text = new QCPItemText(curv);
|
||||
// text->setPen(pen);
|
||||
text->position->setCoords(fx, fdepth-0.5);
|
||||
fx = timemin+(timemax-timemin)/fnum*i;
|
||||
text->setText(toString(fx));
|
||||
}
|
||||
for(int i=0;i<fnum+1;i++) // 水平线
|
||||
{
|
||||
float fy = h / 5 * i;
|
||||
QCPItemLine *line = new QCPItemLine(curv);
|
||||
line->setPen(pen);
|
||||
line->start->setCoords(fstartX, fdepth + fy);//
|
||||
line->end->setCoords(fendX, fdepth + fy);//
|
||||
|
||||
QString cs=toString((m_RightVal-m_LeftVal)/fnum*i);
|
||||
QCPItemText* text = new QCPItemText(curv);
|
||||
// text->setPen(pen);
|
||||
text->position->setCoords(22, fdepth+fy);
|
||||
text->setText(cs);
|
||||
}
|
||||
|
||||
int nField = pResult->FieldNames.size();
|
||||
float fcenterX = fstartX+(fendX-fstartX)/2;
|
||||
for(int k=0;k<pResult->CoreValues.size();k++)
|
||||
{
|
||||
int n=pResult->CoreValues[k].size();
|
||||
if(n<1) continue;
|
||||
QVector<double> vecx;
|
||||
QVector<double> vecy;
|
||||
vecx.resize(n);
|
||||
vecy.resize(n);
|
||||
|
||||
int jj=0;
|
||||
QVector<float> valus;
|
||||
valus.resize(n+1);
|
||||
memcpy(&valus[1],&pResult->CoreValues[k][0],sizeof(float)*n);
|
||||
|
||||
for(int j=0;j<n;j++)
|
||||
{
|
||||
if(pResult->ValueTypes[k][j]<timemin) continue;
|
||||
if(pResult->ValueTypes[k][j]>timemax) continue;
|
||||
|
||||
float yval=(valus[j]-m_LeftVal)/(m_RightVal-m_LeftVal)*h;
|
||||
vecx[jj]=fstartX + pResult->ValueTypes[k][j]* (fendX-fstartX)/timemax;//((pResult->ValueTypes[k][j]-timemin)/dtime);
|
||||
if(yval<0) yval=0;
|
||||
if(yval>h) yval=h;
|
||||
vecy[jj++]=(fdepth+yval);// + h-yval);
|
||||
}
|
||||
|
||||
QColor clor(QColor(listColor.at(k%listColor.size())));
|
||||
QCPGraph * graph = curv->graph(k);
|
||||
if(graph == NULL)
|
||||
{
|
||||
graph = curv->addGraph();
|
||||
graph->setPen(QPen(clor));
|
||||
}
|
||||
graph->setData(vecx,vecy);
|
||||
|
||||
if(bDrawLegend)
|
||||
{
|
||||
int c = k / 3;
|
||||
int r = k % 3;
|
||||
QCPItemText* text = new QCPItemText(curv);
|
||||
text->setColor(clor);
|
||||
text->position->setCoords(fcenterX + r*60+10, (fdepth+h-0.5)-c*0.7);
|
||||
text->setText("一 "+pResult->FieldNames.at(k));
|
||||
}
|
||||
}
|
||||
|
||||
QString cs = "时间(μs)";
|
||||
QCPItemText* text = new QCPItemText(curv);
|
||||
text->position->setCoords(fcenterX, fdepth-1.2);
|
||||
text->setText(cs);
|
||||
|
||||
QString unit1 = "米";
|
||||
cs="Depth,"+toString(pResult->depth,'f',1)+unit1;
|
||||
text = new QCPItemText(curv);
|
||||
text->position->setCoords(fcenterX, fdepth-2);
|
||||
text->setText(cs);
|
||||
// curv->replot();
|
||||
}
|
||||
|
||||
//岩心实验数据
|
||||
void FormDraw::initCorePhysics(QMyCustomPlot *widget, QString strSlfName, QString strLineName)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -198,6 +198,9 @@ public:
|
|||
// DCA检测
|
||||
void initDCA(QMyCustomPlot *widget);
|
||||
float ComputeCurvePos(float flVal,float lsc,float rsc,float lps,float rps,int iType,float scale,float flMin=-99999,float flMax=99999);
|
||||
|
||||
TDTResultItem* LoadTDTResult_SLF(QString strSlfName);
|
||||
void initTDT(QMyCustomPlot *widget);
|
||||
signals:
|
||||
//void sig_AddLine(QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
||||
|
||||
|
|
@ -241,7 +244,7 @@ public slots:
|
|||
void s_addTubingstring(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW);
|
||||
|
||||
//TDT
|
||||
void s_addTDT(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW);
|
||||
// void s_addTDT(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW);
|
||||
|
||||
//
|
||||
void s_addWave(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strWaveName);
|
||||
|
|
|
|||
|
|
@ -243,6 +243,10 @@ void FormTrack::setDrawDt(QStringList listdt, float vmax, float vmin)
|
|||
{
|
||||
strAliasName = "裂缝检测";
|
||||
}
|
||||
else if("tdtObject" == strType)
|
||||
{
|
||||
strAliasName = "TDT";
|
||||
}
|
||||
QString strUnit = "";
|
||||
QColor lineColor=QColor(0,0,0);
|
||||
double width=2;
|
||||
|
|
|
|||
|
|
@ -411,6 +411,8 @@ void FormWell::s_NewCol(QStringList listdt)
|
|||
strTrackName = "玫瑰图";
|
||||
else if(strType == "dcaObject")
|
||||
strTrackName = "DCA检测";
|
||||
else if(strType == "tdtObject")
|
||||
strTrackName = "TDT";
|
||||
|
||||
FormTrack *formTrack = NULL;
|
||||
//总行数
|
||||
|
|
|
|||
|
|
@ -1822,12 +1822,20 @@ void MainWindowCurve::s_NewTubingstring()
|
|||
//TDT
|
||||
void MainWindowCurve::s_NewTDT()
|
||||
{
|
||||
QStringList sret = this->getSelectWell();
|
||||
int nW = 400;
|
||||
QStringList sret = this->insertCol(nW);
|
||||
if(sret.length() <= 0)
|
||||
return;
|
||||
|
||||
//新建井+道+曲线(首条)
|
||||
NewWellAndTrack(sret.at(0), sret.at(1), "", "TDTObject");
|
||||
QStringList dt;
|
||||
dt << m_strUuid;
|
||||
dt << sret.at(0);
|
||||
dt << sret.at(1);
|
||||
dt << "";
|
||||
dt << "tdtObject";
|
||||
dt << QString::number(nW);
|
||||
//新建道
|
||||
emit CallManage::getInstance()->sig_NewCol(dt);
|
||||
}
|
||||
|
||||
void MainWindowCurve::s_NewTrackChangeWidth(QString strWellName, int nW)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user