www.pudn.com > MyCAD.rar > MyCADDoc.cpp


// MyCADDoc.cpp : implementation of the CMyCADDoc class 
// 
 
#include "stdafx.h" 
#include "MyCAD.h" 
 
#include "MyCADDoc.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CMyCADDoc 
 
IMPLEMENT_DYNCREATE(CMyCADDoc, CDocument) 
 
BEGIN_MESSAGE_MAP(CMyCADDoc, CDocument) 
	//{{AFX_MSG_MAP(CMyCADDoc) 
		// 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() 
 
///////////////////////////////////////////////////////////////////////////// 
// CMyCADDoc construction/destruction 
 
CMyCADDoc::CMyCADDoc() 
{ 
	// TODO: add one-time construction code here 
	this->m_nPointNum = 0; 
	this->m_nLineNum = 0; 
} 
 
CMyCADDoc::~CMyCADDoc() 
{ 
} 
 
BOOL CMyCADDoc::OnNewDocument() 
{ 
	if (!CDocument::OnNewDocument()) 
		return FALSE; 
 
	// TODO: add reinitialization code here 
	// (SDI documents will reuse this document) 
	this->m_nPointNum = 0;	//初始化点数为0 
	this->m_nLineNum = 0;	//初始化线段数为0 
 
	return TRUE; 
} 
 
 
 
///////////////////////////////////////////////////////////////////////////// 
// CMyCADDoc serialization 
 
void CMyCADDoc::Serialize(CArchive& ar) 
{ 
	if (ar.IsStoring()) 
	{ 
		// TODO: add storing code here 
		ar<>m_nPointNum;   // 首先读出总的点数 
		for(int i=0;i>m_Point[i][0]>>m_Point[i][1]; 
		} 
 
		ar>>m_nLineNum;   // 读出线段数目 
		for( i=0;i>m_Line[i][0]>>m_Line[i][1] 
				>>m_Line[i][2]>>m_Line[i][3]; 
		} 
	} 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CMyCADDoc diagnostics 
 
#ifdef _DEBUG 
void CMyCADDoc::AssertValid() const 
{ 
	CDocument::AssertValid(); 
} 
 
void CMyCADDoc::Dump(CDumpContext& dc) const 
{ 
	CDocument::Dump(dc); 
} 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CMyCADDoc commands 
 
void CMyCADDoc::DeleteContents()  
{ 
	// TODO: Add your specialized code here and/or call the base class 
	this->m_nPointNum = 0;	//清除文档中的数据 
	this->m_nLineNum = 0;	//清除文档中的数据 
 
	CDocument::DeleteContents(); 
}