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

📄 origgmgsdata.cpp

📁 对测井数据显示、编辑、处理
💻 CPP
字号:
// OrigGmgsData.cpp: implementation of the COrigGmgsData class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "WellDataProcess.h"
#include "OrigGmgsData.h"

#include "GlobalData.h"
#include "math.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
COrigGmgsData::COrigGmgsData()
{
	m_corCurve = COR_BLACK;
	m_nColHeight = 500;
	m_nColWidth  = 100;
	m_nCurveStyle = PS_SOLID;
	m_nCurveWidth = 1;
	m_nXBase  =   0;
	m_nYBase  =   0;
	m_fDataMax = 0;
	m_fDataMin = 0;
	m_nMargin  = 0;
}

COrigGmgsData::~COrigGmgsData()
{

}

//////////////////////////////////////////////////////////////////////
// the Other function

void COrigGmgsData::Draw(CDC *pDC)
{
	DrawScale(pDC);
	int   nDataNum = m_arrGmgsPoint.GetSize();
	if(nDataNum <= 0)
		return;
	float fScaleX  = (float) (m_nColWidth - 2 * m_nMargin) / (m_fDataMax - m_fDataMin);
	float fScaleY  = (float) m_nColHeight / (nDataNum + 1);
	int x, y;
	for(int i = 0; i < nDataNum; i ++)
	{
		x = int (m_nXBase +m_nMargin + (m_arrGmgsPoint[i].fValue - m_fDataMin) * fScaleX);
		y = int (m_nYBase + (i + 1) * fScaleY);
		CRect rc(x-2, y-2, x+2, y+2);
		EraseRect(pDC, rc, COR_RED);
	}
    
}

void COrigGmgsData::InitVariation(COLORREF corCurve, int nCurveWidth, int nCurveStyle, \
		                       int nXBase, int nYBase, int nColWidth, int nColHeight, int nMargin)
{
	m_corCurve = corCurve;
	m_nCurveWidth = nCurveWidth;
	m_nCurveStyle = nCurveStyle;
	m_nXBase = nXBase;
	m_nYBase = nYBase;
	m_nColWidth = nColWidth;
	m_nColHeight = nColHeight;
	m_nMargin  = nMargin;

}
void COrigGmgsData::DrawScale(CDC *pDC)
{
	CPen pen(PS_SOLID, 1, COR_WHITE);
	CPen *pOrgPen = pDC->SelectObject(&pen);
	
	CRect rc;
	rc.top = m_nYBase;
	rc.left = m_nXBase;
	rc.right = m_nXBase + m_nColWidth;
	rc.bottom = m_nYBase + m_nColHeight;
	DrawRect(pDC, rc, RGB(255, 255, 255));
    int i;
	int x, y;
	CString str;
	int   nDataNum = m_arrGmgsPoint.GetSize();
	float fmax = pow(10.0, m_fDataMax);
	float fmin = pow(10.0, m_fDataMin);
	float fScaleY  = (float) m_nColHeight / (nDataNum + 1);

	for(i = 1; i <= nDataNum; i ++)
	{
		x = rc.left;
		y = rc.top + i * fScaleY;
		pDC->MoveTo(x, y);
		if((i % 10) == 0)
			x = x - 15;
		else
			x = x - 10;
    	pDC->LineTo(x, y);
		float value = pow(10.0, m_arrGmgsPoint[i-1].fFreq);
		str.Format("%5.2f", value);
		PutText(TRUE, x - 20, y, 12, 0, str, pDC); 
		
	}
	for(i = 1; i <= nDataNum; i ++)
	{
		x = rc.right;
		y = rc.top + i * fScaleY;
		pDC->MoveTo(x, y);
		if((i % 10) == 0)
			x = x + 15;
		else
			x = x + 10;
    	pDC->LineTo(x, y);
		float value = pow(10.0, m_arrGmgsPoint[i-1].fFreq);
		str.Format("%5.2f", value);
		PutText(TRUE, x + 20, y, 12, 0, str, pDC); 
		
	}
	
	pDC->SelectObject(pOrgPen); 
}

void COrigGmgsData::ClearData()
{
	m_arrGmgsPoint.RemoveAll();
}

⌨️ 快捷键说明

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