7fd59977 |
1 | #include <IGESSolid_ReadWriteModule.ixx> |
2 | #include <Interface_Macros.hxx> |
3 | |
4 | #include <IGESSolid_Block.hxx> |
5 | #include <IGESSolid_BooleanTree.hxx> |
6 | #include <IGESSolid_ConeFrustum.hxx> |
7 | #include <IGESSolid_ConicalSurface.hxx> |
8 | #include <IGESSolid_Cylinder.hxx> |
9 | #include <IGESSolid_CylindricalSurface.hxx> |
10 | #include <IGESSolid_EdgeList.hxx> |
11 | #include <IGESSolid_Ellipsoid.hxx> |
12 | #include <IGESSolid_Face.hxx> |
13 | #include <IGESSolid_Loop.hxx> |
14 | #include <IGESSolid_ManifoldSolid.hxx> |
15 | #include <IGESSolid_PlaneSurface.hxx> |
16 | #include <IGESSolid_RightAngularWedge.hxx> |
17 | #include <IGESSolid_SelectedComponent.hxx> |
18 | #include <IGESSolid_Shell.hxx> |
19 | #include <IGESSolid_SolidAssembly.hxx> |
20 | #include <IGESSolid_SolidInstance.hxx> |
21 | #include <IGESSolid_SolidOfLinearExtrusion.hxx> |
22 | #include <IGESSolid_SolidOfRevolution.hxx> |
23 | #include <IGESSolid_Sphere.hxx> |
24 | #include <IGESSolid_SphericalSurface.hxx> |
25 | #include <IGESSolid_ToroidalSurface.hxx> |
26 | #include <IGESSolid_Torus.hxx> |
27 | #include <IGESSolid_VertexList.hxx> |
28 | |
29 | #include <IGESSolid_ToolBlock.hxx> |
30 | #include <IGESSolid_ToolBooleanTree.hxx> |
31 | #include <IGESSolid_ToolConeFrustum.hxx> |
32 | #include <IGESSolid_ToolConicalSurface.hxx> |
33 | #include <IGESSolid_ToolCylinder.hxx> |
34 | #include <IGESSolid_ToolCylindricalSurface.hxx> |
35 | #include <IGESSolid_ToolEdgeList.hxx> |
36 | #include <IGESSolid_ToolEllipsoid.hxx> |
37 | #include <IGESSolid_ToolFace.hxx> |
38 | #include <IGESSolid_ToolLoop.hxx> |
39 | #include <IGESSolid_ToolManifoldSolid.hxx> |
40 | #include <IGESSolid_ToolPlaneSurface.hxx> |
41 | #include <IGESSolid_ToolRightAngularWedge.hxx> |
42 | #include <IGESSolid_ToolSelectedComponent.hxx> |
43 | #include <IGESSolid_ToolShell.hxx> |
44 | #include <IGESSolid_ToolSolidAssembly.hxx> |
45 | #include <IGESSolid_ToolSolidInstance.hxx> |
46 | #include <IGESSolid_ToolSolidOfLinearExtrusion.hxx> |
47 | #include <IGESSolid_ToolSolidOfRevolution.hxx> |
48 | #include <IGESSolid_ToolSphere.hxx> |
49 | #include <IGESSolid_ToolSphericalSurface.hxx> |
50 | #include <IGESSolid_ToolToroidalSurface.hxx> |
51 | #include <IGESSolid_ToolTorus.hxx> |
52 | #include <IGESSolid_ToolVertexList.hxx> |
53 | |
54 | |
55 | |
56 | // Each Module is attached to a Protocol : it must interprete Case Numbers |
57 | // (arguments <CN> of various methods) in accordance to values returned by |
58 | // the method TypeNumber from this Protocol |
59 | |
60 | |
61 | IGESSolid_ReadWriteModule::IGESSolid_ReadWriteModule () { } |
62 | |
63 | |
64 | Standard_Integer IGESSolid_ReadWriteModule::CaseIGES |
65 | (const Standard_Integer typenum, const Standard_Integer formnum) const |
66 | { |
67 | switch (typenum) { |
68 | case 150 : return 1; |
69 | case 152 : return 13; |
70 | case 154 : return 5; |
71 | case 156 : return 3; |
72 | case 158 : return 20; |
73 | case 160 : return 23; |
74 | case 162 : return 19; |
75 | case 164 : return 18; |
76 | case 168 : return 8; |
77 | case 180 : return 2; |
78 | case 182 : return 14; |
79 | case 184 : return 16; |
80 | case 186 : return 11; |
81 | case 190 : return 12; |
82 | case 192 : return 6; |
83 | case 194 : return 4; |
84 | case 196 : return 21; |
85 | case 198 : return 22; |
86 | case 430 : return 17; |
87 | case 502 : return 24; |
88 | case 504 : return 7; |
89 | case 508 : return 10; |
90 | case 510 : return 9; |
91 | case 514 : return 15; |
92 | default : break; |
93 | } |
94 | return 0; |
95 | } |
96 | |
97 | |
98 | void IGESSolid_ReadWriteModule::ReadOwnParams |
99 | (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent, |
100 | const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const |
101 | { |
102 | switch (CN) { |
103 | case 1 : { |
104 | DeclareAndCast(IGESSolid_Block,anent,ent); |
105 | if (anent.IsNull()) return; |
106 | IGESSolid_ToolBlock tool; |
107 | tool.ReadOwnParams(anent,IR,PR); |
108 | } |
109 | break; |
110 | case 2 : { |
111 | DeclareAndCast(IGESSolid_BooleanTree,anent,ent); |
112 | if (anent.IsNull()) return; |
113 | IGESSolid_ToolBooleanTree tool; |
114 | tool.ReadOwnParams(anent,IR,PR); |
115 | } |
116 | break; |
117 | case 3 : { |
118 | DeclareAndCast(IGESSolid_ConeFrustum,anent,ent); |
119 | if (anent.IsNull()) return; |
120 | IGESSolid_ToolConeFrustum tool; |
121 | tool.ReadOwnParams(anent,IR,PR); |
122 | } |
123 | break; |
124 | case 4 : { |
125 | DeclareAndCast(IGESSolid_ConicalSurface,anent,ent); |
126 | if (anent.IsNull()) return; |
127 | IGESSolid_ToolConicalSurface tool; |
128 | tool.ReadOwnParams(anent,IR,PR); |
129 | } |
130 | break; |
131 | case 5 : { |
132 | DeclareAndCast(IGESSolid_Cylinder,anent,ent); |
133 | if (anent.IsNull()) return; |
134 | IGESSolid_ToolCylinder tool; |
135 | tool.ReadOwnParams(anent,IR,PR); |
136 | } |
137 | break; |
138 | case 6 : { |
139 | DeclareAndCast(IGESSolid_CylindricalSurface,anent,ent); |
140 | if (anent.IsNull()) return; |
141 | IGESSolid_ToolCylindricalSurface tool; |
142 | tool.ReadOwnParams(anent,IR,PR); |
143 | } |
144 | break; |
145 | case 7 : { |
146 | DeclareAndCast(IGESSolid_EdgeList,anent,ent); |
147 | if (anent.IsNull()) return; |
148 | IGESSolid_ToolEdgeList tool; |
149 | tool.ReadOwnParams(anent,IR,PR); |
150 | } |
151 | break; |
152 | case 8 : { |
153 | DeclareAndCast(IGESSolid_Ellipsoid,anent,ent); |
154 | if (anent.IsNull()) return; |
155 | IGESSolid_ToolEllipsoid tool; |
156 | tool.ReadOwnParams(anent,IR,PR); |
157 | } |
158 | break; |
159 | case 9 : { |
160 | DeclareAndCast(IGESSolid_Face,anent,ent); |
161 | if (anent.IsNull()) return; |
162 | IGESSolid_ToolFace tool; |
163 | tool.ReadOwnParams(anent,IR,PR); |
164 | } |
165 | break; |
166 | case 10 : { |
167 | DeclareAndCast(IGESSolid_Loop,anent,ent); |
168 | if (anent.IsNull()) return; |
169 | IGESSolid_ToolLoop tool; |
170 | tool.ReadOwnParams(anent,IR,PR); |
171 | } |
172 | break; |
173 | case 11 : { |
174 | DeclareAndCast(IGESSolid_ManifoldSolid,anent,ent); |
175 | if (anent.IsNull()) return; |
176 | IGESSolid_ToolManifoldSolid tool; |
177 | tool.ReadOwnParams(anent,IR,PR); |
178 | } |
179 | break; |
180 | case 12 : { |
181 | DeclareAndCast(IGESSolid_PlaneSurface,anent,ent); |
182 | if (anent.IsNull()) return; |
183 | IGESSolid_ToolPlaneSurface tool; |
184 | tool.ReadOwnParams(anent,IR,PR); |
185 | } |
186 | break; |
187 | case 13 : { |
188 | DeclareAndCast(IGESSolid_RightAngularWedge,anent,ent); |
189 | if (anent.IsNull()) return; |
190 | IGESSolid_ToolRightAngularWedge tool; |
191 | tool.ReadOwnParams(anent,IR,PR); |
192 | } |
193 | break; |
194 | case 14 : { |
195 | DeclareAndCast(IGESSolid_SelectedComponent,anent,ent); |
196 | if (anent.IsNull()) return; |
197 | IGESSolid_ToolSelectedComponent tool; |
198 | tool.ReadOwnParams(anent,IR,PR); |
199 | } |
200 | break; |
201 | case 15 : { |
202 | DeclareAndCast(IGESSolid_Shell,anent,ent); |
203 | if (anent.IsNull()) return; |
204 | IGESSolid_ToolShell tool; |
205 | tool.ReadOwnParams(anent,IR,PR); |
206 | } |
207 | break; |
208 | case 16 : { |
209 | DeclareAndCast(IGESSolid_SolidAssembly,anent,ent); |
210 | if (anent.IsNull()) return; |
211 | IGESSolid_ToolSolidAssembly tool; |
212 | tool.ReadOwnParams(anent,IR,PR); |
213 | } |
214 | break; |
215 | case 17 : { |
216 | DeclareAndCast(IGESSolid_SolidInstance,anent,ent); |
217 | if (anent.IsNull()) return; |
218 | IGESSolid_ToolSolidInstance tool; |
219 | tool.ReadOwnParams(anent,IR,PR); |
220 | } |
221 | break; |
222 | case 18 : { |
223 | DeclareAndCast(IGESSolid_SolidOfLinearExtrusion,anent,ent); |
224 | if (anent.IsNull()) return; |
225 | IGESSolid_ToolSolidOfLinearExtrusion tool; |
226 | tool.ReadOwnParams(anent,IR,PR); |
227 | } |
228 | break; |
229 | case 19 : { |
230 | DeclareAndCast(IGESSolid_SolidOfRevolution,anent,ent); |
231 | if (anent.IsNull()) return; |
232 | IGESSolid_ToolSolidOfRevolution tool; |
233 | tool.ReadOwnParams(anent,IR,PR); |
234 | } |
235 | break; |
236 | case 20 : { |
237 | DeclareAndCast(IGESSolid_Sphere,anent,ent); |
238 | if (anent.IsNull()) return; |
239 | IGESSolid_ToolSphere tool; |
240 | tool.ReadOwnParams(anent,IR,PR); |
241 | } |
242 | break; |
243 | case 21 : { |
244 | DeclareAndCast(IGESSolid_SphericalSurface,anent,ent); |
245 | if (anent.IsNull()) return; |
246 | IGESSolid_ToolSphericalSurface tool; |
247 | tool.ReadOwnParams(anent,IR,PR); |
248 | } |
249 | break; |
250 | case 22 : { |
251 | DeclareAndCast(IGESSolid_ToroidalSurface,anent,ent); |
252 | if (anent.IsNull()) return; |
253 | IGESSolid_ToolToroidalSurface tool; |
254 | tool.ReadOwnParams(anent,IR,PR); |
255 | } |
256 | break; |
257 | case 23 : { |
258 | DeclareAndCast(IGESSolid_Torus,anent,ent); |
259 | if (anent.IsNull()) return; |
260 | IGESSolid_ToolTorus tool; |
261 | tool.ReadOwnParams(anent,IR,PR); |
262 | } |
263 | break; |
264 | case 24 : { |
265 | DeclareAndCast(IGESSolid_VertexList,anent,ent); |
266 | if (anent.IsNull()) return; |
267 | IGESSolid_ToolVertexList tool; |
268 | tool.ReadOwnParams(anent,IR,PR); |
269 | } |
270 | break; |
271 | default : break; |
272 | } |
273 | } |
274 | |
275 | |
276 | void IGESSolid_ReadWriteModule::WriteOwnParams |
277 | (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent, |
278 | IGESData_IGESWriter& IW) const |
279 | { |
280 | switch (CN) { |
281 | case 1 : { |
282 | DeclareAndCast(IGESSolid_Block,anent,ent); |
283 | if (anent.IsNull()) return; |
284 | IGESSolid_ToolBlock tool; |
285 | tool.WriteOwnParams(anent,IW); |
286 | } |
287 | break; |
288 | case 2 : { |
289 | DeclareAndCast(IGESSolid_BooleanTree,anent,ent); |
290 | if (anent.IsNull()) return; |
291 | IGESSolid_ToolBooleanTree tool; |
292 | tool.WriteOwnParams(anent,IW); |
293 | } |
294 | break; |
295 | case 3 : { |
296 | DeclareAndCast(IGESSolid_ConeFrustum,anent,ent); |
297 | if (anent.IsNull()) return; |
298 | IGESSolid_ToolConeFrustum tool; |
299 | tool.WriteOwnParams(anent,IW); |
300 | } |
301 | break; |
302 | case 4 : { |
303 | DeclareAndCast(IGESSolid_ConicalSurface,anent,ent); |
304 | if (anent.IsNull()) return; |
305 | IGESSolid_ToolConicalSurface tool; |
306 | tool.WriteOwnParams(anent,IW); |
307 | } |
308 | break; |
309 | case 5 : { |
310 | DeclareAndCast(IGESSolid_Cylinder,anent,ent); |
311 | if (anent.IsNull()) return; |
312 | IGESSolid_ToolCylinder tool; |
313 | tool.WriteOwnParams(anent,IW); |
314 | } |
315 | break; |
316 | case 6 : { |
317 | DeclareAndCast(IGESSolid_CylindricalSurface,anent,ent); |
318 | if (anent.IsNull()) return; |
319 | IGESSolid_ToolCylindricalSurface tool; |
320 | tool.WriteOwnParams(anent,IW); |
321 | } |
322 | break; |
323 | case 7 : { |
324 | DeclareAndCast(IGESSolid_EdgeList,anent,ent); |
325 | if (anent.IsNull()) return; |
326 | IGESSolid_ToolEdgeList tool; |
327 | tool.WriteOwnParams(anent,IW); |
328 | } |
329 | break; |
330 | case 8 : { |
331 | DeclareAndCast(IGESSolid_Ellipsoid,anent,ent); |
332 | if (anent.IsNull()) return; |
333 | IGESSolid_ToolEllipsoid tool; |
334 | tool.WriteOwnParams(anent,IW); |
335 | } |
336 | break; |
337 | case 9 : { |
338 | DeclareAndCast(IGESSolid_Face,anent,ent); |
339 | if (anent.IsNull()) return; |
340 | IGESSolid_ToolFace tool; |
341 | tool.WriteOwnParams(anent,IW); |
342 | } |
343 | break; |
344 | case 10 : { |
345 | DeclareAndCast(IGESSolid_Loop,anent,ent); |
346 | if (anent.IsNull()) return; |
347 | IGESSolid_ToolLoop tool; |
348 | tool.WriteOwnParams(anent,IW); |
349 | } |
350 | break; |
351 | case 11 : { |
352 | DeclareAndCast(IGESSolid_ManifoldSolid,anent,ent); |
353 | if (anent.IsNull()) return; |
354 | IGESSolid_ToolManifoldSolid tool; |
355 | tool.WriteOwnParams(anent,IW); |
356 | } |
357 | break; |
358 | case 12 : { |
359 | DeclareAndCast(IGESSolid_PlaneSurface,anent,ent); |
360 | if (anent.IsNull()) return; |
361 | IGESSolid_ToolPlaneSurface tool; |
362 | tool.WriteOwnParams(anent,IW); |
363 | } |
364 | break; |
365 | case 13 : { |
366 | DeclareAndCast(IGESSolid_RightAngularWedge,anent,ent); |
367 | if (anent.IsNull()) return; |
368 | IGESSolid_ToolRightAngularWedge tool; |
369 | tool.WriteOwnParams(anent,IW); |
370 | } |
371 | break; |
372 | case 14 : { |
373 | DeclareAndCast(IGESSolid_SelectedComponent,anent,ent); |
374 | if (anent.IsNull()) return; |
375 | IGESSolid_ToolSelectedComponent tool; |
376 | tool.WriteOwnParams(anent,IW); |
377 | } |
378 | break; |
379 | case 15 : { |
380 | DeclareAndCast(IGESSolid_Shell,anent,ent); |
381 | if (anent.IsNull()) return; |
382 | IGESSolid_ToolShell tool; |
383 | tool.WriteOwnParams(anent,IW); |
384 | } |
385 | break; |
386 | case 16 : { |
387 | DeclareAndCast(IGESSolid_SolidAssembly,anent,ent); |
388 | if (anent.IsNull()) return; |
389 | IGESSolid_ToolSolidAssembly tool; |
390 | tool.WriteOwnParams(anent,IW); |
391 | } |
392 | break; |
393 | case 17 : { |
394 | DeclareAndCast(IGESSolid_SolidInstance,anent,ent); |
395 | if (anent.IsNull()) return; |
396 | IGESSolid_ToolSolidInstance tool; |
397 | tool.WriteOwnParams(anent,IW); |
398 | } |
399 | break; |
400 | case 18 : { |
401 | DeclareAndCast(IGESSolid_SolidOfLinearExtrusion,anent,ent); |
402 | if (anent.IsNull()) return; |
403 | IGESSolid_ToolSolidOfLinearExtrusion tool; |
404 | tool.WriteOwnParams(anent,IW); |
405 | } |
406 | break; |
407 | case 19 : { |
408 | DeclareAndCast(IGESSolid_SolidOfRevolution,anent,ent); |
409 | if (anent.IsNull()) return; |
410 | IGESSolid_ToolSolidOfRevolution tool; |
411 | tool.WriteOwnParams(anent,IW); |
412 | } |
413 | break; |
414 | case 20 : { |
415 | DeclareAndCast(IGESSolid_Sphere,anent,ent); |
416 | if (anent.IsNull()) return; |
417 | IGESSolid_ToolSphere tool; |
418 | tool.WriteOwnParams(anent,IW); |
419 | } |
420 | break; |
421 | case 21 : { |
422 | DeclareAndCast(IGESSolid_SphericalSurface,anent,ent); |
423 | if (anent.IsNull()) return; |
424 | IGESSolid_ToolSphericalSurface tool; |
425 | tool.WriteOwnParams(anent,IW); |
426 | } |
427 | break; |
428 | case 22 : { |
429 | DeclareAndCast(IGESSolid_ToroidalSurface,anent,ent); |
430 | if (anent.IsNull()) return; |
431 | IGESSolid_ToolToroidalSurface tool; |
432 | tool.WriteOwnParams(anent,IW); |
433 | } |
434 | break; |
435 | case 23 : { |
436 | DeclareAndCast(IGESSolid_Torus,anent,ent); |
437 | if (anent.IsNull()) return; |
438 | IGESSolid_ToolTorus tool; |
439 | tool.WriteOwnParams(anent,IW); |
440 | } |
441 | break; |
442 | case 24 : { |
443 | DeclareAndCast(IGESSolid_VertexList,anent,ent); |
444 | if (anent.IsNull()) return; |
445 | IGESSolid_ToolVertexList tool; |
446 | tool.WriteOwnParams(anent,IW); |
447 | } |
448 | break; |
449 | default : break; |
450 | } |
451 | } |