obstacle.cpp

来自「多机器人合作中的动态角色分配仿真算法是多机器人合作领域的一个比较著名的仿真软件」· C++ 代码 · 共 94 行

CPP
94
字号
//////////////////////////////////////////////////////////////////////
// MuRoS - Multi Robot Simulator
//
// Luiz Chaimowicz
// GRASP Lab. University of Pennsylvania
// VERLab - DCC - UFMG - Brasil
//
// Obstacle.cpp: implementation of the CObstacle class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "simulator.h"
#include "Obstacle.h"
#include "const.h"
#include <math.h>

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

IMPLEMENT_SERIAL( CObstacle, CObject, 1 )

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

CObstacle::CObstacle()
{
	m_erased = FALSE;
	m_inRange = FALSE;
	m_visited = TRUE;

	m_angle = 0;
	m_dist = 0;
}

// Function used by the copy constructors
void CObstacle::SetObstacle(const CObstacle *obst)
{
	m_rect = obst->m_rect;
	m_center = obst->m_center;
	m_radius = obst->m_radius;
	
	m_erased = obst->m_erased;
	m_inRange = FALSE;
	m_visited = FALSE;

	m_angle = 0;
	m_dist = 0;
}


CObstacle::~CObstacle()
{

}

void CObstacle::Serialize(CArchive& ar)
{
	CObject::Serialize(ar); // Base class method

	if (ar.IsStoring()) {
		ar << m_rect;
		ar << m_center;
		ar << m_radius;

		ar << m_erased;
		ar << m_inRange;
		ar << m_visited;

		ar << m_dist;
		ar << m_angle;
	}
	else {
		ar >> m_rect;
		ar >> m_center;
		ar >> m_radius;

		ar >> m_erased;
		ar >> m_inRange;
		ar >> m_visited;

		ar >> m_dist;
		ar >> m_angle;
	}
}

void CObstacle::Draw(CDC* pDC, BOOL drawErased)
{
}

⌨️ 快捷键说明

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