📄 circle.cpp
字号:
// Circle.cpp: implementation of the Circle class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "PainterUsePattern.h"
#include "Circle.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//=================================================================
//
//=================================================================
Circle::Circle()
{
}
Circle::~Circle()
{
}
//=================================================================
//接受访问者方法;
//=================================================================
void Circle::Accept( AbstractVisitor& v , CDC* pDC )
{
v.VisitCircle( this , pDC );
}
//=================================================================
//检测点p是否在圆显示区域内;
//=================================================================
bool Circle::Intersects( CPoint p )
{
int offsetX = ( p.x > m_centrePoint.x )?(p.x - m_centrePoint.x):(m_centrePoint.x - p.x );
int offsetY = ( p.y > m_centrePoint.y )?(p.y - m_centrePoint.y):(m_centrePoint.y - p.y );
if( offsetX <= m_radix && offsetY <= m_radix )
return true;
return false;
}
//=================================================================
//设置圆位置的偏移量;
//=================================================================
void Circle::SetOffset( int offsetX , int offsetY )
{
m_centrePoint.x += offsetX;
m_centrePoint.y += offsetY;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -