7fd59977 |
1 | //-------------------------------------------------------------------- |
2 | // |
3 | // File Name : IGESSolid_VertexList.cxx |
4 | // Date : |
5 | // Author : CKY / Contract Toubro-Larsen |
6 | // Copyright : MATRA-DATAVISION 1993 |
7 | // |
8 | //-------------------------------------------------------------------- |
9 | |
10 | #include <IGESSolid_ToolVertexList.ixx> |
11 | #include <IGESData_ParamCursor.hxx> |
12 | #include <gp_XYZ.hxx> |
13 | #include <gp_Pnt.hxx> |
14 | #include <TColgp_HArray1OfXYZ.hxx> |
15 | #include <IGESData_Dump.hxx> |
16 | #include <Interface_Macros.hxx> |
17 | |
18 | // MGE 03/08/98 |
19 | #include <Message_Msg.hxx> |
20 | |
21 | |
22 | //======================================================================= |
23 | //function : IGESSolid_ToolVertexList |
24 | //purpose : |
25 | //======================================================================= |
26 | |
27 | IGESSolid_ToolVertexList::IGESSolid_ToolVertexList () |
28 | { |
29 | } |
30 | |
31 | |
32 | //======================================================================= |
33 | //function : ReadOwnParams |
34 | //purpose : |
35 | //======================================================================= |
36 | |
37 | void IGESSolid_ToolVertexList::ReadOwnParams(const Handle(IGESSolid_VertexList)& ent, |
38 | const Handle(IGESData_IGESReaderData)& /* IR */, |
39 | IGESData_ParamReader& PR) const |
40 | { |
41 | // MGE 03/08/98 |
42 | // Building of messages |
43 | //======================================== |
44 | // Message_Msg Msg182("XSTEP_182"); |
45 | // Message_Msg Msg183("XSTEP_183"); |
46 | //======================================== |
47 | |
48 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
49 | Standard_Integer nbitems = 0; //szv#4:S4163:12Mar99 `i` moved in for |
50 | //gp_XYZ anXYZ; //szv#4:S4163:12Mar99 moved down |
51 | Handle(TColgp_HArray1OfXYZ) tempVertices; |
52 | |
53 | //st = PR.ReadInteger(PR.Current(), Msg182, nbitems); //szv#4:S4163:12Mar99 moved in if |
54 | //st = PR.ReadInteger(PR.Current(), "Number of Vertices", nbitems); |
55 | Standard_Boolean sb = PR.ReadInteger(PR.Current(), nbitems); |
56 | if (sb && (nbitems > 0)) { |
57 | |
58 | Message_Msg Msg183("XSTEP_183"); |
59 | |
60 | tempVertices = new TColgp_HArray1OfXYZ(1, nbitems); |
61 | |
62 | gp_XYZ anXYZ; |
63 | for (Standard_Integer i = 1; i <= nbitems; i++) |
64 | { |
65 | //st = PR.ReadXYZ(PR.CurrentList(1, 3), Msg183, anXYZ); //szv#4:S4163:12Mar99 moved in if |
66 | //st = PR.ReadXYZ(PR.CurrentList(1, 3), "Vertices", anXYZ); |
67 | if (PR.ReadXYZ(PR.CurrentList(1, 3), Msg183, anXYZ)) |
68 | tempVertices->SetValue(i, anXYZ); |
69 | } |
70 | } |
71 | else { |
72 | Message_Msg Msg182("XSTEP_182"); |
73 | PR.SendFail(Msg182); |
74 | } |
75 | |
76 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
77 | if (nbitems > 0) ent->Init (tempVertices); |
78 | } |
79 | |
80 | |
81 | //======================================================================= |
82 | //function : WriteOwnParams |
83 | //purpose : |
84 | //======================================================================= |
85 | |
86 | void IGESSolid_ToolVertexList::WriteOwnParams(const Handle(IGESSolid_VertexList)& ent, |
87 | IGESData_IGESWriter& IW) const |
88 | { |
89 | Standard_Integer nbitems = ent->NbVertices(); |
90 | Standard_Integer i; |
91 | |
92 | IW.Send(nbitems); |
93 | for (i = 1; i <= nbitems; i ++) |
94 | { |
95 | IW.Send(ent->Vertex(i).X()); |
96 | IW.Send(ent->Vertex(i).Y()); |
97 | IW.Send(ent->Vertex(i).Z()); |
98 | } |
99 | } |
100 | |
101 | |
102 | //======================================================================= |
103 | //function : OwnShared |
104 | //purpose : |
105 | //======================================================================= |
106 | |
107 | void IGESSolid_ToolVertexList::OwnShared(const Handle(IGESSolid_VertexList)& /* ent */, |
108 | Interface_EntityIterator& /* iter */) const |
109 | { |
110 | } |
111 | |
112 | |
113 | //======================================================================= |
114 | //function : OwnCopy |
115 | //purpose : |
116 | //======================================================================= |
117 | |
118 | void IGESSolid_ToolVertexList::OwnCopy(const Handle(IGESSolid_VertexList)& another, |
119 | const Handle(IGESSolid_VertexList)& ent, |
120 | Interface_CopyTool& /* TC */) const |
121 | { |
122 | Standard_Integer nbitems, i; |
123 | |
124 | nbitems = another->NbVertices(); |
125 | Handle(TColgp_HArray1OfXYZ) tempVertices = new |
126 | TColgp_HArray1OfXYZ(1, nbitems); |
127 | |
128 | for (i=1; i<=nbitems; i++) |
129 | { |
130 | tempVertices->SetValue(i, another->Vertex(i).XYZ()); |
131 | } |
132 | ent->Init(tempVertices); |
133 | } |
134 | |
135 | |
136 | //======================================================================= |
137 | //function : DirChecker |
138 | //purpose : |
139 | //======================================================================= |
140 | |
141 | IGESData_DirChecker IGESSolid_ToolVertexList::DirChecker |
142 | (const Handle(IGESSolid_VertexList)& /* ent */ ) const |
143 | { |
144 | IGESData_DirChecker DC(502, 1); |
145 | |
146 | DC.Structure (IGESData_DefVoid); |
147 | DC.LineFont (IGESData_DefVoid); |
148 | DC.LineWeight (IGESData_DefVoid); |
149 | DC.Color (IGESData_DefAny); |
150 | |
151 | DC.SubordinateStatusRequired (1); |
152 | DC.HierarchyStatusIgnored (); |
153 | return DC; |
154 | } |
155 | |
156 | |
157 | //======================================================================= |
158 | //function : OwnCheck |
159 | //purpose : |
160 | //======================================================================= |
161 | |
162 | void IGESSolid_ToolVertexList::OwnCheck(const Handle(IGESSolid_VertexList)& ent, |
163 | const Interface_ShareTool&, |
164 | Handle(Interface_Check)& ach) const |
165 | { |
166 | // MGE 03/08/98 |
167 | // Building of messages |
168 | //======================================== |
169 | //Message_Msg Msg182("XSTEP_182"); |
170 | //======================================== |
171 | |
172 | if (ent->NbVertices() <= 0) { |
173 | Message_Msg Msg182("XSTEP_182"); |
174 | ach->SendFail(Msg182); |
175 | } |
176 | } |
177 | |
178 | |
179 | //======================================================================= |
180 | //function : OwnDump |
181 | //purpose : |
182 | //======================================================================= |
183 | |
184 | void IGESSolid_ToolVertexList::OwnDump(const Handle(IGESSolid_VertexList)& ent, |
185 | const IGESData_IGESDumper& /* dumper */, |
186 | const Handle(Message_Messenger)& S, |
187 | const Standard_Integer level) const |
188 | { |
189 | S << "IGESSolid_VertexList" << endl; |
190 | |
191 | S << "Vertices : "; |
192 | IGESData_DumpListXYZL(S ,level,1, ent->NbVertices(),ent->Vertex,ent->Location()); |
193 | S << endl; |
194 | } |