logplus/logPlus/ObjGeostratums.cpp

69 lines
1.6 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <cassert>
#include "ObjGeostratums.h"
#include "LogIO.h";
#include <QTextStream>
#include <QApplication>
#include <QDir>
CObjGeostratums::CObjGeostratums()
{
}
CObjGeostratums::~CObjGeostratums()
{
}
bool CObjGeostratums::LoadFromSLF(QMyCustomPlot *widget, QString strSlfName, QString csCurve)
{
LAYER_DATA m_Result;
if(strSlfName=="") return false;
CLogIO *logio=new CLogIO();
if(!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 <0) {
iIndex=logio->OpenTable("LAYER_DATA");
}
if (iIndex >=0)
{
int count=logio->GetTableRecordCount(iIndex);
int ColorNum=6;
if(ColorNum<1) ColorNum=1;
QList<QRgb> rgbList;
rgbList.append(QRgb(4294967295));
rgbList.append(QRgb(4294966617));
rgbList.append(QRgb(4294944512));
rgbList.append(QRgb(4293345792));
rgbList.append(QRgb(4288741473));
rgbList.append(QRgb(4278190080));
for(int j=0;j<count;j++) {
memset(&m_Result,0,sizeof(LAYER_DATA));
logio->ReadTable(iIndex,j+1,&m_Result);
float sdep=m_Result.StartDepth;
float edep=m_Result.EndDepth;
//
char buf[490];
buf[0]=0;
::GetDescription(m_Result,buf);
QColor bkColor = rgbList.at(j%ColorNum);
//显示文本
widget->addTextToPlot(-edep, -sdep, QString::fromLocal8Bit(buf), bkColor);
}
logio->CloseTable(iIndex);
}
delete logio;
return true;
}