9dd3484b9efbeeb857b15130cc34e3d07b5f24f3
[occt.git] / src / IGESDimen / IGESDimen_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 <IGESDimen_AngularDimension.hxx>
18 #include <IGESDimen_BasicDimension.hxx>
19 #include <IGESDimen_CenterLine.hxx>
20 #include <IGESDimen_CurveDimension.hxx>
21 #include <IGESDimen_DiameterDimension.hxx>
22 #include <IGESDimen_DimensionDisplayData.hxx>
23 #include <IGESDimen_DimensionedGeometry.hxx>
24 #include <IGESDimen_DimensionTolerance.hxx>
25 #include <IGESDimen_DimensionUnits.hxx>
26 #include <IGESDimen_FlagNote.hxx>
27 #include <IGESDimen_GeneralLabel.hxx>
28 #include <IGESDimen_GeneralNote.hxx>
29 #include <IGESDimen_GeneralSymbol.hxx>
30 #include <IGESDimen_LeaderArrow.hxx>
31 #include <IGESDimen_LinearDimension.hxx>
32 #include <IGESDimen_NewDimensionedGeometry.hxx>
33 #include <IGESDimen_NewGeneralNote.hxx>
34 #include <IGESDimen_OrdinateDimension.hxx>
35 #include <IGESDimen_PointDimension.hxx>
36 #include <IGESDimen_RadiusDimension.hxx>
37 #include <IGESDimen_Section.hxx>
38 #include <IGESDimen_SectionedArea.hxx>
39 #include <IGESDimen_SpecificModule.hxx>
40 #include <IGESDimen_ToolAngularDimension.hxx>
41 #include <IGESDimen_ToolBasicDimension.hxx>
42 #include <IGESDimen_ToolCenterLine.hxx>
43 #include <IGESDimen_ToolCurveDimension.hxx>
44 #include <IGESDimen_ToolDiameterDimension.hxx>
45 #include <IGESDimen_ToolDimensionDisplayData.hxx>
46 #include <IGESDimen_ToolDimensionedGeometry.hxx>
47 #include <IGESDimen_ToolDimensionTolerance.hxx>
48 #include <IGESDimen_ToolDimensionUnits.hxx>
49 #include <IGESDimen_ToolFlagNote.hxx>
50 #include <IGESDimen_ToolGeneralLabel.hxx>
51 #include <IGESDimen_ToolGeneralNote.hxx>
52 #include <IGESDimen_ToolGeneralSymbol.hxx>
53 #include <IGESDimen_ToolLeaderArrow.hxx>
54 #include <IGESDimen_ToolLinearDimension.hxx>
55 #include <IGESDimen_ToolNewDimensionedGeometry.hxx>
56 #include <IGESDimen_ToolNewGeneralNote.hxx>
57 #include <IGESDimen_ToolOrdinateDimension.hxx>
58 #include <IGESDimen_ToolPointDimension.hxx>
59 #include <IGESDimen_ToolRadiusDimension.hxx>
60 #include <IGESDimen_ToolSection.hxx>
61 #include <IGESDimen_ToolSectionedArea.hxx>
62 #include <IGESDimen_ToolWitnessLine.hxx>
63 #include <IGESDimen_WitnessLine.hxx>
64 #include <Interface_Macros.hxx>
65 #include <Message_Messenger.hxx>
66 #include <Standard_Type.hxx>
67
68 IMPLEMENT_STANDARD_RTTIEXT(IGESDimen_SpecificModule,IGESData_SpecificModule)
69
70 //  Each Module is attached to a Protocol : it must interprete Case Numbers
71 //  (arguments <CN> of various methods) in accordance to values returned by
72 //  the method TypeNumber from this Protocol
73 IGESDimen_SpecificModule::IGESDimen_SpecificModule()  {  }
74
75
76     void  IGESDimen_SpecificModule::OwnDump
77   (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
78    const IGESData_IGESDumper& dumper, const Handle(Message_Messenger)& S,
79    const Standard_Integer own) const 
80 {
81   switch (CN) {
82     case  1 : {
83       DeclareAndCast(IGESDimen_AngularDimension,anent,ent);
84       if (anent.IsNull()) return;
85       IGESDimen_ToolAngularDimension tool;
86       tool.OwnDump(anent,dumper,S,own);
87     }
88       break;
89     case  2 : {
90       DeclareAndCast(IGESDimen_BasicDimension,anent,ent);
91       if (anent.IsNull()) return;
92       IGESDimen_ToolBasicDimension tool;
93       tool.OwnDump(anent,dumper,S,own);
94     }
95       break;
96     case  3 : {
97       DeclareAndCast(IGESDimen_CenterLine,anent,ent);
98       if (anent.IsNull()) return;
99       IGESDimen_ToolCenterLine tool;
100       tool.OwnDump(anent,dumper,S,own);
101     }
102       break;
103     case  4 : {
104       DeclareAndCast(IGESDimen_CurveDimension,anent,ent);
105       if (anent.IsNull()) return;
106       IGESDimen_ToolCurveDimension tool;
107       tool.OwnDump(anent,dumper,S,own);
108     }
109       break;
110     case  5 : {
111       DeclareAndCast(IGESDimen_DiameterDimension,anent,ent);
112       if (anent.IsNull()) return;
113       IGESDimen_ToolDiameterDimension tool;
114       tool.OwnDump(anent,dumper,S,own);
115     }
116       break;
117     case  6 : {
118       DeclareAndCast(IGESDimen_DimensionDisplayData,anent,ent);
119       if (anent.IsNull()) return;
120       IGESDimen_ToolDimensionDisplayData tool;
121       tool.OwnDump(anent,dumper,S,own);
122     }
123       break;
124     case  7 : {
125       DeclareAndCast(IGESDimen_DimensionTolerance,anent,ent);
126       if (anent.IsNull()) return;
127       IGESDimen_ToolDimensionTolerance tool;
128       tool.OwnDump(anent,dumper,S,own);
129     }
130       break;
131     case  8 : {
132       DeclareAndCast(IGESDimen_DimensionUnits,anent,ent);
133       if (anent.IsNull()) return;
134       IGESDimen_ToolDimensionUnits tool;
135       tool.OwnDump(anent,dumper,S,own);
136     }
137       break;
138     case  9 : {
139       DeclareAndCast(IGESDimen_DimensionedGeometry,anent,ent);
140       if (anent.IsNull()) return;
141       IGESDimen_ToolDimensionedGeometry tool;
142       tool.OwnDump(anent,dumper,S,own);
143     }
144       break;
145     case 10 : {
146       DeclareAndCast(IGESDimen_FlagNote,anent,ent);
147       if (anent.IsNull()) return;
148       IGESDimen_ToolFlagNote tool;
149       tool.OwnDump(anent,dumper,S,own);
150     }
151       break;
152     case 11 : {
153       DeclareAndCast(IGESDimen_GeneralLabel,anent,ent);
154       if (anent.IsNull()) return;
155       IGESDimen_ToolGeneralLabel tool;
156       tool.OwnDump(anent,dumper,S,own);
157     }
158       break;
159     case 12 : {
160       DeclareAndCast(IGESDimen_GeneralNote,anent,ent);
161       if (anent.IsNull()) return;
162       IGESDimen_ToolGeneralNote tool;
163       tool.OwnDump(anent,dumper,S,own);
164     }
165       break;
166     case 13 : {
167       DeclareAndCast(IGESDimen_GeneralSymbol,anent,ent);
168       if (anent.IsNull()) return;
169       IGESDimen_ToolGeneralSymbol tool;
170       tool.OwnDump(anent,dumper,S,own);
171     }
172       break;
173     case 14 : {
174       DeclareAndCast(IGESDimen_LeaderArrow,anent,ent);
175       if (anent.IsNull()) return;
176       IGESDimen_ToolLeaderArrow tool;
177       tool.OwnDump(anent,dumper,S,own);
178     }
179       break;
180     case 15 : {
181       DeclareAndCast(IGESDimen_LinearDimension,anent,ent);
182       if (anent.IsNull()) return;
183       IGESDimen_ToolLinearDimension tool;
184       tool.OwnDump(anent,dumper,S,own);
185     }
186       break;
187     case 16 : {
188       DeclareAndCast(IGESDimen_NewDimensionedGeometry,anent,ent);
189       if (anent.IsNull()) return;
190       IGESDimen_ToolNewDimensionedGeometry tool;
191       tool.OwnDump(anent,dumper,S,own);
192     }
193       break;
194     case 17 : {
195       DeclareAndCast(IGESDimen_NewGeneralNote,anent,ent);
196       if (anent.IsNull()) return;
197       IGESDimen_ToolNewGeneralNote tool;
198       tool.OwnDump(anent,dumper,S,own);
199     }
200       break;
201     case 18 : {
202       DeclareAndCast(IGESDimen_OrdinateDimension,anent,ent);
203       if (anent.IsNull()) return;
204       IGESDimen_ToolOrdinateDimension tool;
205       tool.OwnDump(anent,dumper,S,own);
206     }
207       break;
208     case 19 : {
209       DeclareAndCast(IGESDimen_PointDimension,anent,ent);
210       if (anent.IsNull()) return;
211       IGESDimen_ToolPointDimension tool;
212       tool.OwnDump(anent,dumper,S,own);
213     }
214       break;
215     case 20 : {
216       DeclareAndCast(IGESDimen_RadiusDimension,anent,ent);
217       if (anent.IsNull()) return;
218       IGESDimen_ToolRadiusDimension tool;
219       tool.OwnDump(anent,dumper,S,own);
220     }
221       break;
222     case 21 : {
223       DeclareAndCast(IGESDimen_Section,anent,ent);
224       if (anent.IsNull()) return;
225       IGESDimen_ToolSection tool;
226       tool.OwnDump(anent,dumper,S,own);
227     }
228       break;
229     case 22 : {
230       DeclareAndCast(IGESDimen_SectionedArea,anent,ent);
231       if (anent.IsNull()) return;
232       IGESDimen_ToolSectionedArea tool;
233       tool.OwnDump(anent,dumper,S,own);
234     }
235       break;
236     case 23 : {
237       DeclareAndCast(IGESDimen_WitnessLine,anent,ent);
238       if (anent.IsNull()) return;
239       IGESDimen_ToolWitnessLine tool;
240       tool.OwnDump(anent,dumper,S,own);
241     }
242       break;
243     default : break;
244   }
245 }
246
247
248     Standard_Boolean  IGESDimen_SpecificModule::OwnCorrect
249   (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent) const
250 {
251 //   Applies only on some types
252   switch (CN) {
253     case  2 : {
254       DeclareAndCast(IGESDimen_BasicDimension,anent,ent);
255       if (anent.IsNull()) break;
256       IGESDimen_ToolBasicDimension tool;
257       return tool.OwnCorrect(anent);
258     }
259     case  3 : {
260       DeclareAndCast(IGESDimen_CenterLine,anent,ent);
261       if (anent.IsNull()) break;
262       IGESDimen_ToolCenterLine tool;
263       return tool.OwnCorrect(anent);
264     }
265     case  6 : {
266       DeclareAndCast(IGESDimen_DimensionDisplayData,anent,ent);
267       if (anent.IsNull()) break;
268       IGESDimen_ToolDimensionDisplayData tool;
269       return tool.OwnCorrect(anent);
270     }
271     case  7 : {
272       DeclareAndCast(IGESDimen_DimensionTolerance,anent,ent);
273       if (anent.IsNull()) break;
274       IGESDimen_ToolDimensionTolerance tool;
275       return tool.OwnCorrect(anent);
276     }
277     case  8 : {
278       DeclareAndCast(IGESDimen_DimensionUnits,anent,ent);
279       if (anent.IsNull()) break;
280       IGESDimen_ToolDimensionUnits tool;
281       return tool.OwnCorrect(anent);
282     }
283     case  9 : {
284       DeclareAndCast(IGESDimen_DimensionedGeometry,anent,ent);
285       if (anent.IsNull()) break;
286       IGESDimen_ToolDimensionedGeometry tool;
287       return tool.OwnCorrect(anent);
288     }
289     case 16 : {
290       DeclareAndCast(IGESDimen_NewDimensionedGeometry,anent,ent);
291       if (anent.IsNull()) break;
292       IGESDimen_ToolNewDimensionedGeometry tool;
293       return tool.OwnCorrect(anent);
294     }
295     case 21 : {
296       DeclareAndCast(IGESDimen_Section,anent,ent);
297       if (anent.IsNull()) break;
298       IGESDimen_ToolSection tool;
299       return tool.OwnCorrect(anent);
300     }
301     case 23 : {
302       DeclareAndCast(IGESDimen_WitnessLine,anent,ent);
303       if (anent.IsNull()) break;
304       IGESDimen_ToolWitnessLine tool;
305       return tool.OwnCorrect(anent);
306     }
307     default : break;
308   }
309   return Standard_False;
310 }