Integration of OCCT 6.5.0 from SVN
[occt.git] / src / IGESDraw / IGESDraw_GeneralModule.cxx
1 #include <IGESDraw_GeneralModule.ixx>
2 #include <Interface_Macros.hxx>
3 #include <Interface_Category.hxx>
4
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>
19
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>
34
35
36
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
40
41
42     IGESDraw_GeneralModule::IGESDraw_GeneralModule ()    {  }
43
44
45     void  IGESDraw_GeneralModule::OwnSharedCase
46   (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
47    Interface_EntityIterator& iter) const 
48 {
49   switch (CN) {
50     case  1 : {
51       DeclareAndCast(IGESDraw_CircArraySubfigure,anent,ent);
52       if (anent.IsNull()) return;
53       IGESDraw_ToolCircArraySubfigure tool;
54       tool.OwnShared(anent,iter);
55     }
56       break;
57     case  2 : {
58       DeclareAndCast(IGESDraw_ConnectPoint,anent,ent);
59       if (anent.IsNull()) return;
60       IGESDraw_ToolConnectPoint tool;
61       tool.OwnShared(anent,iter);
62     }
63       break;
64     case  3 : {
65       DeclareAndCast(IGESDraw_Drawing,anent,ent);
66       if (anent.IsNull()) return;
67       IGESDraw_ToolDrawing tool;
68       tool.OwnShared(anent,iter);
69     }
70       break;
71     case  4 : {
72       DeclareAndCast(IGESDraw_DrawingWithRotation,anent,ent);
73       if (anent.IsNull()) return;
74       IGESDraw_ToolDrawingWithRotation tool;
75       tool.OwnShared(anent,iter);
76     }
77       break;
78     case  5 : {
79       DeclareAndCast(IGESDraw_LabelDisplay,anent,ent);
80       if (anent.IsNull()) return;
81       IGESDraw_ToolLabelDisplay tool;
82       tool.OwnShared(anent,iter);
83     }
84       break;
85     case  6 : {
86       DeclareAndCast(IGESDraw_NetworkSubfigure,anent,ent);
87       if (anent.IsNull()) return;
88       IGESDraw_ToolNetworkSubfigure tool;
89       tool.OwnShared(anent,iter);
90     }
91       break;
92     case  7 : {
93       DeclareAndCast(IGESDraw_NetworkSubfigureDef,anent,ent);
94       if (anent.IsNull()) return;
95       IGESDraw_ToolNetworkSubfigureDef tool;
96       tool.OwnShared(anent,iter);
97     }
98       break;
99     case  8 : {
100       DeclareAndCast(IGESDraw_PerspectiveView,anent,ent);
101       if (anent.IsNull()) return;
102       IGESDraw_ToolPerspectiveView tool;
103       tool.OwnShared(anent,iter);
104     }
105       break;
106     case  9 : {
107       DeclareAndCast(IGESDraw_Planar,anent,ent);
108       if (anent.IsNull()) return;
109       IGESDraw_ToolPlanar tool;
110       tool.OwnShared(anent,iter);
111     }
112       break;
113     case 10 : {
114       DeclareAndCast(IGESDraw_RectArraySubfigure,anent,ent);
115       if (anent.IsNull()) return;
116       IGESDraw_ToolRectArraySubfigure tool;
117       tool.OwnShared(anent,iter);
118     }
119       break;
120     case 11 : {
121       DeclareAndCast(IGESDraw_SegmentedViewsVisible,anent,ent);
122       if (anent.IsNull()) return;
123       IGESDraw_ToolSegmentedViewsVisible tool;
124       tool.OwnShared(anent,iter);
125     }
126       break;
127     case 12 : {
128       DeclareAndCast(IGESDraw_View,anent,ent);
129       if (anent.IsNull()) return;
130       IGESDraw_ToolView tool;
131       tool.OwnShared(anent,iter);
132     }
133       break;
134     case 13 : {
135       DeclareAndCast(IGESDraw_ViewsVisible,anent,ent);
136       if (anent.IsNull()) return;
137       IGESDraw_ToolViewsVisible tool;
138       tool.OwnShared(anent,iter);
139     }
140       break;
141     case 14 : {
142       DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,anent,ent);
143       if (anent.IsNull()) return;
144       IGESDraw_ToolViewsVisibleWithAttr tool;
145       tool.OwnShared(anent,iter);
146     }
147       break;
148     default : break;
149   }
150 }
151
152     void  IGESDraw_GeneralModule::OwnImpliedCase
153   (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
154    Interface_EntityIterator& iter) const 
155 {
156   switch (CN ) {
157     case 13 : {
158       DeclareAndCast(IGESDraw_ViewsVisible,anent,ent);
159       if (anent.IsNull()) break;
160       IGESDraw_ToolViewsVisible tool;
161       tool.OwnImplied(anent,iter);
162     }
163     case 14 : {
164       DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,anent,ent);
165       if (anent.IsNull()) break;
166       IGESDraw_ToolViewsVisibleWithAttr tool;
167       tool.OwnImplied(anent,iter);
168     }
169     default : break;
170   }
171 }
172
173
174
175     IGESData_DirChecker  IGESDraw_GeneralModule::DirChecker
176   (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent) const 
177 {
178   switch (CN) {
179     case  1 : {
180       DeclareAndCast(IGESDraw_CircArraySubfigure,anent,ent);
181       if (anent.IsNull()) break;
182       IGESDraw_ToolCircArraySubfigure tool;
183       return tool.DirChecker(anent);
184     }
185     case  2 : {
186       DeclareAndCast(IGESDraw_ConnectPoint,anent,ent);
187       if (anent.IsNull()) break;
188       IGESDraw_ToolConnectPoint tool;
189       return tool.DirChecker(anent);
190     }
191     case  3 : {
192       DeclareAndCast(IGESDraw_Drawing,anent,ent);
193       if (anent.IsNull()) break;
194       IGESDraw_ToolDrawing tool;
195       return tool.DirChecker(anent);
196     }
197     case  4 : {
198       DeclareAndCast(IGESDraw_DrawingWithRotation,anent,ent);
199       if (anent.IsNull()) break;
200       IGESDraw_ToolDrawingWithRotation tool;
201       return tool.DirChecker(anent);
202     }
203     case  5 : {
204       DeclareAndCast(IGESDraw_LabelDisplay,anent,ent);
205       if (anent.IsNull()) break;
206       IGESDraw_ToolLabelDisplay tool;
207       return tool.DirChecker(anent);
208     }
209     case  6 : {
210       DeclareAndCast(IGESDraw_NetworkSubfigure,anent,ent);
211       if (anent.IsNull()) break;
212       IGESDraw_ToolNetworkSubfigure tool;
213       return tool.DirChecker(anent);
214     }
215     case  7 : {
216       DeclareAndCast(IGESDraw_NetworkSubfigureDef,anent,ent);
217       if (anent.IsNull()) break;
218       IGESDraw_ToolNetworkSubfigureDef tool;
219       return tool.DirChecker(anent);
220     }
221     case  8 : {
222       DeclareAndCast(IGESDraw_PerspectiveView,anent,ent);
223       if (anent.IsNull()) break;
224       IGESDraw_ToolPerspectiveView tool;
225       return tool.DirChecker(anent);
226     }
227     case  9 : {
228       DeclareAndCast(IGESDraw_Planar,anent,ent);
229       if (anent.IsNull()) break;
230       IGESDraw_ToolPlanar tool;
231       return tool.DirChecker(anent);
232     }
233     case 10 : {
234       DeclareAndCast(IGESDraw_RectArraySubfigure,anent,ent);
235       if (anent.IsNull()) break;
236       IGESDraw_ToolRectArraySubfigure tool;
237       return tool.DirChecker(anent);
238     }
239     case 11 : {
240       DeclareAndCast(IGESDraw_SegmentedViewsVisible,anent,ent);
241       if (anent.IsNull()) break;
242       IGESDraw_ToolSegmentedViewsVisible tool;
243       return tool.DirChecker(anent);
244     }
245     case 12 : {
246       DeclareAndCast(IGESDraw_View,anent,ent);
247       if (anent.IsNull()) break;
248       IGESDraw_ToolView tool;
249       return tool.DirChecker(anent);
250     }
251     case 13 : {
252       DeclareAndCast(IGESDraw_ViewsVisible,anent,ent);
253       if (anent.IsNull()) break;
254       IGESDraw_ToolViewsVisible tool;
255       return tool.DirChecker(anent);
256     }
257     case 14 : {
258       DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,anent,ent);
259       if (anent.IsNull()) break;
260       IGESDraw_ToolViewsVisibleWithAttr tool;
261       return tool.DirChecker(anent);
262     }
263     default : break;
264   }
265   return IGESData_DirChecker();    // by default, no specific criterium
266 }
267
268
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 
272 {
273   switch (CN) {
274     case  1 : {
275       DeclareAndCast(IGESDraw_CircArraySubfigure,anent,ent);
276       if (anent.IsNull()) return;
277       IGESDraw_ToolCircArraySubfigure tool;
278       tool.OwnCheck(anent,shares,ach);
279     }
280       break;
281     case  2 : {
282       DeclareAndCast(IGESDraw_ConnectPoint,anent,ent);
283       if (anent.IsNull()) return;
284       IGESDraw_ToolConnectPoint tool;
285       tool.OwnCheck(anent,shares,ach);
286     }
287       break;
288     case  3 : {
289       DeclareAndCast(IGESDraw_Drawing,anent,ent);
290       if (anent.IsNull()) return;
291       IGESDraw_ToolDrawing tool;
292       tool.OwnCheck(anent,shares,ach);
293     }
294       break;
295     case  4 : {
296       DeclareAndCast(IGESDraw_DrawingWithRotation,anent,ent);
297       if (anent.IsNull()) return;
298       IGESDraw_ToolDrawingWithRotation tool;
299       tool.OwnCheck(anent,shares,ach);
300     }
301       break;
302     case  5 : {
303       DeclareAndCast(IGESDraw_LabelDisplay,anent,ent);
304       if (anent.IsNull()) return;
305       IGESDraw_ToolLabelDisplay tool;
306       tool.OwnCheck(anent,shares,ach);
307     }
308       break;
309     case  6 : {
310       DeclareAndCast(IGESDraw_NetworkSubfigure,anent,ent);
311       if (anent.IsNull()) return;
312       IGESDraw_ToolNetworkSubfigure tool;
313       tool.OwnCheck(anent,shares,ach);
314     }
315       break;
316     case  7 : {
317       DeclareAndCast(IGESDraw_NetworkSubfigureDef,anent,ent);
318       if (anent.IsNull()) return;
319       IGESDraw_ToolNetworkSubfigureDef tool;
320       tool.OwnCheck(anent,shares,ach);
321     }
322       break;
323     case  8 : {
324       DeclareAndCast(IGESDraw_PerspectiveView,anent,ent);
325       if (anent.IsNull()) return;
326       IGESDraw_ToolPerspectiveView tool;
327       tool.OwnCheck(anent,shares,ach);
328     }
329       break;
330     case  9 : {
331       DeclareAndCast(IGESDraw_Planar,anent,ent);
332       if (anent.IsNull()) return;
333       IGESDraw_ToolPlanar tool;
334       tool.OwnCheck(anent,shares,ach);
335     }
336       break;
337     case 10 : {
338       DeclareAndCast(IGESDraw_RectArraySubfigure,anent,ent);
339       if (anent.IsNull()) return;
340       IGESDraw_ToolRectArraySubfigure tool;
341       tool.OwnCheck(anent,shares,ach);
342     }
343       break;
344     case 11 : {
345       DeclareAndCast(IGESDraw_SegmentedViewsVisible,anent,ent);
346       if (anent.IsNull()) return;
347       IGESDraw_ToolSegmentedViewsVisible tool;
348       tool.OwnCheck(anent,shares,ach);
349     }
350       break;
351     case 12 : {
352       DeclareAndCast(IGESDraw_View,anent,ent);
353       if (anent.IsNull()) return;
354       IGESDraw_ToolView tool;
355       tool.OwnCheck(anent,shares,ach);
356     }
357       break;
358     case 13 : {
359       DeclareAndCast(IGESDraw_ViewsVisible,anent,ent);
360       if (anent.IsNull()) return;
361       IGESDraw_ToolViewsVisible tool;
362       tool.OwnCheck(anent,shares,ach);
363     }
364       break;
365     case 14 : {
366       DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,anent,ent);
367       if (anent.IsNull()) return;
368       IGESDraw_ToolViewsVisibleWithAttr tool;
369       tool.OwnCheck(anent,shares,ach);
370     }
371       break;
372     default : break;
373   }
374 }
375
376
377     Standard_Boolean  IGESDraw_GeneralModule::NewVoid
378   (const Standard_Integer CN, Handle(Standard_Transient)& ent) const 
379 {
380   switch (CN) {
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
396   }
397   return Standard_True;
398 }
399
400
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 
406 {
407   switch (CN) {
408     case  1 : {
409       DeclareAndCast(IGESDraw_CircArraySubfigure,enfr,entfrom);
410       DeclareAndCast(IGESDraw_CircArraySubfigure,ento,entto);
411       IGESDraw_ToolCircArraySubfigure tool;
412       tool.OwnCopy(enfr,ento,TC);
413     }
414       break;
415     case  2 : {
416       DeclareAndCast(IGESDraw_ConnectPoint,enfr,entfrom);
417       DeclareAndCast(IGESDraw_ConnectPoint,ento,entto);
418       IGESDraw_ToolConnectPoint tool;
419       tool.OwnCopy(enfr,ento,TC);
420     }
421       break;
422     case  3 : {
423       DeclareAndCast(IGESDraw_Drawing,enfr,entfrom);
424       DeclareAndCast(IGESDraw_Drawing,ento,entto);
425       IGESDraw_ToolDrawing tool;
426       tool.OwnCopy(enfr,ento,TC);
427     }
428       break;
429     case  4 : {
430       DeclareAndCast(IGESDraw_DrawingWithRotation,enfr,entfrom);
431       DeclareAndCast(IGESDraw_DrawingWithRotation,ento,entto);
432       IGESDraw_ToolDrawingWithRotation tool;
433       tool.OwnCopy(enfr,ento,TC);
434     }
435       break;
436     case  5 : {
437       DeclareAndCast(IGESDraw_LabelDisplay,enfr,entfrom);
438       DeclareAndCast(IGESDraw_LabelDisplay,ento,entto);
439       IGESDraw_ToolLabelDisplay tool;
440       tool.OwnCopy(enfr,ento,TC);
441     }
442       break;
443     case  6 : {
444       DeclareAndCast(IGESDraw_NetworkSubfigure,enfr,entfrom);
445       DeclareAndCast(IGESDraw_NetworkSubfigure,ento,entto);
446       IGESDraw_ToolNetworkSubfigure tool;
447       tool.OwnCopy(enfr,ento,TC);
448     }
449       break;
450     case  7 : {
451       DeclareAndCast(IGESDraw_NetworkSubfigureDef,enfr,entfrom);
452       DeclareAndCast(IGESDraw_NetworkSubfigureDef,ento,entto);
453       IGESDraw_ToolNetworkSubfigureDef tool;
454       tool.OwnCopy(enfr,ento,TC);
455     }
456       break;
457     case  8 : {
458       DeclareAndCast(IGESDraw_PerspectiveView,enfr,entfrom);
459       DeclareAndCast(IGESDraw_PerspectiveView,ento,entto);
460       IGESDraw_ToolPerspectiveView tool;
461       tool.OwnCopy(enfr,ento,TC);
462     }
463       break;
464     case  9 : {
465       DeclareAndCast(IGESDraw_Planar,enfr,entfrom);
466       DeclareAndCast(IGESDraw_Planar,ento,entto);
467       IGESDraw_ToolPlanar tool;
468       tool.OwnCopy(enfr,ento,TC);
469     }
470       break;
471     case 10 : {
472       DeclareAndCast(IGESDraw_RectArraySubfigure,enfr,entfrom);
473       DeclareAndCast(IGESDraw_RectArraySubfigure,ento,entto);
474       IGESDraw_ToolRectArraySubfigure tool;
475       tool.OwnCopy(enfr,ento,TC);
476     }
477       break;
478     case 11 : {
479       DeclareAndCast(IGESDraw_SegmentedViewsVisible,enfr,entfrom);
480       DeclareAndCast(IGESDraw_SegmentedViewsVisible,ento,entto);
481       IGESDraw_ToolSegmentedViewsVisible tool;
482       tool.OwnCopy(enfr,ento,TC);
483     }
484       break;
485     case 12 : {
486       DeclareAndCast(IGESDraw_View,enfr,entfrom);
487       DeclareAndCast(IGESDraw_View,ento,entto);
488       IGESDraw_ToolView tool;
489       tool.OwnCopy(enfr,ento,TC);
490     }
491       break;
492     case 13 : {
493       DeclareAndCast(IGESDraw_ViewsVisible,enfr,entfrom);
494       DeclareAndCast(IGESDraw_ViewsVisible,ento,entto);
495       IGESDraw_ToolViewsVisible tool;
496       tool.OwnCopy(enfr,ento,TC);
497     }
498       break;
499     case 14 : {
500       DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,enfr,entfrom);
501       DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,ento,entto);
502       IGESDraw_ToolViewsVisibleWithAttr tool;
503       tool.OwnCopy(enfr,ento,TC);
504     }
505       break;
506     default : break;
507   }
508 }
509
510
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 
516 {
517   switch (CN) {
518     case 13 : {
519       DeclareAndCast(IGESDraw_ViewsVisible,enfr,entfrom);
520       DeclareAndCast(IGESDraw_ViewsVisible,ento,entto);
521       IGESDraw_ToolViewsVisible tool;
522       tool.OwnRenew(enfr,ento,TC);
523     }
524       break;
525     case 14 : {
526       DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,enfr,entfrom);
527       DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,ento,entto);
528       IGESDraw_ToolViewsVisibleWithAttr tool;
529       tool.OwnRenew(enfr,ento,TC);
530     }
531       break;
532     default : break;
533   }
534 }
535
536
537     void  IGESDraw_GeneralModule::OwnDeleteCase
538   (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent) const
539 {
540   switch (CN) {
541     case 13 : {
542       DeclareAndCast(IGESDraw_ViewsVisible,anent,ent);
543       IGESDraw_ToolViewsVisible tool;
544       tool.OwnWhenDelete(anent);
545     }
546       break;
547     case 14 : {
548       DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,anent,ent);
549       IGESDraw_ToolViewsVisibleWithAttr tool;
550       tool.OwnWhenDelete(anent);
551     }
552       break;
553     default : break;
554   }
555 }
556
557
558     Standard_Integer  IGESDraw_GeneralModule::CategoryNumber
559   (const Standard_Integer CN, const Handle(Standard_Transient)& ,
560    const Interface_ShareTool& ) const
561 {
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");
565 }