stldoc.cpp

来自「快速原型制造分层切片源代码,适用于高温合金.」· C++ 代码 · 共 105 行

CPP
105
字号
// StlDoc.cpp : implementation of the CStlDoc class
//

#include "stdafx.h"
#include "SlsPrj.h"

#include "StlDoc.h"
#include "MainFrm.h"

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

/////////////////////////////////////////////////////////////////////////////
// CStlDoc

IMPLEMENT_DYNCREATE(CStlDoc, CDocument)

BEGIN_MESSAGE_MAP(CStlDoc, CDocument)
	//{{AFX_MSG_MAP(CStlDoc)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CStlDoc construction/destruction

CStlDoc::CStlDoc()
{
}

CStlDoc::~CStlDoc()
{
}

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

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CStlDoc serialization

void CStlDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		m_pathData.m_Solid.WriteArchive( ar );		
	}
	else
	{
		m_initFileName = (ar.GetFile())->GetFilePath();
		m_pathData.Initialize(m_initFileName);
		ShowEntityInfo();
	}
}

/////////////////////////////////////////////////////////////////////////////
// CStlDoc diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CStlDoc commands

void CStlDoc::ShowEntityInfo()
{
	CSlsApp* pSlsApp = ( CSlsApp* )AfxGetApp();
	CMainFrame* pMainWnd = ( CMainFrame* )pSlsApp->m_pMainWnd;
	CDialogBar* pBar = (&pMainWnd->m_wndEntityDialogBar);

	pSlsApp->m_startHeight = 0;
	pSlsApp->m_endHeight = (int((m_pathData.m_Solid.m_zMax-m_pathData.m_Solid.m_zMin)*100))/100.0;
	pSlsApp->m_pPathData = &m_pathData;

	double entityLength, entityWidth, entityHeight;
	CString strEntityLength, strEntityWidth, strEntityHeight;
	entityLength = m_pathData.m_Solid.m_xMax - m_pathData.m_Solid.m_xMin;
	entityWidth = m_pathData.m_Solid.m_yMax - m_pathData.m_Solid.m_yMin;
	entityHeight= m_pathData.m_Solid.m_zMax - m_pathData.m_Solid.m_zMin;

	strEntityLength.Format("%7.2f", entityLength);
	strEntityWidth.Format("%7.2f", entityWidth);
	strEntityHeight.Format("%7.2f", entityHeight);
	pBar->SetDlgItemText(IDC_ENTITY_LENGTH, strEntityLength);
	pBar->SetDlgItemText(IDC_ENTITY_WIDTH, strEntityWidth);
	pBar->SetDlgItemText(IDC_ENTITY_HEIGHT, strEntityHeight);
}

⌨️ 快捷键说明

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