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 <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>
68 IMPLEMENT_STANDARD_RTTIEXT(IGESDimen_SpecificModule,IGESData_SpecificModule)
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() { }
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
83 DeclareAndCast(IGESDimen_AngularDimension,anent,ent);
84 if (anent.IsNull()) return;
85 IGESDimen_ToolAngularDimension tool;
86 tool.OwnDump(anent,dumper,S,own);
90 DeclareAndCast(IGESDimen_BasicDimension,anent,ent);
91 if (anent.IsNull()) return;
92 IGESDimen_ToolBasicDimension tool;
93 tool.OwnDump(anent,dumper,S,own);
97 DeclareAndCast(IGESDimen_CenterLine,anent,ent);
98 if (anent.IsNull()) return;
99 IGESDimen_ToolCenterLine tool;
100 tool.OwnDump(anent,dumper,S,own);
104 DeclareAndCast(IGESDimen_CurveDimension,anent,ent);
105 if (anent.IsNull()) return;
106 IGESDimen_ToolCurveDimension tool;
107 tool.OwnDump(anent,dumper,S,own);
111 DeclareAndCast(IGESDimen_DiameterDimension,anent,ent);
112 if (anent.IsNull()) return;
113 IGESDimen_ToolDiameterDimension tool;
114 tool.OwnDump(anent,dumper,S,own);
118 DeclareAndCast(IGESDimen_DimensionDisplayData,anent,ent);
119 if (anent.IsNull()) return;
120 IGESDimen_ToolDimensionDisplayData tool;
121 tool.OwnDump(anent,dumper,S,own);
125 DeclareAndCast(IGESDimen_DimensionTolerance,anent,ent);
126 if (anent.IsNull()) return;
127 IGESDimen_ToolDimensionTolerance tool;
128 tool.OwnDump(anent,dumper,S,own);
132 DeclareAndCast(IGESDimen_DimensionUnits,anent,ent);
133 if (anent.IsNull()) return;
134 IGESDimen_ToolDimensionUnits tool;
135 tool.OwnDump(anent,dumper,S,own);
139 DeclareAndCast(IGESDimen_DimensionedGeometry,anent,ent);
140 if (anent.IsNull()) return;
141 IGESDimen_ToolDimensionedGeometry tool;
142 tool.OwnDump(anent,dumper,S,own);
146 DeclareAndCast(IGESDimen_FlagNote,anent,ent);
147 if (anent.IsNull()) return;
148 IGESDimen_ToolFlagNote tool;
149 tool.OwnDump(anent,dumper,S,own);
153 DeclareAndCast(IGESDimen_GeneralLabel,anent,ent);
154 if (anent.IsNull()) return;
155 IGESDimen_ToolGeneralLabel tool;
156 tool.OwnDump(anent,dumper,S,own);
160 DeclareAndCast(IGESDimen_GeneralNote,anent,ent);
161 if (anent.IsNull()) return;
162 IGESDimen_ToolGeneralNote tool;
163 tool.OwnDump(anent,dumper,S,own);
167 DeclareAndCast(IGESDimen_GeneralSymbol,anent,ent);
168 if (anent.IsNull()) return;
169 IGESDimen_ToolGeneralSymbol tool;
170 tool.OwnDump(anent,dumper,S,own);
174 DeclareAndCast(IGESDimen_LeaderArrow,anent,ent);
175 if (anent.IsNull()) return;
176 IGESDimen_ToolLeaderArrow tool;
177 tool.OwnDump(anent,dumper,S,own);
181 DeclareAndCast(IGESDimen_LinearDimension,anent,ent);
182 if (anent.IsNull()) return;
183 IGESDimen_ToolLinearDimension tool;
184 tool.OwnDump(anent,dumper,S,own);
188 DeclareAndCast(IGESDimen_NewDimensionedGeometry,anent,ent);
189 if (anent.IsNull()) return;
190 IGESDimen_ToolNewDimensionedGeometry tool;
191 tool.OwnDump(anent,dumper,S,own);
195 DeclareAndCast(IGESDimen_NewGeneralNote,anent,ent);
196 if (anent.IsNull()) return;
197 IGESDimen_ToolNewGeneralNote tool;
198 tool.OwnDump(anent,dumper,S,own);
202 DeclareAndCast(IGESDimen_OrdinateDimension,anent,ent);
203 if (anent.IsNull()) return;
204 IGESDimen_ToolOrdinateDimension tool;
205 tool.OwnDump(anent,dumper,S,own);
209 DeclareAndCast(IGESDimen_PointDimension,anent,ent);
210 if (anent.IsNull()) return;
211 IGESDimen_ToolPointDimension tool;
212 tool.OwnDump(anent,dumper,S,own);
216 DeclareAndCast(IGESDimen_RadiusDimension,anent,ent);
217 if (anent.IsNull()) return;
218 IGESDimen_ToolRadiusDimension tool;
219 tool.OwnDump(anent,dumper,S,own);
223 DeclareAndCast(IGESDimen_Section,anent,ent);
224 if (anent.IsNull()) return;
225 IGESDimen_ToolSection tool;
226 tool.OwnDump(anent,dumper,S,own);
230 DeclareAndCast(IGESDimen_SectionedArea,anent,ent);
231 if (anent.IsNull()) return;
232 IGESDimen_ToolSectionedArea tool;
233 tool.OwnDump(anent,dumper,S,own);
237 DeclareAndCast(IGESDimen_WitnessLine,anent,ent);
238 if (anent.IsNull()) return;
239 IGESDimen_ToolWitnessLine tool;
240 tool.OwnDump(anent,dumper,S,own);
248 Standard_Boolean IGESDimen_SpecificModule::OwnCorrect
249 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent) const
251 // Applies only on some types
254 DeclareAndCast(IGESDimen_BasicDimension,anent,ent);
255 if (anent.IsNull()) break;
256 IGESDimen_ToolBasicDimension tool;
257 return tool.OwnCorrect(anent);
260 DeclareAndCast(IGESDimen_CenterLine,anent,ent);
261 if (anent.IsNull()) break;
262 IGESDimen_ToolCenterLine tool;
263 return tool.OwnCorrect(anent);
266 DeclareAndCast(IGESDimen_DimensionDisplayData,anent,ent);
267 if (anent.IsNull()) break;
268 IGESDimen_ToolDimensionDisplayData tool;
269 return tool.OwnCorrect(anent);
272 DeclareAndCast(IGESDimen_DimensionTolerance,anent,ent);
273 if (anent.IsNull()) break;
274 IGESDimen_ToolDimensionTolerance tool;
275 return tool.OwnCorrect(anent);
278 DeclareAndCast(IGESDimen_DimensionUnits,anent,ent);
279 if (anent.IsNull()) break;
280 IGESDimen_ToolDimensionUnits tool;
281 return tool.OwnCorrect(anent);
284 DeclareAndCast(IGESDimen_DimensionedGeometry,anent,ent);
285 if (anent.IsNull()) break;
286 IGESDimen_ToolDimensionedGeometry tool;
287 return tool.OwnCorrect(anent);
290 DeclareAndCast(IGESDimen_NewDimensionedGeometry,anent,ent);
291 if (anent.IsNull()) break;
292 IGESDimen_ToolNewDimensionedGeometry tool;
293 return tool.OwnCorrect(anent);
296 DeclareAndCast(IGESDimen_Section,anent,ent);
297 if (anent.IsNull()) break;
298 IGESDimen_ToolSection tool;
299 return tool.OwnCorrect(anent);
302 DeclareAndCast(IGESDimen_WitnessLine,anent,ent);
303 if (anent.IsNull()) break;
304 IGESDimen_ToolWitnessLine tool;
305 return tool.OwnCorrect(anent);
309 return Standard_False;