/
GeometryProcDoc.cpp
103 lines (76 loc) · 1.71 KB
/
GeometryProcDoc.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include "stdafx.h"
#ifndef SHARED_HANDLERS
#include "GeometryProc.h"
#endif
#include "GeometryProcDoc.h"
#include <propkey.h>
#include <chrono>
#include <ctime>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CGeometryProcDoc
IMPLEMENT_DYNCREATE(CGeometryProcDoc, CDocument)
BEGIN_MESSAGE_MAP(CGeometryProcDoc, CDocument)
END_MESSAGE_MAP()
CGeometryProcDoc::CGeometryProcDoc()
{
//View Function
m_BackGroundColor = CHANGE_LIGHT_BLUE;
m_ShaderModel = PLANE_SHADER;
}
CGeometryProcDoc::~CGeometryProcDoc()
{
}
BOOL CGeometryProcDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
return TRUE;
}
BOOL CGeometryProcDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
CString fn = lpszPathName;
char* filename = NULL;
auto UnicodeToAnsi = [](char** file, CString& fn)
{
int P_Length = fn.GetLength();
int nBytes = WideCharToMultiByte(CP_ACP, 0, fn, P_Length, NULL, 0, NULL, NULL);
*file = new char[nBytes + 1];
memset(*file, 0, P_Length + 1);
WideCharToMultiByte(CP_OEMCP, 0, fn, P_Length, *file, nBytes, NULL, NULL);
};
UnicodeToAnsi(&filename, fn);
string filecheck(filename);
filecheck = filecheck.substr(filecheck.size()-4);
std::transform(filecheck.begin(), filecheck.end(), filecheck.begin(), tolower);
if (filecheck == (".stl"))
{
TriMesh* mesh = NULL;
mesh = TriMesh::read_stl_helper(filename);
mesh->need_bbox();
meshes.push_back(mesh);
Current_mesh = meshes.size() - 1;
return TRUE;
}
return FALSE;
}
void CGeometryProcDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
}
else
{
}
}
#ifdef _DEBUG
void CGeometryProcDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CGeometryProcDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG