www.pudn.com > 2DCAD_duojiemian.rar > 2DCADDoc.cpp


// 2DCADDoc.cpp : implementation of the CMy2DCADDoc class 
// 
 
#include "stdafx.h" 
#include "2DCAD.h" 
 
#include "2DCADDoc.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CMy2DCADDoc 
 
IMPLEMENT_DYNCREATE(CMy2DCADDoc, CDocument) 
 
BEGIN_MESSAGE_MAP(CMy2DCADDoc, CDocument) 
	//{{AFX_MSG_MAP(CMy2DCADDoc) 
		// 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() 
 
///////////////////////////////////////////////////////////////////////////// 
// CMy2DCADDoc construction/destruction 
 
CMy2DCADDoc::CMy2DCADDoc() 
{ 
	// TODO: add one-time construction code here 
	m_nPointNum=0; 
	m_nLineNum=0; 
} 
 
CMy2DCADDoc::~CMy2DCADDoc() 
{ 
} 
 
BOOL CMy2DCADDoc::OnNewDocument() 
{ 
	if (!CDocument::OnNewDocument()) 
		return FALSE; 
 
	// TODO: add reinitialization code here 
	// (SDI documents will reuse this document) 
	m_nLineNum=0; 
	m_nPointNum=0; 
 
	return TRUE; 
} 
 
 
 
///////////////////////////////////////////////////////////////////////////// 
// CMy2DCADDoc serialization 
 
void CMy2DCADDoc::Serialize(CArchive& ar) 
{ 
	if (ar.IsStoring()) 
	{ 
		// TODO: add storing code here 
		ar<>m_nPointNum; 
		for(int i=0;i>m_nPoint[i][0]>>m_nPoint[i][1]; 
		} 
 
		ar>>m_nLineNum; 
		for(i=0;i>m_nLine[i][0]>>m_nLine[i][1] 
				>>m_nLine[i][2]>>m_nLine[i][3]; 
		} 
	} 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CMy2DCADDoc diagnostics 
 
#ifdef _DEBUG 
void CMy2DCADDoc::AssertValid() const 
{ 
	CDocument::AssertValid(); 
} 
 
void CMy2DCADDoc::Dump(CDumpContext& dc) const 
{ 
	CDocument::Dump(dc); 
} 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CMy2DCADDoc commands 
 
void CMy2DCADDoc::DeleteContents()  
{ 
	// TODO: Add your specialized code here and/or call the base class 
	m_nLineNum=0; 
	m_nPointNum=0; 
	CDocument::DeleteContents(); 
}