⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pathplandoc.cpp

📁 实现了波兰式的求解
💻 CPP
字号:
// PathPlanDoc.cpp : implementation of the CPathPlanDoc class
//

#include "stdafx.h"
#include "PathPlan.h"

#include "PathPlanDoc.h"
#include "MyPathPlanning.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPathPlanDoc

IMPLEMENT_DYNCREATE(CPathPlanDoc, CDocument)

BEGIN_MESSAGE_MAP(CPathPlanDoc, CDocument)
	//{{AFX_MSG_MAP(CPathPlanDoc)
	ON_COMMAND(ID_MPATHPLANNING, OnPathPlanning)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPathPlanDoc construction/destruction

CPathPlanDoc::CPathPlanDoc()
{
	// TODO: add one-time construction code here
	int i;
	for(i=0; i<11; i++)
	{
		VerPoint[i].x = 0;
		VerPoint[i].y = 0;
	}
	for(i=0; i<11; i++)
	{
		HorPoint[i].x = 0;
		HorPoint[i].y = 0;
	}
	for(i=0; i<100; i++)
		Barrier[i] = 0;
	nBarrierNum = 0;
	nPathLength = 0;

}

CPathPlanDoc::~CPathPlanDoc()
{
}

BOOL CPathPlanDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CPathPlanDoc serialization

void CPathPlanDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CPathPlanDoc diagnostics

#ifdef _DEBUG
void CPathPlanDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CPathPlanDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CPathPlanDoc commands



int CPathPlanDoc::GetRectID(POINT point)
{
	int i;
	int col,row;
	for(i=0; i<11; i++)
	{
		if(VerPoint[i].x >= point.x)
		{
			col = i-1;
			break;
		}
	}
	for(i=0; i<11; i++)
	{
		if(HorPoint[i].y >= point.y)
		{
			row = i-1;
			break;
		}
	}
	return row * 10 + col;

}



void CPathPlanDoc::OnPathPlanning() 
{
	// TODO: Add your command handler code here
	int m = 10;
	int n = 3;
	int tempbarrier[50];
	nBarrierNum = 0;
	for(int i=0; i<100; i++)
	{
		if(Barrier[i] == 1)
		{
			tempbarrier[nBarrierNum++] = i;
		}
	}
	Initial(tempbarrier,nBarrierNum);
	PathPlanning(m,n,PathNode,nPathLength);
	UpdateAllViews(NULL);
}

⌨️ 快捷键说明

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