1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #include <IGESAppli_DrilledHole.hxx>
16 #include <IGESAppli_ElementResults.hxx>
17 #include <IGESAppli_FiniteElement.hxx>
18 #include <IGESAppli_Flow.hxx>
19 #include <IGESAppli_FlowLineSpec.hxx>
20 #include <IGESAppli_GeneralModule.hxx>
21 #include <IGESAppli_LevelFunction.hxx>
22 #include <IGESAppli_LevelToPWBLayerMap.hxx>
23 #include <IGESAppli_LineWidening.hxx>
24 #include <IGESAppli_NodalConstraint.hxx>
25 #include <IGESAppli_NodalDisplAndRot.hxx>
26 #include <IGESAppli_NodalResults.hxx>
27 #include <IGESAppli_Node.hxx>
28 #include <IGESAppli_PartNumber.hxx>
29 #include <IGESAppli_PinNumber.hxx>
30 #include <IGESAppli_PipingFlow.hxx>
31 #include <IGESAppli_PWBArtworkStackup.hxx>
32 #include <IGESAppli_PWBDrilledHole.hxx>
33 #include <IGESAppli_ReferenceDesignator.hxx>
34 #include <IGESAppli_RegionRestriction.hxx>
35 #include <IGESAppli_ToolDrilledHole.hxx>
36 #include <IGESAppli_ToolElementResults.hxx>
37 #include <IGESAppli_ToolFiniteElement.hxx>
38 #include <IGESAppli_ToolFlow.hxx>
39 #include <IGESAppli_ToolFlowLineSpec.hxx>
40 #include <IGESAppli_ToolLevelFunction.hxx>
41 #include <IGESAppli_ToolLevelToPWBLayerMap.hxx>
42 #include <IGESAppli_ToolLineWidening.hxx>
43 #include <IGESAppli_ToolNodalConstraint.hxx>
44 #include <IGESAppli_ToolNodalDisplAndRot.hxx>
45 #include <IGESAppli_ToolNodalResults.hxx>
46 #include <IGESAppli_ToolNode.hxx>
47 #include <IGESAppli_ToolPartNumber.hxx>
48 #include <IGESAppli_ToolPinNumber.hxx>
49 #include <IGESAppli_ToolPipingFlow.hxx>
50 #include <IGESAppli_ToolPWBArtworkStackup.hxx>
51 #include <IGESAppli_ToolPWBDrilledHole.hxx>
52 #include <IGESAppli_ToolReferenceDesignator.hxx>
53 #include <IGESAppli_ToolRegionRestriction.hxx>
54 #include <IGESData_DirChecker.hxx>
55 #include <IGESData_IGESEntity.hxx>
56 #include <Interface_Category.hxx>
57 #include <Interface_Check.hxx>
58 #include <Interface_CopyTool.hxx>
59 #include <Interface_EntityIterator.hxx>
60 #include <Interface_Macros.hxx>
61 #include <Interface_ShareTool.hxx>
62 #include <Standard_Transient.hxx>
63 #include <Standard_Type.hxx>
65 IMPLEMENT_STANDARD_RTTIEXT(IGESAppli_GeneralModule,IGESData_GeneralModule)
67 // Each Module is attached to a Protocol : it must interpret Case Numbers
68 // (arguments <CN> of various methods) in accordance to values returned by
69 // the method TypeNumber from this Protocol
70 IGESAppli_GeneralModule::IGESAppli_GeneralModule () { }
73 void IGESAppli_GeneralModule::OwnSharedCase
74 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
75 Interface_EntityIterator& iter) const
79 DeclareAndCast(IGESAppli_DrilledHole,anent,ent);
80 if (anent.IsNull()) return;
81 IGESAppli_ToolDrilledHole tool;
82 tool.OwnShared(anent,iter);
86 DeclareAndCast(IGESAppli_ElementResults,anent,ent);
87 if (anent.IsNull()) return;
88 IGESAppli_ToolElementResults tool;
89 tool.OwnShared(anent,iter);
93 DeclareAndCast(IGESAppli_FiniteElement,anent,ent);
94 if (anent.IsNull()) return;
95 IGESAppli_ToolFiniteElement tool;
96 tool.OwnShared(anent,iter);
100 DeclareAndCast(IGESAppli_Flow,anent,ent);
101 if (anent.IsNull()) return;
102 IGESAppli_ToolFlow tool;
103 tool.OwnShared(anent,iter);
107 DeclareAndCast(IGESAppli_FlowLineSpec,anent,ent);
108 if (anent.IsNull()) return;
109 IGESAppli_ToolFlowLineSpec tool;
110 tool.OwnShared(anent,iter);
114 DeclareAndCast(IGESAppli_LevelFunction,anent,ent);
115 if (anent.IsNull()) return;
116 IGESAppli_ToolLevelFunction tool;
117 tool.OwnShared(anent,iter);
121 DeclareAndCast(IGESAppli_LevelToPWBLayerMap,anent,ent);
122 if (anent.IsNull()) return;
123 IGESAppli_ToolLevelToPWBLayerMap tool;
124 tool.OwnShared(anent,iter);
128 DeclareAndCast(IGESAppli_LineWidening,anent,ent);
129 if (anent.IsNull()) return;
130 IGESAppli_ToolLineWidening tool;
131 tool.OwnShared(anent,iter);
135 DeclareAndCast(IGESAppli_NodalConstraint,anent,ent);
136 if (anent.IsNull()) return;
137 IGESAppli_ToolNodalConstraint tool;
138 tool.OwnShared(anent,iter);
142 DeclareAndCast(IGESAppli_NodalDisplAndRot,anent,ent);
143 if (anent.IsNull()) return;
144 IGESAppli_ToolNodalDisplAndRot tool;
145 tool.OwnShared(anent,iter);
149 DeclareAndCast(IGESAppli_NodalResults,anent,ent);
150 if (anent.IsNull()) return;
151 IGESAppli_ToolNodalResults tool;
152 tool.OwnShared(anent,iter);
156 DeclareAndCast(IGESAppli_Node,anent,ent);
157 if (anent.IsNull()) return;
158 IGESAppli_ToolNode tool;
159 tool.OwnShared(anent,iter);
163 DeclareAndCast(IGESAppli_PWBArtworkStackup,anent,ent);
164 if (anent.IsNull()) return;
165 IGESAppli_ToolPWBArtworkStackup tool;
166 tool.OwnShared(anent,iter);
170 DeclareAndCast(IGESAppli_PWBDrilledHole,anent,ent);
171 if (anent.IsNull()) return;
172 IGESAppli_ToolPWBDrilledHole tool;
173 tool.OwnShared(anent,iter);
177 DeclareAndCast(IGESAppli_PartNumber,anent,ent);
178 if (anent.IsNull()) return;
179 IGESAppli_ToolPartNumber tool;
180 tool.OwnShared(anent,iter);
184 DeclareAndCast(IGESAppli_PinNumber,anent,ent);
185 if (anent.IsNull()) return;
186 IGESAppli_ToolPinNumber tool;
187 tool.OwnShared(anent,iter);
191 DeclareAndCast(IGESAppli_PipingFlow,anent,ent);
192 if (anent.IsNull()) return;
193 IGESAppli_ToolPipingFlow tool;
194 tool.OwnShared(anent,iter);
198 DeclareAndCast(IGESAppli_ReferenceDesignator,anent,ent);
199 if (anent.IsNull()) return;
200 IGESAppli_ToolReferenceDesignator tool;
201 tool.OwnShared(anent,iter);
205 DeclareAndCast(IGESAppli_RegionRestriction,anent,ent);
206 if (anent.IsNull()) return;
207 IGESAppli_ToolRegionRestriction tool;
208 tool.OwnShared(anent,iter);
216 IGESData_DirChecker IGESAppli_GeneralModule::DirChecker
217 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent) const
221 DeclareAndCast(IGESAppli_DrilledHole,anent,ent);
222 if (anent.IsNull()) break;
223 IGESAppli_ToolDrilledHole tool;
224 return tool.DirChecker(anent);
227 DeclareAndCast(IGESAppli_ElementResults,anent,ent);
228 if (anent.IsNull()) break;
229 IGESAppli_ToolElementResults tool;
230 return tool.DirChecker(anent);
233 DeclareAndCast(IGESAppli_FiniteElement,anent,ent);
234 if (anent.IsNull()) break;
235 IGESAppli_ToolFiniteElement tool;
236 return tool.DirChecker(anent);
239 DeclareAndCast(IGESAppli_Flow,anent,ent);
240 if (anent.IsNull()) break;
241 IGESAppli_ToolFlow tool;
242 return tool.DirChecker(anent);
245 DeclareAndCast(IGESAppli_FlowLineSpec,anent,ent);
246 if (anent.IsNull()) break;
247 IGESAppli_ToolFlowLineSpec tool;
248 return tool.DirChecker(anent);
251 DeclareAndCast(IGESAppli_LevelFunction,anent,ent);
252 if (anent.IsNull()) break;
253 IGESAppli_ToolLevelFunction tool;
254 return tool.DirChecker(anent);
257 DeclareAndCast(IGESAppli_LevelToPWBLayerMap,anent,ent);
258 if (anent.IsNull()) break;
259 IGESAppli_ToolLevelToPWBLayerMap tool;
260 return tool.DirChecker(anent);
263 DeclareAndCast(IGESAppli_LineWidening,anent,ent);
264 if (anent.IsNull()) break;
265 IGESAppli_ToolLineWidening tool;
266 return tool.DirChecker(anent);
269 DeclareAndCast(IGESAppli_NodalConstraint,anent,ent);
270 if (anent.IsNull()) break;
271 IGESAppli_ToolNodalConstraint tool;
272 return tool.DirChecker(anent);
275 DeclareAndCast(IGESAppli_NodalDisplAndRot,anent,ent);
276 if (anent.IsNull()) break;
277 IGESAppli_ToolNodalDisplAndRot tool;
278 return tool.DirChecker(anent);
281 DeclareAndCast(IGESAppli_NodalResults,anent,ent);
282 if (anent.IsNull()) break;
283 IGESAppli_ToolNodalResults tool;
284 return tool.DirChecker(anent);
287 DeclareAndCast(IGESAppli_Node,anent,ent);
288 if (anent.IsNull()) break;
289 IGESAppli_ToolNode tool;
290 return tool.DirChecker(anent);
293 DeclareAndCast(IGESAppli_PWBArtworkStackup,anent,ent);
294 if (anent.IsNull()) break;
295 IGESAppli_ToolPWBArtworkStackup tool;
296 return tool.DirChecker(anent);
299 DeclareAndCast(IGESAppli_PWBDrilledHole,anent,ent);
300 if (anent.IsNull()) break;
301 IGESAppli_ToolPWBDrilledHole tool;
302 return tool.DirChecker(anent);
305 DeclareAndCast(IGESAppli_PartNumber,anent,ent);
306 if (anent.IsNull()) break;
307 IGESAppli_ToolPartNumber tool;
308 return tool.DirChecker(anent);
311 DeclareAndCast(IGESAppli_PinNumber,anent,ent);
312 if (anent.IsNull()) break;
313 IGESAppli_ToolPinNumber tool;
314 return tool.DirChecker(anent);
317 DeclareAndCast(IGESAppli_PipingFlow,anent,ent);
318 if (anent.IsNull()) break;
319 IGESAppli_ToolPipingFlow tool;
320 return tool.DirChecker(anent);
323 DeclareAndCast(IGESAppli_ReferenceDesignator,anent,ent);
324 if (anent.IsNull()) break;
325 IGESAppli_ToolReferenceDesignator tool;
326 return tool.DirChecker(anent);
329 DeclareAndCast(IGESAppli_RegionRestriction,anent,ent);
330 if (anent.IsNull()) break;
331 IGESAppli_ToolRegionRestriction tool;
332 return tool.DirChecker(anent);
336 return IGESData_DirChecker(); // by default, no specific criterium
340 void IGESAppli_GeneralModule::OwnCheckCase
341 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
342 const Interface_ShareTool& shares, Handle(Interface_Check)& ach) const
346 DeclareAndCast(IGESAppli_DrilledHole,anent,ent);
347 if (anent.IsNull()) return;
348 IGESAppli_ToolDrilledHole tool;
349 tool.OwnCheck(anent,shares,ach);
353 DeclareAndCast(IGESAppli_ElementResults,anent,ent);
354 if (anent.IsNull()) return;
355 IGESAppli_ToolElementResults tool;
356 tool.OwnCheck(anent,shares,ach);
360 DeclareAndCast(IGESAppli_FiniteElement,anent,ent);
361 if (anent.IsNull()) return;
362 IGESAppli_ToolFiniteElement tool;
363 tool.OwnCheck(anent,shares,ach);
367 DeclareAndCast(IGESAppli_Flow,anent,ent);
368 if (anent.IsNull()) return;
369 IGESAppli_ToolFlow tool;
370 tool.OwnCheck(anent,shares,ach);
374 DeclareAndCast(IGESAppli_FlowLineSpec,anent,ent);
375 if (anent.IsNull()) return;
376 IGESAppli_ToolFlowLineSpec tool;
377 tool.OwnCheck(anent,shares,ach);
381 DeclareAndCast(IGESAppli_LevelFunction,anent,ent);
382 if (anent.IsNull()) return;
383 IGESAppli_ToolLevelFunction tool;
384 tool.OwnCheck(anent,shares,ach);
388 DeclareAndCast(IGESAppli_LevelToPWBLayerMap,anent,ent);
389 if (anent.IsNull()) return;
390 IGESAppli_ToolLevelToPWBLayerMap tool;
391 tool.OwnCheck(anent,shares,ach);
395 DeclareAndCast(IGESAppli_LineWidening,anent,ent);
396 if (anent.IsNull()) return;
397 IGESAppli_ToolLineWidening tool;
398 tool.OwnCheck(anent,shares,ach);
402 DeclareAndCast(IGESAppli_NodalConstraint,anent,ent);
403 if (anent.IsNull()) return;
404 IGESAppli_ToolNodalConstraint tool;
405 tool.OwnCheck(anent,shares,ach);
409 DeclareAndCast(IGESAppli_NodalDisplAndRot,anent,ent);
410 if (anent.IsNull()) return;
411 IGESAppli_ToolNodalDisplAndRot tool;
412 tool.OwnCheck(anent,shares,ach);
416 DeclareAndCast(IGESAppli_NodalResults,anent,ent);
417 if (anent.IsNull()) return;
418 IGESAppli_ToolNodalResults tool;
419 tool.OwnCheck(anent,shares,ach);
423 DeclareAndCast(IGESAppli_Node,anent,ent);
424 if (anent.IsNull()) return;
425 IGESAppli_ToolNode tool;
426 tool.OwnCheck(anent,shares,ach);
430 DeclareAndCast(IGESAppli_PWBArtworkStackup,anent,ent);
431 if (anent.IsNull()) return;
432 IGESAppli_ToolPWBArtworkStackup tool;
433 tool.OwnCheck(anent,shares,ach);
437 DeclareAndCast(IGESAppli_PWBDrilledHole,anent,ent);
438 if (anent.IsNull()) return;
439 IGESAppli_ToolPWBDrilledHole tool;
440 tool.OwnCheck(anent,shares,ach);
444 DeclareAndCast(IGESAppli_PartNumber,anent,ent);
445 if (anent.IsNull()) return;
446 IGESAppli_ToolPartNumber tool;
447 tool.OwnCheck(anent,shares,ach);
451 DeclareAndCast(IGESAppli_PinNumber,anent,ent);
452 if (anent.IsNull()) return;
453 IGESAppli_ToolPinNumber tool;
454 tool.OwnCheck(anent,shares,ach);
458 DeclareAndCast(IGESAppli_PipingFlow,anent,ent);
459 if (anent.IsNull()) return;
460 IGESAppli_ToolPipingFlow tool;
461 tool.OwnCheck(anent,shares,ach);
465 DeclareAndCast(IGESAppli_ReferenceDesignator,anent,ent);
466 if (anent.IsNull()) return;
467 IGESAppli_ToolReferenceDesignator tool;
468 tool.OwnCheck(anent,shares,ach);
472 DeclareAndCast(IGESAppli_RegionRestriction,anent,ent);
473 if (anent.IsNull()) return;
474 IGESAppli_ToolRegionRestriction tool;
475 tool.OwnCheck(anent,shares,ach);
482 Standard_Boolean IGESAppli_GeneralModule::NewVoid
483 (const Standard_Integer CN, Handle(Standard_Transient)& ent) const
486 case 1 : ent = new IGESAppli_DrilledHole; break;
487 case 2 : ent = new IGESAppli_ElementResults; break;
488 case 3 : ent = new IGESAppli_FiniteElement; break;
489 case 4 : ent = new IGESAppli_Flow; break;
490 case 5 : ent = new IGESAppli_FlowLineSpec; break;
491 case 6 : ent = new IGESAppli_LevelFunction; break;
492 case 7 : ent = new IGESAppli_LevelToPWBLayerMap; break;
493 case 8 : ent = new IGESAppli_LineWidening; break;
494 case 9 : ent = new IGESAppli_NodalConstraint; break;
495 case 10 : ent = new IGESAppli_NodalDisplAndRot; break;
496 case 11 : ent = new IGESAppli_NodalResults; break;
497 case 12 : ent = new IGESAppli_Node; break;
498 case 13 : ent = new IGESAppli_PWBArtworkStackup; break;
499 case 14 : ent = new IGESAppli_PWBDrilledHole; break;
500 case 15 : ent = new IGESAppli_PartNumber; break;
501 case 16 : ent = new IGESAppli_PinNumber; break;
502 case 17 : ent = new IGESAppli_PipingFlow; break;
503 case 18 : ent = new IGESAppli_ReferenceDesignator; break;
504 case 19 : ent = new IGESAppli_RegionRestriction; break;
505 default : return Standard_False; // by default, Failure on Recognize
507 return Standard_True;
510 void IGESAppli_GeneralModule::OwnCopyCase
511 (const Standard_Integer CN,
512 const Handle(IGESData_IGESEntity)& entfrom,
513 const Handle(IGESData_IGESEntity)& entto,
514 Interface_CopyTool& TC) const
518 DeclareAndCast(IGESAppli_DrilledHole,enfr,entfrom);
519 DeclareAndCast(IGESAppli_DrilledHole,ento,entto);
520 IGESAppli_ToolDrilledHole tool;
521 tool.OwnCopy(enfr,ento,TC);
525 DeclareAndCast(IGESAppli_ElementResults,enfr,entfrom);
526 DeclareAndCast(IGESAppli_ElementResults,ento,entto);
527 IGESAppli_ToolElementResults tool;
528 tool.OwnCopy(enfr,ento,TC);
532 DeclareAndCast(IGESAppli_FiniteElement,enfr,entfrom);
533 DeclareAndCast(IGESAppli_FiniteElement,ento,entto);
534 IGESAppli_ToolFiniteElement tool;
535 tool.OwnCopy(enfr,ento,TC);
539 DeclareAndCast(IGESAppli_Flow,enfr,entfrom);
540 DeclareAndCast(IGESAppli_Flow,ento,entto);
541 IGESAppli_ToolFlow tool;
542 tool.OwnCopy(enfr,ento,TC);
546 DeclareAndCast(IGESAppli_FlowLineSpec,enfr,entfrom);
547 DeclareAndCast(IGESAppli_FlowLineSpec,ento,entto);
548 IGESAppli_ToolFlowLineSpec tool;
549 tool.OwnCopy(enfr,ento,TC);
553 DeclareAndCast(IGESAppli_LevelFunction,enfr,entfrom);
554 DeclareAndCast(IGESAppli_LevelFunction,ento,entto);
555 IGESAppli_ToolLevelFunction tool;
556 tool.OwnCopy(enfr,ento,TC);
560 DeclareAndCast(IGESAppli_LevelToPWBLayerMap,enfr,entfrom);
561 DeclareAndCast(IGESAppli_LevelToPWBLayerMap,ento,entto);
562 IGESAppli_ToolLevelToPWBLayerMap tool;
563 tool.OwnCopy(enfr,ento,TC);
567 DeclareAndCast(IGESAppli_LineWidening,enfr,entfrom);
568 DeclareAndCast(IGESAppli_LineWidening,ento,entto);
569 IGESAppli_ToolLineWidening tool;
570 tool.OwnCopy(enfr,ento,TC);
574 DeclareAndCast(IGESAppli_NodalConstraint,enfr,entfrom);
575 DeclareAndCast(IGESAppli_NodalConstraint,ento,entto);
576 IGESAppli_ToolNodalConstraint tool;
577 tool.OwnCopy(enfr,ento,TC);
581 DeclareAndCast(IGESAppli_NodalDisplAndRot,enfr,entfrom);
582 DeclareAndCast(IGESAppli_NodalDisplAndRot,ento,entto);
583 IGESAppli_ToolNodalDisplAndRot tool;
584 tool.OwnCopy(enfr,ento,TC);
588 DeclareAndCast(IGESAppli_NodalResults,enfr,entfrom);
589 DeclareAndCast(IGESAppli_NodalResults,ento,entto);
590 IGESAppli_ToolNodalResults tool;
591 tool.OwnCopy(enfr,ento,TC);
595 DeclareAndCast(IGESAppli_Node,enfr,entfrom);
596 DeclareAndCast(IGESAppli_Node,ento,entto);
597 IGESAppli_ToolNode tool;
598 tool.OwnCopy(enfr,ento,TC);
602 DeclareAndCast(IGESAppli_PWBArtworkStackup,enfr,entfrom);
603 DeclareAndCast(IGESAppli_PWBArtworkStackup,ento,entto);
604 IGESAppli_ToolPWBArtworkStackup tool;
605 tool.OwnCopy(enfr,ento,TC);
609 DeclareAndCast(IGESAppli_PWBDrilledHole,enfr,entfrom);
610 DeclareAndCast(IGESAppli_PWBDrilledHole,ento,entto);
611 IGESAppli_ToolPWBDrilledHole tool;
612 tool.OwnCopy(enfr,ento,TC);
616 DeclareAndCast(IGESAppli_PartNumber,enfr,entfrom);
617 DeclareAndCast(IGESAppli_PartNumber,ento,entto);
618 IGESAppli_ToolPartNumber tool;
619 tool.OwnCopy(enfr,ento,TC);
623 DeclareAndCast(IGESAppli_PinNumber,enfr,entfrom);
624 DeclareAndCast(IGESAppli_PinNumber,ento,entto);
625 IGESAppli_ToolPinNumber tool;
626 tool.OwnCopy(enfr,ento,TC);
630 DeclareAndCast(IGESAppli_PipingFlow,enfr,entfrom);
631 DeclareAndCast(IGESAppli_PipingFlow,ento,entto);
632 IGESAppli_ToolPipingFlow tool;
633 tool.OwnCopy(enfr,ento,TC);
637 DeclareAndCast(IGESAppli_ReferenceDesignator,enfr,entfrom);
638 DeclareAndCast(IGESAppli_ReferenceDesignator,ento,entto);
639 IGESAppli_ToolReferenceDesignator tool;
640 tool.OwnCopy(enfr,ento,TC);
644 DeclareAndCast(IGESAppli_RegionRestriction,enfr,entfrom);
645 DeclareAndCast(IGESAppli_RegionRestriction,ento,entto);
646 IGESAppli_ToolRegionRestriction tool;
647 tool.OwnCopy(enfr,ento,TC);
655 Standard_Integer IGESAppli_GeneralModule::CategoryNumber
656 (const Standard_Integer CN, const Handle(Standard_Transient)& /*ent*/,
657 const Interface_ShareTool& ) const
659 if (CN == 4 || CN == 5 || CN == 17) return Interface_Category::Number("Piping");
660 if (CN == 2 || CN == 3 || (CN >= 9 && CN <= 12)) return Interface_Category::Number("FEA");
661 return Interface_Category::Number("Professional");