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

📄 visiondoc.cpp

📁 FIRA 3对3 机器人足球PC端控制程序。
💻 CPP
字号:
//////////////// ROBOT SOCCER PROGRAM //////////////////
//////////////// By Kim Heung Soo     //////////////////
//////////////// IC Lab. 98. 8. 2.    //////////////////

// VisionDoc.cpp : implementation of the CVisionDoc class
//

#include "stdafx.h"
#include "Vision.h"

#include "VisionDoc.h"
#include "VisionView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CVisionDoc

IMPLEMENT_DYNCREATE(CVisionDoc, CDocument)

BEGIN_MESSAGE_MAP(CVisionDoc, CDocument)
	//{{AFX_MSG_MAP(CVisionDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CVisionDoc construction/destruction

CVisionDoc::CVisionDoc()
{
	// TODO: add one-time construction code here

}

CVisionDoc::~CVisionDoc()
{
}

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

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)
		// Set buffer attributes
	if(((CVisionApp*)AfxGetApp())->NumberOfDigitizer)
		BufferAttributes=M_IMAGE+M_DISP+M_GRAB;
	else
		BufferAttributes=M_IMAGE+M_DISP+M_PROC;
	// Set SizeX and SizeY variables
	if(((CVisionApp*)AfxGetApp())->NumberOfDigitizer) {
		((CVisionApp*)AfxGetApp())->SizeX = ((CVisionApp*)AfxGetApp())->DigSizeX;
		((CVisionApp*)AfxGetApp())->SizeY = ((CVisionApp*)AfxGetApp())->DigSizeY;
	}

	/*
	*ptrImageBuf = ImageBuf;
		
	// Allocate a buffer
	MbufCreateColor(	((CVisionApp*)AfxGetApp())->MilSystem,
					((CVisionApp*)AfxGetApp())->Band,
					((CVisionApp*)AfxGetApp())->SizeX,
					((CVisionApp*)AfxGetApp())->SizeY,
					M_DEF_IMAGE_TYPE,
					BufferAttributes,
					M_PHYSICAL_ADDRESS+M_PITCH_BYTE,
					M_DEFAULT,
					(void **)ptrImageBuf,
					&MilImage1);
	*/
	// Allocate a buffer
	MbufAllocColor(	((CVisionApp*)AfxGetApp())->MilSystem,
					((CVisionApp*)AfxGetApp())->Band,
					((CVisionApp*)AfxGetApp())->SizeX,
					((CVisionApp*)AfxGetApp())->SizeY,
					M_DEF_IMAGE_TYPE,
					BufferAttributes,
					&MilImage);
		
	// If not able to allocate a buffer, do not create a new document
	if(!MilImage)
		return FALSE;
	// Clear the buffer 
	MbufClear(MilImage,0);

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CVisionDoc serialization

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

/////////////////////////////////////////////////////////////////////////////
// CVisionDoc diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CVisionDoc commands

void CVisionDoc::OnCloseDocument() 
{
	// TODO: Add your specialized code here and/or call the base class
	// MIL: Write code that will be executed when a document is closed
	// Halt the grab, deselected the display, free the display and the image buffer
	// only if MbufAlloc was successful
	if (MilImage)
	{
		CVisionView*	CurView;
		POSITION	CurPos;
		// Make sure all views displays are deselected and grab is halt
		CurPos = GetFirstViewPosition();
		while(CurView = (CVisionView *)GetNextView(CurPos))
			CurView->RemoveFromDisplay();
		// Free image buffer
		MbufFree(MilImage);
	}
	
	CDocument::OnCloseDocument();
}

⌨️ 快捷键说明

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