node.cpp

来自「这是书上的代码」· C++ 代码 · 共 72 行

CPP
72
字号
// Node.cpp: implementation of the CNode class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "const.h"
#include "paintobj.h"
#include "Node.h"

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

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

CNode::CNode()
{
	m_uExtType=120; // Extended type
	m_fHeading=0;//车头方向角(度)
}

CNode::~CNode()
{

}

BOOL CNode::Create(CArchive& ar,USHORT ver)
{
	// Read the node data
	ar >> m_uId >> m_uType;
	if(ver==2)
		ar >> m_uExtType;
	ar >>x >> y;
	if(ver==2)
		ar >> m_fHeading;
	// Success, return TRUE
	return TRUE;
}

BOOL CNode::Save(CArchive& ar,USHORT ver)
{
	// Save the node data
	ar << m_uId << m_uType;
	if(ver==2)
		ar << m_uExtType;
	ar << x << y;
	if(ver==2)
		ar << m_fHeading;
	// Success, return TRUE
	return TRUE;
}


CArchive& operator >> (CArchive& ar, CNode& Obj)
{
	ar >> Obj.m_uId >> Obj.m_uType >> Obj.m_uExtType
		>> Obj.x >> Obj.y >> Obj.m_fHeading;

	return ar;
}

CArchive& operator << (CArchive& ar, CNode& Obj)
{
	ar << Obj.m_uId << Obj.m_uType << Obj.m_uExtType
		<< Obj.x << Obj.y << Obj.m_fHeading;

	return ar;
}

⌨️ 快捷键说明

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