www.gusucode.com > VC++开源的SHP格式GIS地图查看软件源程序源码程序 > VC++开源的SHP格式GIS地图查看软件源程序源码程序\code\MapRectangle.cpp

    //Download by http://www.NewXing.com
#include "stdafx.h"
#include "MapRectangle.h"


CMapRectangle::CMapRectangle()
{
	m_dbLeft = 0.0;
	m_dbRight = 0.0;
	m_dbTop = 0.0;
	m_dbBottom = 0.0;   


}


CMapRectangle::CMapRectangle(CMapRectangle& MapRectangle )
{

	m_dbLeft = MapRectangle.m_dbLeft;
	m_dbRight = MapRectangle.m_dbRight;
	m_dbTop = MapRectangle.m_dbTop;
	m_dbBottom = MapRectangle.m_dbBottom;   


}

CMapRectangle::~CMapRectangle()
{


}

BOOL CMapRectangle::IsPointIn(CMapPoint& point)
{

    if ( min(m_dbLeft,m_dbRight) < point.GetX()  && point.GetX()<max(m_dbLeft,m_dbRight)
		 && min(m_dbTop,m_dbBottom) < point.GetX()  && point.GetY()<max(m_dbTop,m_dbBottom))
	    return TRUE;
	else
		return FALSE;

}

BOOL CMapRectangle::IsInsercet(CMapRectangle& rc)
{
	if (m_dbRight < rc.GetLeft() || m_dbLeft > rc.GetRight()
		|| m_dbTop > rc.GetBottom() || m_dbBottom < rc.GetTop() )
		return FALSE;
	else
		return TRUE;

}