📄 layerrectunit.cpp
字号:
// LayerRectUnit.cpp: implementation of the CLayerRectUnit class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "WellDataProcess.h"
#include "LayerRectUnit.h"
#include "GlobalData.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CLayerRectUnit::CLayerRectUnit()
{
}
CLayerRectUnit::~CLayerRectUnit()
{
}
CLayerRectUnit::operator =(const CLayerRectUnit& other)
{
m_color = other.m_color;
m_rectLayer = other.m_rectLayer;
m_fMeanValue = other.m_fMeanValue;
}
void CLayerRectUnit::SetColor(COLORREF color)
{
m_color = color;
}
void CLayerRectUnit::SetRectValue(CRect rect)
{
m_rectLayer = rect;
}
CRect CLayerRectUnit::GetLayerRect()
{
return m_rectLayer;
}
COLORREF CLayerRectUnit::GetLayerColor()
{
return m_color;
}
int CLayerRectUnit::GetTopPosition()
{
return m_rectLayer.top;
}
int CLayerRectUnit::GetBottomPosition()
{
return m_rectLayer.bottom;
}
void CLayerRectUnit::SetMeanValue(float fMeanValue)
{
m_fMeanValue = fMeanValue;
}
float CLayerRectUnit::GetMeanValue()
{
return m_fMeanValue;
}
BOOL CLayerRectUnit::HitTest(CPoint point)
{
int x = point.x;
int y = point.y;
int x0 = m_rectLayer.left;
int y0 = m_rectLayer.top + 3;
int x1 = m_rectLayer.right;
int y1 = m_rectLayer.bottom - 3;
if (x < x1 && x > x0 && y < y1 && y > y0)
{
m_bSelect = TRUE;
return TRUE;
}
m_bSelect = FALSE;
return FALSE;
}
void CLayerRectUnit::OffsetTop(int dx,int dy)
{
m_rectLayer.top += dy;
}
void CLayerRectUnit::OffsetBottom(int dx,int dy)
{
m_rectLayer.bottom += dy;
}
CLayerRectUnit::CLayerRectUnit(COLORREF color, float fMeanValue, CRect rectLayer)
{
m_color = color;
m_fMeanValue = fMeanValue;
m_rectLayer = rectLayer;
}
void CLayerRectUnit::Draw(CDC *pDC)
{
COLORREF color;
if(m_bSelect)
color = RGB(255, 255, 255);
else
color = m_color;
DrawRect(pDC, m_rectLayer, color);
EraseRect(pDC, m_rectLayer, color);
CString str;
str.Format("%7.2f", m_fMeanValue);
PutText(TRUE, m_rectLayer.right + 12, m_rectLayer.top + m_rectLayer.Height() / 2, 12, 0, str, pDC);
}
void CLayerRectUnit::SetTopPosition(int nTopPos)
{
m_rectLayer.top = nTopPos;
}
void CLayerRectUnit::SetBottomPosition(int nBottomPos)
{
m_rectLayer.bottom = nBottomPos;
}
void CLayerRectUnit::SetMiddleLine(int nXMiddlePos)
{
int nHalfWidth = m_rectLayer.Width() / 2;
m_rectLayer.left = nXMiddlePos - nHalfWidth;
m_rectLayer.right = nXMiddlePos + nHalfWidth;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -