-
Notifications
You must be signed in to change notification settings - Fork 0
/
GeometryElement.cpp
87 lines (60 loc) · 1.64 KB
/
GeometryElement.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
#include "stdafx.h"
#include "GeometryElement.h"
GeometryElement::GeometryElement()
{
elemMesh = NULL;
}
GeometryElement::~GeometryElement()
{
SAFE_DELETE(elemMesh);
ClearVector( vecElemExtra );
}
void GeometryElement::ReadNode(const DOMNode* node)
{
_ASSERTE(node != NULL);
ReadAttributes( node );
DOMNode* currentNode = node->getFirstChild();
while( currentNode != NULL )
{
#if _DEBUG // デバッグ時に名前をチェックする為に
const XMLCh* name = currentNode->getNodeName();
#endif
if( IsElementNode( currentNode ) )
{
if( Is_mesh_NodeName( currentNode ) )
{
_ASSERTE(elemMesh == NULL); // 必ず1つ存在するのでこの時点ではNULL
elemMesh = new MeshElement();
elemMesh->ReadNode( currentNode );
}
else if( Is_extra_NodeName( currentNode ) )
{
ExtraElement* elemExtra = new ExtraElement();
elemExtra->ReadNode( currentNode );
vecElemExtra.push_back( elemExtra );
}
}
currentNode = currentNode->getNextSibling(); // 次の要素を処理する
}
}
bool GeometryElement::ValidElements(std::wstring& message) const
{
std::wstring str;
if( elemMesh != NULL ) { elemMesh->ValidElements( str ); }
else { str += L"<mesh>要素が存在しません\n"; }
ValidElementsInContainer( vecElemExtra, str );
if( str.empty() == false )
{
InsertTabEachLine( str );
message += L"<geometry>要素にエラーがあります\n" + str;
}
return str.empty();
}
void GeometryElement::ReadAttributes(const DOMNode* node)
{
_ASSERTE(node != NULL);
DOMNamedNodeMap* attr = node->getAttributes();
if( attr == NULL ) { return; }
SetStringValue( attrId, Get_id_Attribute( attr ) );
SetStringValue( attrName, Get_name_Attribute( attr ) );
}