1 #include <IGESDraw_GeneralModule.ixx>
2 #include <Interface_Macros.hxx>
3 #include <Interface_Category.hxx>
5 #include <IGESDraw_CircArraySubfigure.hxx>
6 #include <IGESDraw_ConnectPoint.hxx>
7 #include <IGESDraw_Drawing.hxx>
8 #include <IGESDraw_DrawingWithRotation.hxx>
9 #include <IGESDraw_LabelDisplay.hxx>
10 #include <IGESDraw_NetworkSubfigure.hxx>
11 #include <IGESDraw_NetworkSubfigureDef.hxx>
12 #include <IGESDraw_PerspectiveView.hxx>
13 #include <IGESDraw_Planar.hxx>
14 #include <IGESDraw_RectArraySubfigure.hxx>
15 #include <IGESDraw_SegmentedViewsVisible.hxx>
16 #include <IGESDraw_View.hxx>
17 #include <IGESDraw_ViewsVisible.hxx>
18 #include <IGESDraw_ViewsVisibleWithAttr.hxx>
20 #include <IGESDraw_ToolCircArraySubfigure.hxx>
21 #include <IGESDraw_ToolConnectPoint.hxx>
22 #include <IGESDraw_ToolDrawing.hxx>
23 #include <IGESDraw_ToolDrawingWithRotation.hxx>
24 #include <IGESDraw_ToolLabelDisplay.hxx>
25 #include <IGESDraw_ToolNetworkSubfigure.hxx>
26 #include <IGESDraw_ToolNetworkSubfigureDef.hxx>
27 #include <IGESDraw_ToolPerspectiveView.hxx>
28 #include <IGESDraw_ToolPlanar.hxx>
29 #include <IGESDraw_ToolRectArraySubfigure.hxx>
30 #include <IGESDraw_ToolSegmentedViewsVisible.hxx>
31 #include <IGESDraw_ToolView.hxx>
32 #include <IGESDraw_ToolViewsVisible.hxx>
33 #include <IGESDraw_ToolViewsVisibleWithAttr.hxx>
37 // Each Module is attached to a Protocol : it must interprete Case Numbers
38 // (arguments <CN> of various methods) in accordance to values returned by
39 // the method TypeNumber from this Protocol
42 IGESDraw_GeneralModule::IGESDraw_GeneralModule () { }
45 void IGESDraw_GeneralModule::OwnSharedCase
46 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
47 Interface_EntityIterator& iter) const
51 DeclareAndCast(IGESDraw_CircArraySubfigure,anent,ent);
52 if (anent.IsNull()) return;
53 IGESDraw_ToolCircArraySubfigure tool;
54 tool.OwnShared(anent,iter);
58 DeclareAndCast(IGESDraw_ConnectPoint,anent,ent);
59 if (anent.IsNull()) return;
60 IGESDraw_ToolConnectPoint tool;
61 tool.OwnShared(anent,iter);
65 DeclareAndCast(IGESDraw_Drawing,anent,ent);
66 if (anent.IsNull()) return;
67 IGESDraw_ToolDrawing tool;
68 tool.OwnShared(anent,iter);
72 DeclareAndCast(IGESDraw_DrawingWithRotation,anent,ent);
73 if (anent.IsNull()) return;
74 IGESDraw_ToolDrawingWithRotation tool;
75 tool.OwnShared(anent,iter);
79 DeclareAndCast(IGESDraw_LabelDisplay,anent,ent);
80 if (anent.IsNull()) return;
81 IGESDraw_ToolLabelDisplay tool;
82 tool.OwnShared(anent,iter);
86 DeclareAndCast(IGESDraw_NetworkSubfigure,anent,ent);
87 if (anent.IsNull()) return;
88 IGESDraw_ToolNetworkSubfigure tool;
89 tool.OwnShared(anent,iter);
93 DeclareAndCast(IGESDraw_NetworkSubfigureDef,anent,ent);
94 if (anent.IsNull()) return;
95 IGESDraw_ToolNetworkSubfigureDef tool;
96 tool.OwnShared(anent,iter);
100 DeclareAndCast(IGESDraw_PerspectiveView,anent,ent);
101 if (anent.IsNull()) return;
102 IGESDraw_ToolPerspectiveView tool;
103 tool.OwnShared(anent,iter);
107 DeclareAndCast(IGESDraw_Planar,anent,ent);
108 if (anent.IsNull()) return;
109 IGESDraw_ToolPlanar tool;
110 tool.OwnShared(anent,iter);
114 DeclareAndCast(IGESDraw_RectArraySubfigure,anent,ent);
115 if (anent.IsNull()) return;
116 IGESDraw_ToolRectArraySubfigure tool;
117 tool.OwnShared(anent,iter);
121 DeclareAndCast(IGESDraw_SegmentedViewsVisible,anent,ent);
122 if (anent.IsNull()) return;
123 IGESDraw_ToolSegmentedViewsVisible tool;
124 tool.OwnShared(anent,iter);
128 DeclareAndCast(IGESDraw_View,anent,ent);
129 if (anent.IsNull()) return;
130 IGESDraw_ToolView tool;
131 tool.OwnShared(anent,iter);
135 DeclareAndCast(IGESDraw_ViewsVisible,anent,ent);
136 if (anent.IsNull()) return;
137 IGESDraw_ToolViewsVisible tool;
138 tool.OwnShared(anent,iter);
142 DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,anent,ent);
143 if (anent.IsNull()) return;
144 IGESDraw_ToolViewsVisibleWithAttr tool;
145 tool.OwnShared(anent,iter);
152 void IGESDraw_GeneralModule::OwnImpliedCase
153 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
154 Interface_EntityIterator& iter) const
158 DeclareAndCast(IGESDraw_ViewsVisible,anent,ent);
159 if (anent.IsNull()) break;
160 IGESDraw_ToolViewsVisible tool;
161 tool.OwnImplied(anent,iter);
164 DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,anent,ent);
165 if (anent.IsNull()) break;
166 IGESDraw_ToolViewsVisibleWithAttr tool;
167 tool.OwnImplied(anent,iter);
175 IGESData_DirChecker IGESDraw_GeneralModule::DirChecker
176 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent) const
180 DeclareAndCast(IGESDraw_CircArraySubfigure,anent,ent);
181 if (anent.IsNull()) break;
182 IGESDraw_ToolCircArraySubfigure tool;
183 return tool.DirChecker(anent);
186 DeclareAndCast(IGESDraw_ConnectPoint,anent,ent);
187 if (anent.IsNull()) break;
188 IGESDraw_ToolConnectPoint tool;
189 return tool.DirChecker(anent);
192 DeclareAndCast(IGESDraw_Drawing,anent,ent);
193 if (anent.IsNull()) break;
194 IGESDraw_ToolDrawing tool;
195 return tool.DirChecker(anent);
198 DeclareAndCast(IGESDraw_DrawingWithRotation,anent,ent);
199 if (anent.IsNull()) break;
200 IGESDraw_ToolDrawingWithRotation tool;
201 return tool.DirChecker(anent);
204 DeclareAndCast(IGESDraw_LabelDisplay,anent,ent);
205 if (anent.IsNull()) break;
206 IGESDraw_ToolLabelDisplay tool;
207 return tool.DirChecker(anent);
210 DeclareAndCast(IGESDraw_NetworkSubfigure,anent,ent);
211 if (anent.IsNull()) break;
212 IGESDraw_ToolNetworkSubfigure tool;
213 return tool.DirChecker(anent);
216 DeclareAndCast(IGESDraw_NetworkSubfigureDef,anent,ent);
217 if (anent.IsNull()) break;
218 IGESDraw_ToolNetworkSubfigureDef tool;
219 return tool.DirChecker(anent);
222 DeclareAndCast(IGESDraw_PerspectiveView,anent,ent);
223 if (anent.IsNull()) break;
224 IGESDraw_ToolPerspectiveView tool;
225 return tool.DirChecker(anent);
228 DeclareAndCast(IGESDraw_Planar,anent,ent);
229 if (anent.IsNull()) break;
230 IGESDraw_ToolPlanar tool;
231 return tool.DirChecker(anent);
234 DeclareAndCast(IGESDraw_RectArraySubfigure,anent,ent);
235 if (anent.IsNull()) break;
236 IGESDraw_ToolRectArraySubfigure tool;
237 return tool.DirChecker(anent);
240 DeclareAndCast(IGESDraw_SegmentedViewsVisible,anent,ent);
241 if (anent.IsNull()) break;
242 IGESDraw_ToolSegmentedViewsVisible tool;
243 return tool.DirChecker(anent);
246 DeclareAndCast(IGESDraw_View,anent,ent);
247 if (anent.IsNull()) break;
248 IGESDraw_ToolView tool;
249 return tool.DirChecker(anent);
252 DeclareAndCast(IGESDraw_ViewsVisible,anent,ent);
253 if (anent.IsNull()) break;
254 IGESDraw_ToolViewsVisible tool;
255 return tool.DirChecker(anent);
258 DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,anent,ent);
259 if (anent.IsNull()) break;
260 IGESDraw_ToolViewsVisibleWithAttr tool;
261 return tool.DirChecker(anent);
265 return IGESData_DirChecker(); // by default, no specific criterium
269 void IGESDraw_GeneralModule::OwnCheckCase
270 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
271 const Interface_ShareTool& shares, Handle(Interface_Check)& ach) const
275 DeclareAndCast(IGESDraw_CircArraySubfigure,anent,ent);
276 if (anent.IsNull()) return;
277 IGESDraw_ToolCircArraySubfigure tool;
278 tool.OwnCheck(anent,shares,ach);
282 DeclareAndCast(IGESDraw_ConnectPoint,anent,ent);
283 if (anent.IsNull()) return;
284 IGESDraw_ToolConnectPoint tool;
285 tool.OwnCheck(anent,shares,ach);
289 DeclareAndCast(IGESDraw_Drawing,anent,ent);
290 if (anent.IsNull()) return;
291 IGESDraw_ToolDrawing tool;
292 tool.OwnCheck(anent,shares,ach);
296 DeclareAndCast(IGESDraw_DrawingWithRotation,anent,ent);
297 if (anent.IsNull()) return;
298 IGESDraw_ToolDrawingWithRotation tool;
299 tool.OwnCheck(anent,shares,ach);
303 DeclareAndCast(IGESDraw_LabelDisplay,anent,ent);
304 if (anent.IsNull()) return;
305 IGESDraw_ToolLabelDisplay tool;
306 tool.OwnCheck(anent,shares,ach);
310 DeclareAndCast(IGESDraw_NetworkSubfigure,anent,ent);
311 if (anent.IsNull()) return;
312 IGESDraw_ToolNetworkSubfigure tool;
313 tool.OwnCheck(anent,shares,ach);
317 DeclareAndCast(IGESDraw_NetworkSubfigureDef,anent,ent);
318 if (anent.IsNull()) return;
319 IGESDraw_ToolNetworkSubfigureDef tool;
320 tool.OwnCheck(anent,shares,ach);
324 DeclareAndCast(IGESDraw_PerspectiveView,anent,ent);
325 if (anent.IsNull()) return;
326 IGESDraw_ToolPerspectiveView tool;
327 tool.OwnCheck(anent,shares,ach);
331 DeclareAndCast(IGESDraw_Planar,anent,ent);
332 if (anent.IsNull()) return;
333 IGESDraw_ToolPlanar tool;
334 tool.OwnCheck(anent,shares,ach);
338 DeclareAndCast(IGESDraw_RectArraySubfigure,anent,ent);
339 if (anent.IsNull()) return;
340 IGESDraw_ToolRectArraySubfigure tool;
341 tool.OwnCheck(anent,shares,ach);
345 DeclareAndCast(IGESDraw_SegmentedViewsVisible,anent,ent);
346 if (anent.IsNull()) return;
347 IGESDraw_ToolSegmentedViewsVisible tool;
348 tool.OwnCheck(anent,shares,ach);
352 DeclareAndCast(IGESDraw_View,anent,ent);
353 if (anent.IsNull()) return;
354 IGESDraw_ToolView tool;
355 tool.OwnCheck(anent,shares,ach);
359 DeclareAndCast(IGESDraw_ViewsVisible,anent,ent);
360 if (anent.IsNull()) return;
361 IGESDraw_ToolViewsVisible tool;
362 tool.OwnCheck(anent,shares,ach);
366 DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,anent,ent);
367 if (anent.IsNull()) return;
368 IGESDraw_ToolViewsVisibleWithAttr tool;
369 tool.OwnCheck(anent,shares,ach);
377 Standard_Boolean IGESDraw_GeneralModule::NewVoid
378 (const Standard_Integer CN, Handle(Standard_Transient)& ent) const
381 case 1 : ent = new IGESDraw_CircArraySubfigure; break;
382 case 2 : ent = new IGESDraw_ConnectPoint; break;
383 case 3 : ent = new IGESDraw_Drawing; break;
384 case 4 : ent = new IGESDraw_DrawingWithRotation; break;
385 case 5 : ent = new IGESDraw_LabelDisplay; break;
386 case 6 : ent = new IGESDraw_NetworkSubfigure; break;
387 case 7 : ent = new IGESDraw_NetworkSubfigureDef; break;
388 case 8 : ent = new IGESDraw_PerspectiveView; break;
389 case 9 : ent = new IGESDraw_Planar; break;
390 case 10 : ent = new IGESDraw_RectArraySubfigure; break;
391 case 11 : ent = new IGESDraw_SegmentedViewsVisible; break;
392 case 12 : ent = new IGESDraw_View; break;
393 case 13 : ent = new IGESDraw_ViewsVisible; break;
394 case 14 : ent = new IGESDraw_ViewsVisibleWithAttr; break;
395 default : return Standard_False; // by default, Failure on Recognize
397 return Standard_True;
401 void IGESDraw_GeneralModule::OwnCopyCase
402 (const Standard_Integer CN,
403 const Handle(IGESData_IGESEntity)& entfrom,
404 const Handle(IGESData_IGESEntity)& entto,
405 Interface_CopyTool& TC) const
409 DeclareAndCast(IGESDraw_CircArraySubfigure,enfr,entfrom);
410 DeclareAndCast(IGESDraw_CircArraySubfigure,ento,entto);
411 IGESDraw_ToolCircArraySubfigure tool;
412 tool.OwnCopy(enfr,ento,TC);
416 DeclareAndCast(IGESDraw_ConnectPoint,enfr,entfrom);
417 DeclareAndCast(IGESDraw_ConnectPoint,ento,entto);
418 IGESDraw_ToolConnectPoint tool;
419 tool.OwnCopy(enfr,ento,TC);
423 DeclareAndCast(IGESDraw_Drawing,enfr,entfrom);
424 DeclareAndCast(IGESDraw_Drawing,ento,entto);
425 IGESDraw_ToolDrawing tool;
426 tool.OwnCopy(enfr,ento,TC);
430 DeclareAndCast(IGESDraw_DrawingWithRotation,enfr,entfrom);
431 DeclareAndCast(IGESDraw_DrawingWithRotation,ento,entto);
432 IGESDraw_ToolDrawingWithRotation tool;
433 tool.OwnCopy(enfr,ento,TC);
437 DeclareAndCast(IGESDraw_LabelDisplay,enfr,entfrom);
438 DeclareAndCast(IGESDraw_LabelDisplay,ento,entto);
439 IGESDraw_ToolLabelDisplay tool;
440 tool.OwnCopy(enfr,ento,TC);
444 DeclareAndCast(IGESDraw_NetworkSubfigure,enfr,entfrom);
445 DeclareAndCast(IGESDraw_NetworkSubfigure,ento,entto);
446 IGESDraw_ToolNetworkSubfigure tool;
447 tool.OwnCopy(enfr,ento,TC);
451 DeclareAndCast(IGESDraw_NetworkSubfigureDef,enfr,entfrom);
452 DeclareAndCast(IGESDraw_NetworkSubfigureDef,ento,entto);
453 IGESDraw_ToolNetworkSubfigureDef tool;
454 tool.OwnCopy(enfr,ento,TC);
458 DeclareAndCast(IGESDraw_PerspectiveView,enfr,entfrom);
459 DeclareAndCast(IGESDraw_PerspectiveView,ento,entto);
460 IGESDraw_ToolPerspectiveView tool;
461 tool.OwnCopy(enfr,ento,TC);
465 DeclareAndCast(IGESDraw_Planar,enfr,entfrom);
466 DeclareAndCast(IGESDraw_Planar,ento,entto);
467 IGESDraw_ToolPlanar tool;
468 tool.OwnCopy(enfr,ento,TC);
472 DeclareAndCast(IGESDraw_RectArraySubfigure,enfr,entfrom);
473 DeclareAndCast(IGESDraw_RectArraySubfigure,ento,entto);
474 IGESDraw_ToolRectArraySubfigure tool;
475 tool.OwnCopy(enfr,ento,TC);
479 DeclareAndCast(IGESDraw_SegmentedViewsVisible,enfr,entfrom);
480 DeclareAndCast(IGESDraw_SegmentedViewsVisible,ento,entto);
481 IGESDraw_ToolSegmentedViewsVisible tool;
482 tool.OwnCopy(enfr,ento,TC);
486 DeclareAndCast(IGESDraw_View,enfr,entfrom);
487 DeclareAndCast(IGESDraw_View,ento,entto);
488 IGESDraw_ToolView tool;
489 tool.OwnCopy(enfr,ento,TC);
493 DeclareAndCast(IGESDraw_ViewsVisible,enfr,entfrom);
494 DeclareAndCast(IGESDraw_ViewsVisible,ento,entto);
495 IGESDraw_ToolViewsVisible tool;
496 tool.OwnCopy(enfr,ento,TC);
500 DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,enfr,entfrom);
501 DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,ento,entto);
502 IGESDraw_ToolViewsVisibleWithAttr tool;
503 tool.OwnCopy(enfr,ento,TC);
511 void IGESDraw_GeneralModule::OwnRenewCase
512 (const Standard_Integer CN,
513 const Handle(IGESData_IGESEntity)& entfrom,
514 const Handle(IGESData_IGESEntity)& entto,
515 const Interface_CopyTool& TC) const
519 DeclareAndCast(IGESDraw_ViewsVisible,enfr,entfrom);
520 DeclareAndCast(IGESDraw_ViewsVisible,ento,entto);
521 IGESDraw_ToolViewsVisible tool;
522 tool.OwnRenew(enfr,ento,TC);
526 DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,enfr,entfrom);
527 DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,ento,entto);
528 IGESDraw_ToolViewsVisibleWithAttr tool;
529 tool.OwnRenew(enfr,ento,TC);
537 void IGESDraw_GeneralModule::OwnDeleteCase
538 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent) const
542 DeclareAndCast(IGESDraw_ViewsVisible,anent,ent);
543 IGESDraw_ToolViewsVisible tool;
544 tool.OwnWhenDelete(anent);
548 DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,anent,ent);
549 IGESDraw_ToolViewsVisibleWithAttr tool;
550 tool.OwnWhenDelete(anent);
558 Standard_Integer IGESDraw_GeneralModule::CategoryNumber
559 (const Standard_Integer CN, const Handle(Standard_Transient)& ,
560 const Interface_ShareTool& ) const
562 if (CN == 9) return Interface_Category::Number("Auxiliary");
563 if (CN == 1 || CN == 2 || CN == 10) return Interface_Category::Number("Structure");
564 return Interface_Category::Number("Drawing");