Starshatter_Open
Open source Starshatter engine
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
SurfacePropertiesDialog.cpp
Go to the documentation of this file.
1
// SurfacePropertiesDialog.cpp : implementation file
2
//
3
4
#include "
stdafx.h
"
5
#include "
Magic.h
"
6
#include "
MagicDoc.h
"
7
#include "
MagicView.h
"
8
#include "
Solid.h
"
9
#include "
SurfacePropertiesDialog.h
"
10
11
#ifdef _DEBUG
12
#define new DEBUG_NEW
13
#undef THIS_FILE
14
static
char
THIS_FILE[] = __FILE__;
15
#endif
16
18
// SurfacePropertiesDialog dialog
19
20
21
SurfacePropertiesDialog::SurfacePropertiesDialog
(
MagicView
* pParent
/*=NULL*/
)
22
: CDialog(
SurfacePropertiesDialog
::IDD, pParent), doc(0)
23
{
24
//{{AFX_DATA_INIT(SurfacePropertiesDialog)
25
mSurfaceName
= _T(
""
);
26
mNumPolys
= _T(
""
);
27
mNumVerts
= _T(
""
);
28
mSurfaceHeight
= _T(
""
);
29
mSurfaceLength
= _T(
""
);
30
mSurfaceRadius
= _T(
""
);
31
mSurfaceWidth
= _T(
""
);
32
//}}AFX_DATA_INIT
33
34
if
(pParent) {
35
doc
= pParent->
GetDocument
();
36
37
if
(
doc
&&
doc
->
GetSolid
()) {
38
Model
* model =
doc
->
GetSolid
()->
GetModel
();
39
Surface
* surface = model->
GetSurfaces
().
first
();
40
Point
plus;
41
Point
minus;
42
43
surface->
GetVertexSet
()->
CalcExtents
(plus, minus);
44
45
char
buffer[256];
46
strcpy_s(buffer, surface->
Name
());
47
mSurfaceName
= buffer;
48
49
sprintf_s(buffer,
"%d"
, surface->
NumPolys
());
50
mNumPolys
= buffer;
51
52
sprintf_s(buffer,
"%d"
, surface->
NumVerts
());
53
mNumVerts
= buffer;
54
55
sprintf_s(buffer,
"%.1f"
, surface->
Radius
());
56
mSurfaceRadius
= buffer;
57
58
sprintf_s(buffer,
"%.1f (%.1f - %.1f)"
, plus.
z
-minus.
z
, minus.
z
, plus.
z
);
59
mSurfaceLength
= buffer;
60
61
sprintf_s(buffer,
"%.1f (%.1f - %.1f)"
, plus.
x
-minus.
x
, minus.
x
, plus.
x
);
62
mSurfaceWidth
= buffer;
63
64
sprintf_s(buffer,
"%.1f (%.1f - %.1f)"
, plus.
y
-minus.
y
, minus.
y
, plus.
y
);
65
mSurfaceHeight
= buffer;
66
}
67
}
68
}
69
70
71
void
SurfacePropertiesDialog::DoDataExchange
(CDataExchange* pDX)
72
{
73
CDialog::DoDataExchange
(pDX);
74
//{{AFX_DATA_MAP(SurfacePropertiesDialog)
75
DDX_CBString(pDX,
IDC_SURFACE_NAME
,
mSurfaceName
);
76
DDX_Text(pDX,
IDC_SURFACE_NPOLYS
,
mNumPolys
);
77
DDX_Text(pDX,
IDC_SURFACE_NVERTS
,
mNumVerts
);
78
DDX_Text(pDX,
IDC_SURFACE_HEIGHT
,
mSurfaceHeight
);
79
DDX_Text(pDX,
IDC_SURFACE_LENGTH
,
mSurfaceLength
);
80
DDX_Text(pDX,
IDC_SURFACE_RADIUS
,
mSurfaceRadius
);
81
DDX_Text(pDX,
IDC_SURFACE_WIDTH
,
mSurfaceWidth
);
82
//}}AFX_DATA_MAP
83
}
84
85
86
BEGIN_MESSAGE_MAP(
SurfacePropertiesDialog
, CDialog)
87
//{{AFX_MSG_MAP(SurfacePropertiesDialog)
88
// NOTE: the ClassWizard will add message map macros here
89
//}}AFX_MSG_MAP
90
END_MESSAGE_MAP()
91
93
// SurfacePropertiesDialog message handlers
Magic2
SurfacePropertiesDialog.cpp
Generated on Tue Jun 5 2012 20:46:16 for Starshatter_Open by
1.8.1