|
// DXFNesterDoc.cpp : implementation of the CDXFNesterDoc class
//
#include "stdafx.h"
#include "DXFNester.h"
#include "DXFNesterDoc.h"
#include "dxf.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CDxf m_dxf;
/////////////////////////////////////////////////////////////////////////////
// CDXFNesterDoc
IMPLEMENT_DYNCREATE(CDXFNesterDoc, CDocument)
BEGIN_MESSAGE_MAP(CDXFNesterDoc, CDocument)
//{{AFX_MSG_MAP(CDXFNesterDoc)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CDXFNesterDoc construction/destruction
CDXFNesterDoc::CDXFNesterDoc()
{
// TODO: add one-time construction code here
}
CDXFNesterDoc::~CDXFNesterDoc()
{
}
BOOL CDXFNesterDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CDXFNesterDoc serialization
void CDXFNesterDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
CString str = ar.m_strFileName;
}
else
{
// TODO: add loading code here
CString str = ar.m_strFileName;
if
(
str.GetAt(str.GetLength()-3) == 'd' &&
str.GetAt(str.GetLength()-2) == 'x' &&
str.GetAt(str.GetLength()-1) == 'f'
)
{
//File type is DXF.
m_dxf.Init();
m_dxf.LoadFile(str);
scale = 100;
x_offset = 0;
y_offset = 0;
m_dxf.m_InitialDraw = FALSE;
}
else
{
//File type is not DXF.
MessageBox(NULL,"This is not a DXF file!","File Type Error!",MB_ICONERROR);
}
}
}
/////////////////////////////////////////////////////////////////////////////
// CDXFNesterDoc diagnostics
#ifdef _DEBUG
void CDXFNesterDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CDXFNesterDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CDXFNesterDoc commands
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am an electronics engineer who loves to code on embedded, desktop and web application development.