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

📄 vcaddoc.cpp

📁 通过可执行文件中的菜单“绘图”
💻 CPP
字号:
// VCadDoc.cpp : implementation of the CVCadDoc class
//

#include "stdafx.h"
#include "MainFrm.h"
#include "VCad.h"
#include "VCadDoc.h"
#include "Entity.h"
#include "VCadView.h"


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

/////////////////////////////////////////////////////////////////////////////
// CVCadDoc

IMPLEMENT_DYNCREATE(CVCadDoc, CDocument)

BEGIN_MESSAGE_MAP(CVCadDoc, CDocument)
	//{{AFX_MSG_MAP(CVCadDoc)
		// 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()

/////////////////////////////////////////////////////////////////////////////
// CVCadDoc construction/destruction

CVCadDoc::CVCadDoc()
{
	// TODO: add one-time construction code here
	g_pDoc = this;
}

CVCadDoc::~CVCadDoc()
{
}

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

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

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CVCadDoc serialization

void CVCadDoc::Serialize(CArchive& ar)
{
	m_EntityList.Serialize(ar);
}

/////////////////////////////////////////////////////////////////////////////
// CVCadDoc diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CVCadDoc commands
void CVCadDoc::Draw(CDC *pDC)
{
	// 绘制链表中的图元
	POSITION	pos = m_EntityList.GetHeadPosition();
	while(pos!=NULL)
	{
		CEntity*	pEntity = (CEntity *) m_EntityList.GetNext(pos);
		pEntity->Draw(pDC, dmNormal);
	}
}


void CVCadDoc::DeleteContents() 
{
	// 清除图元链表中的图元对象
	POSITION	pos = m_EntityList.GetHeadPosition();
	while(pos!=NULL)
	{
		CEntity*	pEntity = (CEntity *) m_EntityList.GetNext(pos);
		delete pEntity ;
	}
	m_EntityList.RemoveAll() ;
	
	CDocument::DeleteContents();
}

⌨️ 快捷键说明

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