logplus/WellLogUI/src/MyWelllogRound.cpp
2025-10-29 17:23:30 +08:00

662 lines
16 KiB
C++
Raw 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 "MemRdWt.h"
#include "geometryutils.h"
#include <QSettings>
#include <QTextCodec>
#include <QTime>
#include "MyWelllogRound.h"
#pragma warning( pop )
std::string MyWelllogRound::GetAudit() const
{
return filemessage.audit;
}
std::string MyWelllogRound::GetName() const
{
return m_name;
}
std::string MyWelllogRound::GetWellName() const
{
return filemessage.WellName;
}
std::string MyWelllogRound::GetCompanyName() const
{
return filemessage.LogCompanyName;
}
std::string MyWelllogRound::GetOilCompanyName() const
{
return filemessage.OilCompanyName;
}
std::string MyWelllogRound::GetDate() const
{
time_t td=filemessage.LoggingDate;
QString cs=::GetDate(td);
return cs.toStdString();
}
float MyWelllogRound::GetDensity() const
{
return filemessage.Mud_Density[0];
}
std::string MyWelllogRound::GetINTLog() const
{
return filemessage.IntDepths;
}
std::string MyWelllogRound::GetIntProg() const
{
return filemessage.Prog;
}
std::string MyWelllogRound::GetInteDress() const
{
return filemessage.Intor;
}
std::string MyWelllogRound::GetItem() const
{
return filemessage.Item;
}
std::string MyWelllogRound::GetMudType() const
{
return filemessage.Mud_Property;
}
float MyWelllogRound::GetMudViscosity() const
{
return filemessage.Mud_Viscosity[0];
}
std::string MyWelllogRound::GetNITINT() const
{
return filemessage.IntDepths;
}
std::string MyWelllogRound::GetOperator() const
{
return filemessage.Operator;
}
std::string MyWelllogRound::GetRemark() const
{
return filemessage.Reserved;
}
float MyWelllogRound::GetResi() const
{
return filemessage.Mud_Resistivity[0];
}
std::string MyWelllogRound::GetSerial() const
{
return filemessage.LoggingSerial;
}
std::string MyWelllogRound::GetTeam() const
{
return filemessage.LoggingTeam;
}
float MyWelllogRound::GetTemp() const
{
return filemessage.Mud_Temp;
}
float MyWelllogRound::GetTempBot() const
{
return filemessage.Well_Bottom_Temperature;
}
float MyWelllogRound::GetWaterLoss() const
{
return filemessage.WaterLoss;
}
void MyWelllogRound::SetAudit(std::string audit)
{
int len=strlen(audit.c_str());
if(len>sizeof(filemessage.audit)) len=sizeof(filemessage.audit);
strncpy(filemessage.audit,audit.c_str(),len);
filemessage.audit[len]=0;
}
void MyWelllogRound::SetName(std::string audit)
{
this->m_name = audit;
}
void MyWelllogRound::SetCompanyName(std::string companyName)
{
int len=strlen(companyName.c_str());
if(len>sizeof(filemessage.LogCompanyName)) len=sizeof(filemessage.LogCompanyName);
strncpy(filemessage.LogCompanyName,companyName.c_str(),len);
filemessage.LogCompanyName[len]=0;
}
void MyWelllogRound::SetDate(std::string mdate)
{
filemessage.LoggingDate=StringToTime((char*)mdate.c_str());
}
void MyWelllogRound::SetDensity(float density)
{
filemessage.Mud_Density[0]=density;
}
void MyWelllogRound::SetINTLog(std::string mINTLog)
{
int len=strlen(mINTLog.c_str());
if(len>sizeof(filemessage.IntDepths)) len=sizeof(filemessage.IntDepths);
strncpy(filemessage.IntDepths,mINTLog.c_str(),len);
filemessage.IntDepths[len]=0;
}
void MyWelllogRound::SetIntProg(std::string intProg)
{
int len=strlen(intProg.c_str());;
if(len>sizeof(filemessage.Prog)) len=sizeof(filemessage.Prog);
strncpy(filemessage.Prog,intProg.c_str(),len);
filemessage.Prog[len]=0;
}
void MyWelllogRound::SetInteDress(std::string inteDress)
{
int len=strlen(inteDress.c_str());
if(len>sizeof(filemessage.Intor)) len=sizeof(filemessage.Intor);
strncpy(filemessage.Intor,inteDress.c_str(),len);
filemessage.Intor[len]=0;
}
void MyWelllogRound::SetWellName(std::string wellname)
{
int len=strlen(wellname.c_str());
if(len>sizeof(filemessage.WellName)) len=sizeof(filemessage.WellName);
memset(filemessage.WellName,0,sizeof(filemessage.WellName));
strncpy(filemessage.WellName,wellname.c_str(),len);
filemessage.WellName[len]=0;
// m_FileName=wellname.c_str();
}
void MyWelllogRound::SetItem(std::string item)
{
int len=strlen(item.c_str());
if(len>sizeof(filemessage.Item)) len=sizeof(filemessage.Item);
memset(filemessage.Item,0,sizeof(filemessage.Item));
strncpy(filemessage.Item,item.c_str(),len);
filemessage.Item[len]=0;
}
void MyWelllogRound::SetMudType(std::string mudType)
{
int len=strlen(mudType.c_str());
if(len>sizeof(filemessage.Mud_Property)) len=sizeof(filemessage.Mud_Property);
strncpy(filemessage.Mud_Property,mudType.c_str(),len);
filemessage.Mud_Property[len]=0;
}
void MyWelllogRound::SetMudViscosity(float mudViscosity)
{
filemessage.Mud_Viscosity[0] = mudViscosity;
}
void MyWelllogRound::SetNITINT(std::string mNITINT)
{
int len=strlen(mNITINT.c_str());
if(len>sizeof(filemessage.IntDepths)) len=sizeof(filemessage.IntDepths);
strncpy(filemessage.IntDepths,mNITINT.c_str(),len);
filemessage.IntDepths[len]=0;
}
void MyWelllogRound::SetOperator(std::string moperator)
{
int len=strlen(moperator.c_str());
if(len>sizeof(filemessage.Operator)) len=sizeof(filemessage.Operator);
strncpy(filemessage.Operator,moperator.c_str(),len);
filemessage.Operator[len]=0;
}
void MyWelllogRound::SetRemark(std::string remark)
{
int len=strlen(remark.c_str());
if(len>sizeof(filemessage.Reserved)) len=sizeof(filemessage.Reserved);
strncpy(filemessage.Reserved,remark.c_str(),len);
filemessage.Reserved[len]=0;
}
void MyWelllogRound::SetResi(float resi)
{
filemessage.Mud_Resistivity[0] = resi;
}
void MyWelllogRound::SetSerial(std::string serial)
{
int len=strlen(serial.c_str());
if(len>sizeof(filemessage.LoggingSerial)) len=sizeof(filemessage.LoggingSerial);
strncpy(filemessage.LoggingSerial,serial.c_str(),len);
filemessage.LoggingSerial[len]=0;
}
void MyWelllogRound::SetTeam(std::string team)
{
int len=strlen(team.c_str());
if(len>sizeof(filemessage.LoggingTeam)) len=sizeof(filemessage.LoggingTeam);
strncpy(filemessage.LoggingTeam,team.c_str(),len);
filemessage.LoggingTeam[len]=0;
}
void MyWelllogRound::SetTemp(float temp)
{
filemessage.Mud_Temp= temp;
}
void MyWelllogRound::SetTempBot(float tempBot)
{
filemessage.Well_Bottom_Temperature = tempBot;
}
void MyWelllogRound::SetWaterLoss(float waterLoss)
{
filemessage.WaterLoss=waterLoss;
}
void MyWelllogRound::SetTopDepth(float dep)
{
this->TopDepth = dep;
}
void MyWelllogRound::SetBottomDepth(float dep)
{
this->BottomDepth = dep;
}
float MyWelllogRound::GetTopDepth()
{
return TopDepth;
}
float MyWelllogRound::GetBottomDepth()
{
return BottomDepth;
}
std::string MyWelllogRound::GetAreaName() const
{
return filemessage.AreaName;
}
float MyWelllogRound::GetAsl() const
{
return filemessage.Altitude;
}
std::string MyWelllogRound::GetBit1Prog() const
{
return ConvertDataByFloat(filemessage.Bit_Depth[0]).toStdString();
}
std::string MyWelllogRound::GetBit2Prog() const
{
return ConvertDataByFloat(filemessage.Bit_Depth[1]).toStdString();
}
std::string MyWelllogRound::GetBit3Prog() const
{
return ConvertDataByFloat(filemessage.Bit_Depth[2]).toStdString();
}
std::string MyWelllogRound::GetBit4Prog() const
{
return ConvertDataByFloat(filemessage.Bit_Depth[3]).toStdString();
}
std::string MyWelllogRound::GetBit5Prog() const
{
return ConvertDataByFloat(filemessage.Bit_Depth[4]).toStdString();
}
float MyWelllogRound::GetBsl() const
{
return ConvertDataByFloat(filemessage.Kelly).toFloat();
}
std::string MyWelllogRound::GetCWMethod() const
{
return m_CWMethod;
}
std::string MyWelllogRound::GetCas1Prog() const
{
return ConvertDataByFloat(filemessage.Bit_Diameter[0]).toStdString();
}
float MyWelllogRound::GetCas1Shot() const
{
return ConvertDataByFloat(filemessage.Bushing_Detpth[0]).toFloat();
}
std::string MyWelllogRound::GetCas2Prog() const
{
return ConvertDataByFloat(filemessage.Bit_Diameter[1]).toStdString();
}
float MyWelllogRound::GetCas2Shot() const
{
return ConvertDataByFloat(filemessage.Bushing_Detpth[1]).toFloat();
}
std::string MyWelllogRound::GetCas3Prog() const
{
return ConvertDataByFloat(filemessage.Bit_Diameter[2]).toStdString();;
}
std::string MyWelllogRound::GetCas4Prog() const
{
return ConvertDataByFloat(filemessage.Bit_Diameter[3]).toStdString();;
}
std::string MyWelllogRound::GetCas5Prog() const
{
return ConvertDataByFloat(filemessage.Bit_Diameter[4]).toStdString();;
}
std::string MyWelllogRound::GetCompleteDate() const
{
time_t tm1=0;//filemessage.CompleteDrillDate;
QString cs=::GetDate(tm1);
return cs.toStdString();
}
std::string MyWelllogRound::GetEDrillDate() const
{
time_t tm1=filemessage.EndDrillDate;
QString cs=::GetDate(tm1);
return cs.toStdString();
}
float MyWelllogRound::GetSC1EDep() const
{
return m_SC1EDep;
}
float MyWelllogRound::GetSC1SDep() const
{
return m_SC1SDep;
}
float MyWelllogRound::GetSC2EDep() const
{
return m_SC2EDep;
}
float MyWelllogRound::GetSC2SDep() const
{
return m_SC2SDep;
}
std::string MyWelllogRound::GetSDrillDate() const
{
time_t tm1=filemessage.StartDrillDate;
QString cs=::GetDate(tm1);
return cs.toStdString();
}
int MyWelllogRound::GetWellType() const
{
static QString temp = ::GetConfPath()+"data.ini";
QSettings settings(temp,QSettings::IniFormat,0);
settings.setIniCodec(QTextCodec::codecForName("UTF-8"));
QStringList serials=settings.value("wellType",0).toStringList();
return serials.indexOf(filemessage.WellType);
}
double MyWelllogRound::GetXCode() const
{
return filemessage.Xcoor;
}
double MyWelllogRound::GetYCode() const
{
return filemessage.Ycoor;
}
float MyWelllogRound::GetTVD0()
{
return filemessage.TVD;
}
float MyWelllogRound::GetXOffset()
{
return filemessage.X0;
}
float MyWelllogRound::GetYOffset()
{
return filemessage.Y0;
}
void MyWelllogRound::SetAreaName(std::string areaName)
{
int len=areaName.length();
if(len>sizeof(filemessage.AreaName)) len=sizeof(filemessage.AreaName);
strncpy(filemessage.AreaName,areaName.c_str(),len);
}
void MyWelllogRound::SetAsl(float asl)
{
filemessage.Altitude = asl;
}
void MyWelllogRound::SetBit1Prog(std::string bit1Prog)
{
filemessage.Bit_Depth[0]= ConvertDataByString(bit1Prog.c_str());
}
void MyWelllogRound::SetBit2Prog(std::string bit2Prog)
{
filemessage.Bit_Depth[1] = ConvertDataByString(bit2Prog.c_str());
}
void MyWelllogRound::SetBit3Prog(std::string bit3Prog)
{
filemessage.Bit_Depth[2] = ConvertDataByString(bit3Prog.c_str());
}
void MyWelllogRound::SetBit4Prog(std::string bit4Prog)
{
filemessage.Bit_Depth[3] = ConvertDataByString(bit4Prog.c_str());
}
void MyWelllogRound::SetBit5Prog(std::string bit5Prog)
{
filemessage.Bit_Depth[4] = ConvertDataByString(bit5Prog.c_str());
}
void MyWelllogRound::SetBsl(float bsl)
{
filemessage.Kelly = ConvertDataByString(QString::number(bsl));
}
void MyWelllogRound::SetCWMethod(std::string cWMethod)
{
this->m_CWMethod = cWMethod;
}
void MyWelllogRound::SetCas1Prog(std::string cas1Prog)
{
filemessage.Bit_Diameter[0]=ConvertDataByString(cas1Prog.c_str());
}
void MyWelllogRound::SetCas1Shot(float cas1Shot)
{
m_Cas1Shot=cas1Shot;
}
void MyWelllogRound::SetCas2Prog(std::string cas2Prog)
{
filemessage.Bit_Diameter[1]=ConvertDataByString(cas2Prog.c_str());
}
void MyWelllogRound::SetCas2Shot(float cas2Shot)
{
m_Cas2Shot=cas2Shot;
}
void MyWelllogRound::SetCas3Prog(std::string cas3Prog)
{
filemessage.Bit_Diameter[2]=ConvertDataByString(cas3Prog.c_str());
}
void MyWelllogRound::SetCas4Prog(std::string cas4Prog)
{
filemessage.Bit_Diameter[3]=ConvertDataByString(cas4Prog.c_str());
}
void MyWelllogRound::SetCas5Prog(std::string cas5Prog)
{
filemessage.Bit_Diameter[4]=ConvertDataByString(cas5Prog.c_str());
}
void MyWelllogRound::SetOilCompanyName(std::string companyName)
{
int len=companyName.length();
if(len>sizeof(filemessage.OilCompanyName)) len=sizeof(filemessage.OilCompanyName);
strncpy(filemessage.OilCompanyName,companyName.c_str(),len);
}
void MyWelllogRound::SetCompleteDate(std::string completeDate)
{
QDate td=QDate::fromString(completeDate.c_str(),"yyyy年-MM月-dd日");
char buf[200];
sprintf(buf,"%04d-%02d-%02d %02d:%02d:%02d",td.year(),td.month(),td.day(),0,0,0);
//filemessage.completeDate=
StringToTime(buf);
}
void MyWelllogRound::SetEDrillDate(std::string eDrillDate)
{
QDate td=QDate::fromString(eDrillDate.c_str(),"yyyy年-MM月-dd日");
char buf[200];
sprintf(buf,"%04d-%02d-%02d %02d:%02d:%02d",td.year(),td.month(),td.day(),0,0,0);
filemessage.EndDrillDate=StringToTime(buf);
}
void MyWelllogRound::SetSC1EDep(float sC1EDep)
{
m_SC1EDep=sC1EDep;
}
void MyWelllogRound::SetSC1SDep(float sC1SDep)
{
m_SC1SDep=sC1SDep;
}
void MyWelllogRound::SetSC2EDep(float sC2EDep)
{
m_SC2EDep=sC2EDep;
}
void MyWelllogRound::SetSC2SDep(float sC2SDep)
{
m_SC2SDep=sC2SDep;
}
void MyWelllogRound::SetSDrillDate(std::string sDrillDate)
{
QDate td=QDate::fromString(sDrillDate.c_str(),"yyyy年-MM月-dd日");
char buf[200];
sprintf(buf,"%04d-%02d-%02d %02d:%02d:%02d",td.year(),td.month(),td.day(),0,0,0);
filemessage.StartDrillDate=StringToTime(buf);
m_SDrillDate=sDrillDate;
}
void MyWelllogRound::SetWellType(int WellType)
{
static QString temp = ::GetConfPath()+"data.ini";
QSettings settings(temp,QSettings::IniFormat,0);
settings.setIniCodec(QTextCodec::codecForName("UTF-8"));
QStringList serials=settings.value("wellType",0).toStringList();
if(WellType<0) WellType=0;
if(WellType>=serials.size()) WellType=serials.size()-1;
if(WellType>0&&WellType<serials.size()) strncpy(filemessage.WellType,serials[WellType].toStdString().c_str(),20);
}
void MyWelllogRound::SetXCode(double xCode)
{
filemessage.Xcoor = xCode;
}
void MyWelllogRound::SetYCode(double yCode)
{
filemessage.Ycoor = yCode;
}
void MyWelllogRound::SetTVD0(float Tvd0)
{
filemessage.TVD = Tvd0;
}
void MyWelllogRound::SetXOffset(float XOffset)
{
filemessage.X0 = XOffset;
}
void MyWelllogRound::SetYOffset(float YOffset)
{
filemessage.Y0=YOffset;
}
void MyWelllogRound::LoadMeesge(QString filename)
{
if(filename=="") return;
m_FileName=filename;
CMemRdWt *logio=new CMemRdWt();
if(filename==""||!logio->Open(filename.toStdString().c_str(),CSlfIO::modeRead))
{
delete logio;
// QMessageBox::information(NULL,"提示","SLF文件打开失败请检查",QMessageBox::Yes);
memset(&filemessage,0,sizeof(Slf_FILE_MESSAGE));
return;
}
logio->GetFileMessage(filemessage);
delete logio;
}
void MyWelllogRound::SaveMeesge(QString filename)
{
if(filename=="") return;
if(filename.indexOf(".")<0) {
// QString name=::GetProject()->GetName();
// QString wellname=filemessage.WellName;
// if(wellname.isEmpty()) wellname=filename;
// QString filename1=GetLogdataPath()+name+"\\#"+filemessage.WellName;
// CreateDir((char *)filename1.toStdString().c_str());
// filename1+="\\"+filename+".slf";
// filename=filename1;
}
CMemRdWt *logio=new CMemRdWt();
if(filename==""||!logio->Open(filename.toStdString().c_str(),CSlfIO::modeReadWrite))
{
delete logio;
// QMessageBox::information(NULL,"提示","SLF文件打开失败请检查",QMessageBox::Yes);
return;
}
logio->SetFileMessage(filemessage);
delete logio;
}
Slf_FILE_MESSAGE & MyWelllogRound::GetFileMessage()
{
return filemessage;
}
void MyWelllogRound::SaveMeesge()
{
SaveMeesge(m_FileName);
}
QString MyWelllogRound::GetFileName()
{
return m_FileName;
}