⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logcurve.cpp

📁 是有关石油物理测井曲线的分层方法
💻 CPP
字号:
// LogCurve.cpp : implementation file
//

#include "stdafx.h"
#include "LogCurve.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CLogCurve

IMPLEMENT_DYNCREATE(CLogCurve, CDocument)

CLogCurve::CLogCurve()
{
	//strCurName= (CString*)malloc(sizeof(char)*10);
	nLeft=0;
	nRight=100;
	nKeduType=0;
	flagEditd=false;
}

CLogCurve::~CLogCurve()
{
//	free(strCurName);
}

//BEGIN_MESSAGE_MAP(CLogCurve, CObject)
	//{{AFX_MSG_MAP(CLogCurve)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
//END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CLogCurve diagnostics

#ifdef _DEBUG

void CLogCurve::Dump(CDumpContext& dc) const
{
	CObject::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CLogCurve serialization

void CLogCurve::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
		ar<<nID<<strCurName<<strOthCurName<<StrCurDanwei
		  <<crColor<<nStyle<<nWidth<<nLeft<<nRight<<nKeduType;
	}
	else
	{
		// TODO: add loading code here
		ar>>nID>>strCurName>>strOthCurName>>StrCurDanwei
		  >>crColor>>nStyle>>nWidth>>nLeft>>nRight>>nKeduType;
	}
}

/////////////////////////////////////////////////////////////////////////////
// CLogCurve commands

// Dao.cpp : implementation file

/////////////////////////////////////////////////////////////////////////////
// CDao

IMPLEMENT_DYNCREATE(CDao, CObject)

extern CWellHead wh;

CDao::CDao()
{
	nNumCur=0;
	numYXTC=0;
	nWidth=200;
	for(int i=0;i<MaxNumYanxingInDao;i++)
	{
		m_yxtc[0].daoID=nID;
		nLeft=0.1;
		nRight=100.0;
		nType=0;
		ptY[i]=NULL;
//		Pt[i]=NULL;
	}
}

CDao::~CDao()
{
}

/////////////////////////////////////////////////////////////////////////////
// CDao diagnostics

#ifdef _DEBUG

void CDao::Dump(CDumpContext& dc) const
{
	CObject::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CDao serialization

void CDao::Serialize(CArchive& ar)
{
	int i;
	if (ar.IsStoring())
	{
		// TODO: add storing code here
		ar<<nID<<nType<<nKeduType<<nLwz<<nRwz<<nWidth<<nLeft<<nRight<<crBkColor<<crColor
		  <<nNumCur<<numYXTC<<numPMTC;
		ar<<rcHead<<rcBody;
		for(i=0;i<nNumCur;i++)
			Curve[i].Serialize(ar);  
		for(i=0;i<numYXTC;i++)
			m_yxtc[i].Serialize(ar);
		for(i=0;i<numPMTC;i++)
			m_Pmtc[i].Serialize(ar);
	}
	else
	{
		// TODO: add loading code here
		ar>>nID>>nType>>nKeduType>>nLwz>>nRwz>>nWidth>>nLeft>>nRight>>crBkColor>>crColor
		  >>nNumCur>>numYXTC>>numPMTC;
		ar>>rcHead>>rcBody;
		for(i=0;i<nNumCur;i++)
			Curve[i].Serialize(ar);  
		for(i=0;i<numYXTC;i++)
			m_yxtc[i].Serialize(ar); 
		for(i=0;i<numPMTC;i++)
			m_Pmtc[i].Serialize(ar);
	}
}

/////////////////////////////////////////////////////////////////////////////
// CDao commands

void CDao::AddACur(CLogCurve &Cur)
{
	int i;
	i=nNumCur++;
	int tt=Cur.GetnID();
	Curve[i].SetnId(tt);	
	Curve[i].strCurName.Format("%s",Cur.strCurName);
	Curve[i].StrCurDanwei.Format("%s",Cur.StrCurDanwei);
	Curve[i].strOthCurName.Format("%s",Cur.strOthCurName);
	Curve[i].nKeduType =Cur.nKeduType ;
	Curve[i].nStyle =Cur.nStyle ;
	Curve[i].nWidth =Cur.nWidth ;
	Curve[i].nLeft =Cur.nLeft ;
	Curve[i].nRight =Cur.nRight ;
	Curve[i].crColor =Cur.crColor;
}

inline float CDao::XianZhiX(float ll, float lr, float x)
{
	if(x>=ll && x<=lr)
		return x;
	else
		if(x<ll)
			return ll;
		else
			return lr;
}

BOOL CDao::AddACur(CString &CurName,int nDaoID)
{
	int i,nCurID;
	for(i=1;i<=wh.nNumCur ;i++)
		if(CurName.Compare(wh.Curve[i].strCurName)==0 )
		{
			nCurID=i;
			switch(nDaoID)
			{
			case 1:
				break;
			case 2:
				wh.Curve[i].nKeduType =1;
				wh.Curve[i].nLeft =0.1;
				wh.Curve[i].nRight =100;
				break;
			default:
				wh.Curve[i].nKeduType =0;
				wh.Curve[i].nLeft =0;
				wh.Curve[i].nRight =100;
				break;
			};
			switch(nNumCur)
			{
			case 0:
				wh.Curve[i].nStyle =0;
				wh.Curve[i].crColor =RGB(255,0,0);
				break;
			case 1:
				wh.Curve[i].nStyle =1;
				wh.Curve[i].crColor =RGB(255,0,255);
				break;
			case 2:
				wh.Curve[i].nStyle =2;
				wh.Curve[i].crColor =RGB(0,0,255);
				break;
			default:
				wh.Curve[i].nStyle =3;
				wh.Curve[i].crColor =RGB(0,0,0);
				break;
			};
			AddACur(wh.Curve[nCurID]);
			return true;
		}
		return false;
}

BOOL CDao::AddACur(CString &CurName, int nDaoID, float LeftVal, float RightVal)
{
	int i,nCurID;
	for(i=1;i<=wh.nNumCur ;i++)
		if(CurName.Compare(wh.Curve[i].strCurName)==0 )
		{
			nCurID=i;
			wh.Curve[i].nLeft =LeftVal;
			wh.Curve[i].nRight =RightVal;

			switch(nDaoID)
			{
			case 1:
				break;
			case 2:
				wh.Curve[i].nKeduType =1;
				break;
			default:
				wh.Curve[i].nKeduType =0;
				break;
			};
			switch(nNumCur)
			{
			case 0:
				wh.Curve[i].nStyle =0;
				wh.Curve[i].crColor =RGB(255,0,0);
				break;
			case 1:
				wh.Curve[i].nStyle =1;
				wh.Curve[i].crColor =RGB(255,0,255);
				break;
			case 2:
				wh.Curve[i].nStyle =2;
				wh.Curve[i].crColor =RGB(0,0,255);
				break;
			default:
				wh.Curve[i].nStyle =3;
				wh.Curve[i].crColor =RGB(0,0,0);
				break;
			};
			AddACur(wh.Curve[nCurID]);
			return true;
		}
		return false;
}

/////////////////////////////////////////////////////////////////////////
///////////////岩性剖面填充类
IMPLEMENT_DYNCREATE(CPMTC, CObject)
void CPMTC::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
		ar<<m_nSouCur<<strName<<m_nSign;
	}
	else
	{
		// TODO: add loading code here
		ar>>m_nSouCur>>strName>>m_nSign;
	}
}

