logplus/OSGDataModel/src/ObjWelllogRound.cpp
2025-11-26 10:21:39 +08:00

384 lines
11 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.

#pragma warning( push ,0)
#include <cassert>
#include "ObjWelllogRound.h"
#include "ObjWelllog.h"
#include "ObjWell.h"
#include <QFileInfo>
// #include "WellLogWorkflowDataModel.h"
#pragma warning( pop )
BEGIN_OSGDATAMODEL_NAMESPACE;
CObjWelllogRound *g_pObjWelllogRound(NULL);
OSGDATAMODEL_EXPORT CObjWelllogRound *GetCurrentObjWelllogRound()
{
return g_pObjWelllogRound;
}
OSGDATAMODEL_EXPORT void SetCurrentObjWelllogRound( CObjWelllogRound *pObjWelllogRound )
{
g_pObjWelllogRound = pObjWelllogRound;
if(pObjWelllogRound)SetCurrentObjWell(pObjWelllogRound->GetWell());
}
// OSGDATAMODEL_EXPORT QString GetCurrentWellRoundPath()
// {
// if(g_pObjWelllogRound)
// {
// return g_pObjWelllogRound->GetWellRoundPath();
// }
// else
// {
// //TODO 输出日志提醒
// return "";
// }
// }
// OSGDATAMODEL_EXPORT QString GetSingleWellFolderID()
// {
// if(g_pObjWelllogRound)
// {
// return g_pObjWelllogRound->GetParent()->GetChildByType(GetClassID_SingleMethodFolder())->GetID();
// }
// else
// {
// //TODO 输出日志提醒
// return "";
// }
// }
// QString CObjWelllogRound::GetWellRoundPath()
// {
// QString CurrentWellRoundPath=GetFullPathName();
// QStringList strList = CurrentWellRoundPath.split("/",QString::SkipEmptyParts);
// strList.takeFirst();
// CurrentWellRoundPath = strList.join("/");
// return CurrentWellRoundPath;
// }
QString CObjWelllogRound::GetDescription()
{
CLogIO *logio=new CLogIO();
QString slfFileName=GetSlfFileName();
if(slfFileName.isEmpty()) return "";
if(!logio->Open(slfFileName.toStdString().c_str(),CSlfIO::modeRead))
{
delete logio;
return "";
}
float StartDepth=999999;
float EndDepth=-999999;
float MinDepLevel=999999;
float MaxDepLevel=-999999;
int nCurve=0;
int nTable=0;
int nWave=0;
int nCard=0;
int nOther=0;
int nDelete=0;
int count=logio->GetObjectCount();
for(int i=0;i<count;i++)
{
if(logio->GetObjectStatus(i)!=OBJECT_NORMAL) {
nDelete++;
continue;
}
short curvetype=logio->GetObjectType(i);
short Attribute=0,SubAttribute=0;
logio->GetObjectAttribute(i,&Attribute,&SubAttribute);
if(curvetype==CURVE_OBJECT)
{
Slf_CURVE acurveinfo;
logio->GetCurveInfo(i,&acurveinfo);
nCurve++;
if(acurveinfo.DepLevel>MaxDepLevel) MaxDepLevel=acurveinfo.DepLevel;
if(acurveinfo.DepLevel<MinDepLevel) MinDepLevel=acurveinfo.DepLevel;
if(acurveinfo.StartDepth<StartDepth) StartDepth=acurveinfo.StartDepth;
if(acurveinfo.EndDepth>EndDepth) EndDepth=acurveinfo.EndDepth;
}
else if(curvetype==WAVE_OBJECT)
{
Slf_WAVE acurveinfo;
logio->GetWaveInfo(i,&acurveinfo);
nWave++;
if(acurveinfo.DepLevel>MaxDepLevel) MaxDepLevel=acurveinfo.DepLevel;
if(acurveinfo.DepLevel<MinDepLevel) MinDepLevel=acurveinfo.DepLevel;
if(acurveinfo.StartDepth<StartDepth) StartDepth=acurveinfo.StartDepth;
if(acurveinfo.EndDepth>EndDepth) EndDepth=acurveinfo.EndDepth;
}
else if(curvetype==CARD_OBJECT)
{
nCard++;
}
else if(curvetype==FMT_OBJECT)
{
nOther++;
}
else if(curvetype==TDT_OBJECT)
{
nOther++;
}
else if(curvetype>CARD_OBJECT||curvetype==0)
{
nTable++;
}
}
delete logio;
QString result="";
result.append("对象类型:井次文件\n");
result.append("总对象数:").append(QString::number(count)).append("\n");;
result.append("标记为删除对象数:").append(QString::number(nDelete)).append("\n");;
result.append("曲线数:").append(QString::number(nCurve)).append("\n");
result.append("表格数:").append(QString::number(nTable)).append("\n");
result.append("参数卡:").append(QString::number(nCard)).append("\n");
result.append("其它:").append(QString::number(nOther)).append("\n");
result.append("最小深度:").append(QString::number(StartDepth)).append("\n");
result.append("最大深度:").append(QString::number(EndDepth)).append("\n");
result.append("最小采样间隔:").append(QString::number(MinDepLevel)).append("\n");
result.append("最小采样间隔:").append(QString::number(MaxDepLevel)).append("\n");
return result;
}
CObjWell *CObjWelllogRound::GetWell()
{
return m_pWell;
}
void CObjWelllogRound::SetWell(CObjWell *pWell)
{
m_pWell=pWell;
}
// CObjWelllogRound::CObjWelllogRound()
// {
// SetIconName( "icon/WellRound.png");
// m_pObject = NULL;
// m_pWell=NULL;
// isFLAG=false;
// }
// void CObjWelllogRound::SetSlfFileName(QString val)
// {
// QString oldf=m_strAttachedSlfFile;
// m_strAttachedSlfFile=val;
// std::vector<CBaseObject*> PaiObjects;
// CPaiObjectHelper::RecursionGetAllChildren(this,PaiObjects );
// for(int j=0;j<PaiObjects.size();j++) {
// if(PaiObjects[j]==this) continue;
// CObjWellLog* tempWellLog= dynamic_cast<CObjWellLog*>(PaiObjects[j]);
// if(tempWellLog) {
// tempWellLog->SetSlfFileName(val);
// continue;
// }
// PaiObject *pObj=PaiObjects[j]->GetPaiObject()->GetObjectByType(GetClassID_WorkflowFolder());
// if(pObj) {
// QList<PaiObject *> childs;
// pObj->GetChildren(childs);
// for (int n=0;n<childs.size();n++)
// {
// CWellLogWorkflowDataModel* tempWellLog= dynamic_cast<CWellLogWorkflowDataModel*>(childs[n]);
// if(tempWellLog) {
// CBaseObject *pBaseObject=tempWellLog->GetMWVecWindowDocument();
// if(pBaseObject) {
// QList<PaiObject*> childObjects;
// pBaseObject->GetPaiObject()->GetChildren(childObjects);
// for(int i=0;i<childObjects.size();i++) {
// CObjWellTrack *pWellTrack=dynamic_cast<CObjWellTrack *>(childObjects[i]);
// if(pWellTrack) {
// if(!pWellTrack->GetWelllogRound()) continue;
// CObjWell*pWell=pWellTrack->GetWelllogRound()->GetWell();
// if(pWell==this->GetWell()) continue;
// if(pWell) {
// int index0=val.lastIndexOf(".");
// QString nf=val.left(index0);
// QString old=pWell->GetWellMessageFileName();
// int index=old.lastIndexOf(".");
// int index1=oldf.lastIndexOf(".");
// QString onf=oldf.left(index1);
// if(old.compare(onf,Qt::CaseInsensitive)==0&&nf.compare(old,Qt::CaseInsensitive)) {
// pWell->SetWellFileName(m_strAttachedSlfFile);
// QList <PaiObject *> pWellRs;
// int count=pWell->GetAllWellRound(pWellRs);
// for(int k=0;k<count;k++)
// {
// CObjWelllogRound *pWellR=dynamic_cast<CObjWelllogRound *>(pWellRs[k]);
// if(pWellR==this) continue;
// pWellR->SetSlfFileName(val);
// }
// }
// }
// }
// }
// }
// }
// }
// }
// }
// }
CObjWelllogRound::~CObjWelllogRound()
{
if(g_pObjWelllogRound==this) g_pObjWelllogRound=NULL;
CObjWell *pWell=GetWell();
if(pWell) pWell->SetCurrentObjWellRound(NULL);
return;
}
// void CObjWelllogRound::setParent(PaiObject* pObject)
// {
// m_pObject = pObject;
// }
// bool CObjWelllogRound::isExistsName(QString name)
// {
// QList<PaiObject*> objs;
// if(this->GetParent() != NULL)
// {
// GetParent()->GetChildren(objs);
// }else
// {
// if(m_pObject != NULL)
// {
// m_pObject->GetChildren(objs);
// }
// }
// foreach(PaiObject* obj, objs)
// {
// CObjWelllogRound* pTempRound = dynamic_cast<CObjWelllogRound*>(obj);
// if(pTempRound != NULL && pTempRound != this && pTempRound->GetName().compare(name,Qt::CaseInsensitive)==0)
// {
// return true;
// }
// }
// return false;
// }
void CObjWelllogRound::SetBelongID()
{
// pai::objectmodel::PaiObject* paiWell = this->GetForebear(GetClassID_Well());
// if(paiWell)
// {
// pai::datamodel::CObjWell *currentWell= dynamic_cast<pai::datamodel::CObjWell*>(paiWell);
// if(currentWell)
// {
// pai::ios::welllog::DataObject* dbWell = currentWell->GetDbObject();
// if(dbWell)
// {
// m_DbWelllogRound.SetDataBelongID(dbWell->GetDataID());
// }
// }
// }
}
QUuid CObjWelllogRound::GetTypeID()const
{
return GetClassID_WellLogRound();
}
// bool CObjWelllogRound::Serialize( CObjectArchive &ar )
// {
// if(ar.IsStoring())
// {
// BEGIN_WRITE_OBJECT( ar,1 );
// BEGIN_WRITE_BLOCK( ar, 1);
// CBaseObjectImpl::Serialize( ar );
// ar<<m_strAttachedSlfFile;
// END_WRITE_BLOCK( ar, 1 );
// END_WRITE_OBJECT( ar );
// }
// else
// {
// BEGIN_READ_OBJECT( ar,1 );
// BEGIN_READ_BLOCK( 1 );
// CBaseObjectImpl::Serialize( ar );
// ar>>m_strAttachedSlfFile;
// END_READ_BLOCK( 1 );
// END_READ_OBJECT( ar );
// }
// return true;
// }
// void CObjWelllogRound::SetDBWelllogRound( pai::ios::welllog::WelllogRound DbWelllogRound )
// {
// m_DbWelllogRound=DbWelllogRound;
// }
pai::ios::welllog::WelllogRound &CObjWelllogRound::GetDBWelllogRound()
{
return m_DbWelllogRound;
}
pai::ios::welllog::DataObject * CObjWelllogRound::GetDbObject()
{
SetBelongID();
return &m_DbWelllogRound;
}
void CObjWelllogRound::CopyFrom( CBaseObject *pOSGObjectOther )
{
CBaseObject::CopyFrom( pOSGObjectOther );
CObjWelllogRound *pWellRound = dynamic_cast<CObjWelllogRound *>( pOSGObjectOther );
if( pWellRound )
{
m_DbWelllogRound= pWellRound->m_DbWelllogRound ;
}
}
//
// bool CObjWelllogRound::AddChild(PaiObject* pChild, bool mountNow )
// {
// if(!pChild) return false;
// if(GetTragetFolderID(pChild->GetTypeID())!=GetClassID_GeneralFolder())
// GetTragetFolder(GetTragetFolderID(pChild->GetTypeID()))->AddChild(pChild,mountNow);
// else
// CBaseObjectImpl::AddChild(pChild,true);
// return true;
// }
//往井次下加入曲线时根据曲线的类型返回其对应的目录id
QUuid CObjWelllogRound::GetTragetFolderID(QUuid aLogTypeid){
if(aLogTypeid==GetClassID_WellLog()) return GetClassID_WellLogFolder();
else if(aLogTypeid==GetClassID_WellTrajectory()) return GetClassID_WellTrajectoryFolder();
else if(aLogTypeid==GetClassID_WellLogWavefile()) return GetClassID_WellLogWavefileFolder();
else if(aLogTypeid==GetClassID_WellLogBIN()) return GetClassID_WellLogBINFolder();
else if(aLogTypeid==GetClassID_WellLogFMT()) return GetClassID_WellLogFMTFolder();
else if(aLogTypeid==GetClassID_WellLogINP()) return GetClassID_WellLogINPFolder();
else if(aLogTypeid==GetClassID_WellLogTABLE()) return GetClassID_WellLogTABLEFolder();
else if(aLogTypeid==GetClassID_WellLogTDT()) return GetClassID_WellLogTDTFolder();
else return GetClassID_GeneralFolder()
;}
// //根据folderid找到对应的folder如果没有则创建
// CObjectFolder* CObjWelllogRound::GetTragetFolder(QUuid aFolderTypeid)
// {
// CObjectFolder* target=dynamic_cast<CObjectFolder*>(GetChildByType(aFolderTypeid));
// if(target==NULL){
// target=new CObjectFolder(aFolderTypeid);
// CBaseObjectImpl::AddChild(target,true);
// }
// return target;
// }
// CObjWellLog* CObjWelllogRound::GetWellLogByName(QString name)
// {
// CObjWellLog* result=NULL;
// result=dynamic_cast<CObjWellLog*>(GetObjectByName(name,3));
// return result;
// }
// BEGIN_REGISTER_OBJECT(CObjWelllogRound)
// QUuid(GetClassID_WellLogRound())
// END_REGISTER_OBJECT( CObjWelllogRound );
END_OSGDATAMODEL_NAMESPACE