示例#1
1
void  MyCircle::draw(CDC& dc)const
{
	if (enable)
	if (isPoint())
	{
		return ;
	}
	else
	{
		CPen pen(m_style,m_width,m_clr); 
		CPen *penOld = dc.SelectObject( &pen ); 
		dc.SelectStockObject(NULL_BRUSH);   
		
		int r = (int)sqrt((_x1-_x2)*(_x1-_x2)+(_y1-_y2)*(_y1-_y2));
		dc.Ellipse(_x1-r,_y1-r,_x1+r,_y1+r);

		dc.SelectObject(penOld);
		pen.DeleteObject();
	}
}
示例#2
0
文件: rect.cpp 项目: Khalefa/flamingo
double KNNDis(struct Point *point, struct Rect *rect,int dist_func)
{

	if(isPoint(rect))
	{
		Point p = Center(rect);
		return Distance(point,&p, dist_func);
	}
	else return Distance (point, rect, dist_func);
}
示例#3
0
void MyLine::draw(CDC& dc)const
{
	if (enable)
	{
		if (isPoint())
		{
			MyPoint p;
			p.draw(dc);
			return;
		}
		CPen pen(m_style,m_width,m_clr); 
		CPen *penOld = dc.SelectObject( &pen ); 
	
		dc.MoveTo(_x1,_y1);
		dc.LineTo(_x2,_y2);

		dc.SelectObject(penOld);
		pen.DeleteObject();
	}
}
示例#4
0
文件: Line.hpp 项目: psyllo/misc
 bool isHorizontal() { return (!isPoint() && y1 == y2); }
示例#5
0
文件: Line.hpp 项目: psyllo/misc
 bool isVertical() { return (!isPoint() && x1 == x2); }