/////////////////////////////////////////////////////////////////////////
///////////////岩性填充类
IMPLEMENT_DYNCREATE(CYXTC, CObject)
void CYXTC::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
		ar<<m_nID<<m_bflag<<daoID<<YxName<<m_nType<<m_nSign<<m_nSouCur<<m_nDesCur;
	}
	else
	{
		// TODO: add loading code here
		ar>>m_nID>>m_bflag>>daoID>>YxName>>m_nType>>m_nSign>>m_nSouCur>>m_nDesCur;

	}
}
/*
/////////////////////////////////////////////////////////////////////////
///////////////页面设置类

IMPLEMENT_DYNCREATE(CPAGE, CObject)
void CPAGE::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}
*/
/////////////////////////////////////////////////////////////////////////////
// CWellHead

IMPLEMENT_DYNCREATE(CWellHead, CObject)
CWellHead::CWellHead()
{
	int i;
	nScal=4000;
	bWell=false;
	nVBili=500;
	for(i=0;i<MaxNumDaoInWell;i++)
	{
		myDao[i].nID =i;
		if(i==1)
			myDao[i].SetType(-1);
		else
			myDao[i].SetType(0);
	}
	nNumDao=0;
	pLogData=NULL;
//	InitWellPage();
}
CWellHead::~CWellHead()
{
		delete []pLogData;
		pLogData=NULL;
}

/////////////////////////////////////////////////////////////////////////////
// CWellHead diagnostics

#ifdef _DEBUG

void CWellHead::Dump(CDumpContext& dc) const
{
	CObject::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CWellHead serialization

void CWellHead::Serialize(CArchive& ar)
{
	int i;
	if (ar.IsStoring())
	{
		// TODO: add storing code here
//公共信息
		ar<<FileName<<WellName<<bWell<<nNumDao<<nScal<<nStPoint<<nEndPoint
		  <<STDEP<<ENDDEP<<RLEV<<dispSTDEP<<dispENDDEP<<nNumCur<<nTotalNumPoint
		  <<tnTotalNumPoint<<nVBili<<nNumDao;
//道信息				
		for(i=0;i<=wh.nNumDao;i++)
			wh.myDao[i].Serialize(ar);
//曲线信息
		for(i=0;i<=wh.nNumCur;i++)
			wh.Curve[i].Serialize(ar);
//页面信息
		page.Serialize(ar);
//实际测井数据
		for(i=0;i<wh.nTotalNumPoint;i++)
			for(int k=1;k<=wh.nNumCur;k++)
				ar<<pLogData[i][k];
	}
	else
	{
		// TODO: add loading code here
//公共信息
		ar>>FileName>>WellName>>bWell>>nNumDao>>nScal>>nStPoint>>nEndPoint
		  >>STDEP>>ENDDEP>>RLEV>>dispSTDEP>>dispENDDEP>>nNumCur>>nTotalNumPoint
		  >>tnTotalNumPoint>>nVBili>>nNumDao;
		wh.tnNumCur =wh.nNumCur; 
//道信息				
		for(i=0;i<=wh.nNumDao;i++)
			wh.myDao[i].Serialize(ar);
//曲线信息
		for(i=0;i<=wh.nNumCur;i++)
			wh.Curve[i].Serialize(ar);
//页面信息
		page.Serialize(ar);
//实际测井数据
		wh.pLogData=new float[wh.nTotalNumPoint][81];
		for(i=0;i<wh.nTotalNumPoint;i++)
		{
			pLogData[i][0]=wh.STDEP+wh.RLEV*i;  
			for(int k=1;k<=wh.nNumCur;k++)
				ar>>pLogData[i][k];
		}
	}
}
/////////////////////////////////////////////////////////////////////////////
// CWellHead commands

/////////////////////////////////////////////////////////////////////////////
// CPAGE

IMPLEMENT_DYNCREATE(CPAGE, CObject)

CPAGE::CPAGE()
{
	nHightHead=150;
	nHightBody=500;
	left=5;
	top=5;
	right=5;
	bottom =top+nHightBody+nHightHead;
}

CPAGE::~CPAGE()
{
}

/////////////////////////////////////////////////////////////////////////////
// CPAGE diagnostics

#ifdef _DEBUG
void CPAGE::AssertValid() const
{
	CObject::AssertValid();
}

void CPAGE::Dump(CDumpContext& dc) const
{
	CObject::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CPAGE serialization

void CPAGE::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
		ar<<left<<right<<top<<bottom
		  <<nHightHead<<nHightBody;
	}
	else
	{
		// TODO: add loading code here
		ar>>left>>right>>top>>bottom
		  >>nHightHead>>nHightBody;
	}
}

/////////////////////////////////////////////////////////////////////////////
// CPAGE commands

void CDao::SetType(int nTp)
{
	nType=nTp;
	switch(nTp)
	{
	case -1:
		nWidth=50;
		break;
	case 0:
		nWidth=200;
		break;
	case 1:
		nWidth=200;
		break;
	};
}

void CWellHead::InitWellPage()
{
	if(wh.bWell)
		page.nHightBody=(wh.dispENDDEP-wh.dispSTDEP)*wh.nScal/wh.nVBili;
	nNumDao=2;
	int i=0;
	myDao[i].nLwz=page.left;
	myDao[i].nRwz=myDao[i].nLwz +myDao[i].nWidth;
	myDao[i].rcHead.SetRect(myDao[i].nLwz,page.top,myDao[i].nRwz,page.top+page.nHightHead) ;
	myDao[i].rcBody.SetRect(myDao[i].nLwz,myDao[i].rcHead.bottom,myDao[i].nRwz,myDao[i].rcHead.bottom+page.nHightBody);
	i=1;
	for(i=1;i<=nNumDao;i++)
	{
		myDao[i].nLwz=myDao[i-1].nRwz;
		myDao[i].nRwz=myDao[i].nLwz +myDao[i].nWidth;
		myDao[i].rcHead.SetRect(myDao[i].nLwz,page.top,myDao[i].nRwz,page.top+page.nHightHead) ;
		myDao[i].rcBody.SetRect(myDao[i].nLwz,myDao[i].rcHead.bottom,myDao[i].nRwz,myDao[i].rcHead.bottom+page.nHightBody);
	}
}

int CDao::GetType()
{
	return nType;
}
//取得所有道的最大曲线条数
int CWellHead::GetMaxNCD()
{
	int i,max=0;
	for(i=0;i<=wh.nNumDao;i++)
	{
		if(max<wh.myDao[i].nNumCur)
			max=wh.myDao[i].nNumCur;
	}
	return max;
}
//设置所有道的最大曲线条数
void CWellHead::SetMaxNCD()
{	
	int i,max=0;
	for(i=0;i<wh.nNumDao;i++)
	{
		if(max<wh.myDao[i].nNumCur)
			max=wh.myDao[i].nNumCur;
	}	
	nMaxNCD=max;
}

void CWellHead::SetHeadHight(int newHignt)
{
	page.nHightHead=newHignt;
	InitWellPage();
}

void CLogCurve::SetnId(int id)
{
	nID=tmpnID=id;
}

int CLogCurve::GetnID()
{
	return nID; 
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -