0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / IGESDraw / IGESDraw_SpecificModule.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <IGESData_IGESDumper.hxx>
16 #include <IGESData_IGESEntity.hxx>
17 #include <IGESDraw_CircArraySubfigure.hxx>
18 #include <IGESDraw_ConnectPoint.hxx>
19 #include <IGESDraw_Drawing.hxx>
20 #include <IGESDraw_DrawingWithRotation.hxx>
21 #include <IGESDraw_LabelDisplay.hxx>
22 #include <IGESDraw_NetworkSubfigure.hxx>
23 #include <IGESDraw_NetworkSubfigureDef.hxx>
24 #include <IGESDraw_PerspectiveView.hxx>
25 #include <IGESDraw_Planar.hxx>
26 #include <IGESDraw_RectArraySubfigure.hxx>
27 #include <IGESDraw_SegmentedViewsVisible.hxx>
28 #include <IGESDraw_SpecificModule.hxx>
29 #include <IGESDraw_ToolCircArraySubfigure.hxx>
30 #include <IGESDraw_ToolConnectPoint.hxx>
31 #include <IGESDraw_ToolDrawing.hxx>
32 #include <IGESDraw_ToolDrawingWithRotation.hxx>
33 #include <IGESDraw_ToolLabelDisplay.hxx>
34 #include <IGESDraw_ToolNetworkSubfigure.hxx>
35 #include <IGESDraw_ToolNetworkSubfigureDef.hxx>
36 #include <IGESDraw_ToolPerspectiveView.hxx>
37 #include <IGESDraw_ToolPlanar.hxx>
38 #include <IGESDraw_ToolRectArraySubfigure.hxx>
39 #include <IGESDraw_ToolSegmentedViewsVisible.hxx>
40 #include <IGESDraw_ToolView.hxx>
41 #include <IGESDraw_ToolViewsVisible.hxx>
42 #include <IGESDraw_ToolViewsVisibleWithAttr.hxx>
43 #include <IGESDraw_View.hxx>
44 #include <IGESDraw_ViewsVisible.hxx>
45 #include <IGESDraw_ViewsVisibleWithAttr.hxx>
46 #include <Interface_Macros.hxx>
47 #include <Message_Messenger.hxx>
48 #include <Standard_Type.hxx>
49
50 IMPLEMENT_STANDARD_RTTIEXT(IGESDraw_SpecificModule,IGESData_SpecificModule)
51
52 //  Each Module is attached to a Protocol : it must interprete Case Numbers
53 //  (arguments <CN> of various methods) in accordance to values returned by
54 //  the method TypeNumber from this Protocol
55 IGESDraw_SpecificModule::IGESDraw_SpecificModule()    {  }
56
57
58     void  IGESDraw_SpecificModule::OwnDump
59   (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
60    const IGESData_IGESDumper& dumper, const Handle(Message_Messenger)& S,
61    const Standard_Integer own) const 
62 {
63   switch (CN) {
64     case  1 : {
65       DeclareAndCast(IGESDraw_CircArraySubfigure,anent,ent);
66       if (anent.IsNull()) return;
67       IGESDraw_ToolCircArraySubfigure tool;
68       tool.OwnDump(anent,dumper,S,own);
69     }
70       break;
71     case  2 : {
72       DeclareAndCast(IGESDraw_ConnectPoint,anent,ent);
73       if (anent.IsNull()) return;
74       IGESDraw_ToolConnectPoint tool;
75       tool.OwnDump(anent,dumper,S,own);
76     }
77       break;
78     case  3 : {
79       DeclareAndCast(IGESDraw_Drawing,anent,ent);
80       if (anent.IsNull()) return;
81       IGESDraw_ToolDrawing tool;
82       tool.OwnDump(anent,dumper,S,own);
83     }
84       break;
85     case  4 : {
86       DeclareAndCast(IGESDraw_DrawingWithRotation,anent,ent);
87       if (anent.IsNull()) return;
88       IGESDraw_ToolDrawingWithRotation tool;
89       tool.OwnDump(anent,dumper,S,own);
90     }
91       break;
92     case  5 : {
93       DeclareAndCast(IGESDraw_LabelDisplay,anent,ent);
94       if (anent.IsNull()) return;
95       IGESDraw_ToolLabelDisplay tool;
96       tool.OwnDump(anent,dumper,S,own);
97     }
98       break;
99     case  6 : {
100       DeclareAndCast(IGESDraw_NetworkSubfigure,anent,ent);
101       if (anent.IsNull()) return;
102       IGESDraw_ToolNetworkSubfigure tool;
103       tool.OwnDump(anent,dumper,S,own);
104     }
105       break;
106     case  7 : {
107       DeclareAndCast(IGESDraw_NetworkSubfigureDef,anent,ent);
108       if (anent.IsNull()) return;
109       IGESDraw_ToolNetworkSubfigureDef tool;
110       tool.OwnDump(anent,dumper,S,own);
111     }
112       break;
113     case  8 : {
114       DeclareAndCast(IGESDraw_PerspectiveView,anent,ent);
115       if (anent.IsNull()) return;
116       IGESDraw_ToolPerspectiveView tool;
117       tool.OwnDump(anent,dumper,S,own);
118     }
119       break;
120     case  9 : {
121       DeclareAndCast(IGESDraw_Planar,anent,ent);
122       if (anent.IsNull()) return;
123       IGESDraw_ToolPlanar tool;
124       tool.OwnDump(anent,dumper,S,own);
125     }
126       break;
127     case 10 : {
128       DeclareAndCast(IGESDraw_RectArraySubfigure,anent,ent);
129       if (anent.IsNull()) return;
130       IGESDraw_ToolRectArraySubfigure tool;
131       tool.OwnDump(anent,dumper,S,own);
132     }
133       break;
134     case 11 : {
135       DeclareAndCast(IGESDraw_SegmentedViewsVisible,anent,ent);
136       if (anent.IsNull()) return;
137       IGESDraw_ToolSegmentedViewsVisible tool;
138       tool.OwnDump(anent,dumper,S,own);
139     }
140       break;
141     case 12 : {
142       DeclareAndCast(IGESDraw_View,anent,ent);
143       if (anent.IsNull()) return;
144       IGESDraw_ToolView tool;
145       tool.OwnDump(anent,dumper,S,own);
146     }
147       break;
148     case 13 : {
149       DeclareAndCast(IGESDraw_ViewsVisible,anent,ent);
150       if (anent.IsNull()) return;
151       IGESDraw_ToolViewsVisible tool;
152       tool.OwnDump(anent,dumper,S,own);
153     }
154       break;
155     case 14 : {
156       DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,anent,ent);
157       if (anent.IsNull()) return;
158       IGESDraw_ToolViewsVisibleWithAttr tool;
159       tool.OwnDump(anent,dumper,S,own);
160     }
161       break;
162     default : break;
163   }
164 }
165
166
167     Standard_Boolean  IGESDraw_SpecificModule::OwnCorrect
168   (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent) const
169 {
170 //   Applies only on some types
171   switch (CN) {
172     case  3 : {
173       DeclareAndCast(IGESDraw_Drawing,anent,ent);
174       if (anent.IsNull()) break;
175       IGESDraw_ToolDrawing tool;
176       return tool.OwnCorrect(anent);
177     }
178     case  4 : {
179       DeclareAndCast(IGESDraw_DrawingWithRotation,anent,ent);
180       if (anent.IsNull()) break;
181       IGESDraw_ToolDrawingWithRotation tool;
182       return tool.OwnCorrect(anent);
183     }
184     case  9 : {
185       DeclareAndCast(IGESDraw_Planar,anent,ent);
186       if (anent.IsNull()) break;
187       IGESDraw_ToolPlanar tool;
188       return tool.OwnCorrect(anent);
189     }
190     case 13 : {
191       DeclareAndCast(IGESDraw_ViewsVisible,anent,ent);
192       if (anent.IsNull()) break;
193       IGESDraw_ToolViewsVisible tool;
194       return tool.OwnCorrect(anent);
195     }
196     case 14 : {
197       DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,anent,ent);
198       if (anent.IsNull()) break;
199       IGESDraw_ToolViewsVisibleWithAttr tool;
200       return tool.OwnCorrect(anent);
201     }
202     default : break;
203   }
204   return Standard_False;
205 }