88 lines
2.6 KiB
C++
88 lines
2.6 KiB
C++
#include "ObjTextResult.h"
|
||
#include "MemRdWt.h"
|
||
#include "geometryutils.h"
|
||
|
||
//气测/FMT/射孔/文本
|
||
CObjTextResult::CObjTextResult()
|
||
{
|
||
}
|
||
|
||
|
||
CObjTextResult::~CObjTextResult()
|
||
{
|
||
};
|
||
|
||
bool CObjTextResult::LoadFromSLF(QMyCustomPlot *widget, QString strSlfName, QString csCurve)
|
||
{
|
||
Slf_TxtPOS *m_pResult=NULL;
|
||
CMemRdWt *logio=new CMemRdWt();
|
||
if(strSlfName==""||!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeRead))
|
||
{
|
||
delete logio;
|
||
// QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes);
|
||
return false;
|
||
}
|
||
|
||
int iIndex=logio->OpenTable(csCurve.toStdString().c_str());
|
||
if(iIndex>-1) {
|
||
int count = logio->GetTableRecordCount(iIndex);
|
||
int fieldnum = logio->GetTableFieldCount(iIndex);
|
||
int len = logio->GetTableRecordLength(iIndex);
|
||
Slf_TABLE_FIELD *pField=new Slf_TABLE_FIELD[fieldnum+1];
|
||
logio->GetTableFieldInfo(iIndex,pField);
|
||
|
||
m_FieldNameList.clear();
|
||
m_FieldUnitList.clear();
|
||
m_FieldHZNameList.clear();
|
||
m_FieldHZUnitList.clear();
|
||
//
|
||
for(int i=0;i<fieldnum;i++)
|
||
{
|
||
m_FieldNameList.push_back(QString::fromLocal8Bit(pField[i].Name));
|
||
m_FieldHZNameList.push_back(QString::fromLocal8Bit(pField[i].HZName));
|
||
m_FieldUnitList.push_back(QString::fromLocal8Bit(pField[i].Unit));
|
||
m_FieldHZUnitList.push_back(QString::fromLocal8Bit(pField[i].HZUnit));
|
||
}
|
||
delete pField;
|
||
|
||
//
|
||
m_pResult=(Slf_TxtPOS *)new char[len+1];
|
||
char buf[200];
|
||
for(int i=0;i<count;i++) {
|
||
logio->GetTableFieldData(iIndex,0,buf,i+1);
|
||
m_pResult->Order=atof(buf);
|
||
logio->GetTableFieldData(iIndex,1,buf,i+1);
|
||
m_pResult->Depth=atof(buf);
|
||
logio->GetTableFieldData(iIndex,2,buf,i+1);
|
||
m_pResult->CorrDepth=atof(buf);
|
||
double top=m_pResult->Depth;
|
||
double bottom=m_pResult->Depth;
|
||
if(m_FieldNameList.size()>2&&
|
||
(m_FieldNameList[2].indexOf("EDEP")>-1 ||
|
||
m_FieldNameList[2].indexOf("ENDEP")>-1)
|
||
)
|
||
{
|
||
bottom=m_pResult->CorrDepth;
|
||
}
|
||
|
||
CoreValues.clear();
|
||
ValueTypes.clear();
|
||
for(int j=0;j<fieldnum;j++)
|
||
{
|
||
int iType = logio->GetTableFieldData(iIndex,j,buf,i+1);
|
||
ValueTypes.append(iType);
|
||
float val=0;
|
||
val=atof(buf);
|
||
CoreValues.append(QString::number(val));
|
||
}
|
||
|
||
//
|
||
widget->addJiegutextToPlot(-bottom, -top, CoreValues, iMaxNum);
|
||
}
|
||
logio->CloseTable(iIndex);
|
||
delete m_pResult;
|
||
}
|
||
delete logio;
|
||
return true;
|
||
}
|