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

📄 lineunit.cpp

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

#include "stdafx.h"
#include "WellDataProcess.h"
#include "LineUnit.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CLineUnit::CLineUnit()
{
	m_bDraw = FALSE;
}

CLineUnit::~CLineUnit()
{

}
void CLineUnit::SetPoint(CPoint pt1, CPoint pt2)
{
	m_pt1 = pt1;
	m_pt2 = pt2;
}

void CLineUnit::SetLineColor(COLORREF color)
{
	m_color = color;
}

void CLineUnit::SetLineStyle(int nLineStyle)
{
	m_nLineStyle = nLineStyle;
}

void CLineUnit::SetLineWidth(int nLineWidth)
{
	m_nLineWidth = nLineWidth;
}

CPoint CLineUnit::GetPointFirst()
{
	return m_pt1;
}

CPoint CLineUnit::GetPointSecond()
{
	return m_pt2;
}

COLORREF CLineUnit::GetLineColor()
{
	return	m_color;
}

int CLineUnit::GetLineStyle()
{
	return m_nLineStyle;
}

int CLineUnit::GetLineWidth()
{
	return m_nLineWidth;
}

void CLineUnit::Draw(CDC *pDC)
{
	if(m_bDraw)
	{
	//	int nMode = pDC->SetROP2(R2_NOTXORPEN);
		COLORREF color = RGB(255,0,0);
		if (m_bSelect)
			color = RGB(255, 255,255);
		CPen pen(PS_SOLID,2,color);
		CPen* pOldPen = pDC->SelectObject (&pen);

		pDC->MoveTo(m_pt1);
		pDC->LineTo (m_pt2);

		pDC->SelectObject (pOldPen);
	//	pDC->SetROP2(nMode);
	}
}

BOOL CLineUnit::HitTest(CPoint point)
{
	if(point.x > m_pt1.x && point.x < m_pt2.x && point.y < m_pt1.y + 3 && point.y > m_pt1.y - 3)
	{
		m_bSelect = TRUE;
		return TRUE;
	}
	m_bSelect = FALSE;
	return FALSE;
}

void CLineUnit::SetIsDraw(BOOL	bDraw)
{
	m_bDraw = bDraw;
}

void CLineUnit::SetYPos(int y)
{
	m_pt1.y = y;
	m_pt2.y = y;
}

int CLineUnit::GetYPos()
{
	return m_pt1.y;
}

void CLineUnit::SetRoad(CRoadUnit *pRoadUnit)
{
	m_pt1.x = pRoadUnit->GetOrgPoint().x;
	m_pt2.x = pRoadUnit->GetOrgPoint().x + pRoadUnit->GetRoadWidth(); 
}

⌨️ 快捷键说明

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