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_IGESReaderData.hxx>
16 #include <IGESData_IGESWriter.hxx>
17 #include <IGESData_ParamReader.hxx>
18 #include <IGESDimen_AngularDimension.hxx>
19 #include <IGESDimen_BasicDimension.hxx>
20 #include <IGESDimen_CenterLine.hxx>
21 #include <IGESDimen_CurveDimension.hxx>
22 #include <IGESDimen_DiameterDimension.hxx>
23 #include <IGESDimen_DimensionDisplayData.hxx>
24 #include <IGESDimen_DimensionedGeometry.hxx>
25 #include <IGESDimen_DimensionTolerance.hxx>
26 #include <IGESDimen_DimensionUnits.hxx>
27 #include <IGESDimen_FlagNote.hxx>
28 #include <IGESDimen_GeneralLabel.hxx>
29 #include <IGESDimen_GeneralNote.hxx>
30 #include <IGESDimen_GeneralSymbol.hxx>
31 #include <IGESDimen_LeaderArrow.hxx>
32 #include <IGESDimen_LinearDimension.hxx>
33 #include <IGESDimen_NewDimensionedGeometry.hxx>
34 #include <IGESDimen_NewGeneralNote.hxx>
35 #include <IGESDimen_OrdinateDimension.hxx>
36 #include <IGESDimen_PointDimension.hxx>
37 #include <IGESDimen_RadiusDimension.hxx>
38 #include <IGESDimen_ReadWriteModule.hxx>
39 #include <IGESDimen_Section.hxx>
40 #include <IGESDimen_SectionedArea.hxx>
41 #include <IGESDimen_ToolAngularDimension.hxx>
42 #include <IGESDimen_ToolBasicDimension.hxx>
43 #include <IGESDimen_ToolCenterLine.hxx>
44 #include <IGESDimen_ToolCurveDimension.hxx>
45 #include <IGESDimen_ToolDiameterDimension.hxx>
46 #include <IGESDimen_ToolDimensionDisplayData.hxx>
47 #include <IGESDimen_ToolDimensionedGeometry.hxx>
48 #include <IGESDimen_ToolDimensionTolerance.hxx>
49 #include <IGESDimen_ToolDimensionUnits.hxx>
50 #include <IGESDimen_ToolFlagNote.hxx>
51 #include <IGESDimen_ToolGeneralLabel.hxx>
52 #include <IGESDimen_ToolGeneralNote.hxx>
53 #include <IGESDimen_ToolGeneralSymbol.hxx>
54 #include <IGESDimen_ToolLeaderArrow.hxx>
55 #include <IGESDimen_ToolLinearDimension.hxx>
56 #include <IGESDimen_ToolNewDimensionedGeometry.hxx>
57 #include <IGESDimen_ToolNewGeneralNote.hxx>
58 #include <IGESDimen_ToolOrdinateDimension.hxx>
59 #include <IGESDimen_ToolPointDimension.hxx>
60 #include <IGESDimen_ToolRadiusDimension.hxx>
61 #include <IGESDimen_ToolSection.hxx>
62 #include <IGESDimen_ToolSectionedArea.hxx>
63 #include <IGESDimen_ToolWitnessLine.hxx>
64 #include <IGESDimen_WitnessLine.hxx>
65 #include <Interface_Macros.hxx>
66 #include <Standard_Type.hxx>
68 IMPLEMENT_STANDARD_RTTIEXT(IGESDimen_ReadWriteModule,IGESData_ReadWriteModule)
70 // Each Module is attached to a Protocol : it must interpret Case Numbers
71 // (arguments <CN> of various methods) in accordance to values returned by
72 // the method TypeNumber from this Protocol
73 IGESDimen_ReadWriteModule::IGESDimen_ReadWriteModule () { }
76 Standard_Integer IGESDimen_ReadWriteModule::CaseIGES
77 (const Standard_Integer typenum, const Standard_Integer formnum) const
81 if (formnum == 20 || formnum == 21) return 3;
82 else if (formnum > 30 && formnum < 40) return 21;
83 else if (formnum == 40) return 23;
121 void IGESDimen_ReadWriteModule::ReadOwnParams
122 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
123 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
127 DeclareAndCast(IGESDimen_AngularDimension,anent,ent);
128 if (anent.IsNull()) return;
129 IGESDimen_ToolAngularDimension tool;
130 tool.ReadOwnParams(anent,IR,PR);
134 DeclareAndCast(IGESDimen_BasicDimension,anent,ent);
135 if (anent.IsNull()) return;
136 IGESDimen_ToolBasicDimension tool;
137 tool.ReadOwnParams(anent,IR,PR);
141 DeclareAndCast(IGESDimen_CenterLine,anent,ent);
142 if (anent.IsNull()) return;
143 IGESDimen_ToolCenterLine tool;
144 tool.ReadOwnParams(anent,IR,PR);
148 DeclareAndCast(IGESDimen_CurveDimension,anent,ent);
149 if (anent.IsNull()) return;
150 IGESDimen_ToolCurveDimension tool;
151 tool.ReadOwnParams(anent,IR,PR);
155 DeclareAndCast(IGESDimen_DiameterDimension,anent,ent);
156 if (anent.IsNull()) return;
157 IGESDimen_ToolDiameterDimension tool;
158 tool.ReadOwnParams(anent,IR,PR);
162 DeclareAndCast(IGESDimen_DimensionDisplayData,anent,ent);
163 if (anent.IsNull()) return;
164 IGESDimen_ToolDimensionDisplayData tool;
165 tool.ReadOwnParams(anent,IR,PR);
169 DeclareAndCast(IGESDimen_DimensionTolerance,anent,ent);
170 if (anent.IsNull()) return;
171 IGESDimen_ToolDimensionTolerance tool;
172 tool.ReadOwnParams(anent,IR,PR);
176 DeclareAndCast(IGESDimen_DimensionUnits,anent,ent);
177 if (anent.IsNull()) return;
178 IGESDimen_ToolDimensionUnits tool;
179 tool.ReadOwnParams(anent,IR,PR);
183 DeclareAndCast(IGESDimen_DimensionedGeometry,anent,ent);
184 if (anent.IsNull()) return;
185 IGESDimen_ToolDimensionedGeometry tool;
186 tool.ReadOwnParams(anent,IR,PR);
190 DeclareAndCast(IGESDimen_FlagNote,anent,ent);
191 if (anent.IsNull()) return;
192 IGESDimen_ToolFlagNote tool;
193 tool.ReadOwnParams(anent,IR,PR);
197 DeclareAndCast(IGESDimen_GeneralLabel,anent,ent);
198 if (anent.IsNull()) return;
199 IGESDimen_ToolGeneralLabel tool;
200 tool.ReadOwnParams(anent,IR,PR);
204 DeclareAndCast(IGESDimen_GeneralNote,anent,ent);
205 if (anent.IsNull()) return;
206 IGESDimen_ToolGeneralNote tool;
207 tool.ReadOwnParams(anent,IR,PR);
211 DeclareAndCast(IGESDimen_GeneralSymbol,anent,ent);
212 if (anent.IsNull()) return;
213 IGESDimen_ToolGeneralSymbol tool;
214 tool.ReadOwnParams(anent,IR,PR);
218 DeclareAndCast(IGESDimen_LeaderArrow,anent,ent);
219 if (anent.IsNull()) return;
220 IGESDimen_ToolLeaderArrow tool;
221 tool.ReadOwnParams(anent,IR,PR);
225 DeclareAndCast(IGESDimen_LinearDimension,anent,ent);
226 if (anent.IsNull()) return;
227 IGESDimen_ToolLinearDimension tool;
228 tool.ReadOwnParams(anent,IR,PR);
232 DeclareAndCast(IGESDimen_NewDimensionedGeometry,anent,ent);
233 if (anent.IsNull()) return;
234 IGESDimen_ToolNewDimensionedGeometry tool;
235 tool.ReadOwnParams(anent,IR,PR);
239 DeclareAndCast(IGESDimen_NewGeneralNote,anent,ent);
240 if (anent.IsNull()) return;
241 IGESDimen_ToolNewGeneralNote tool;
242 tool.ReadOwnParams(anent,IR,PR);
246 DeclareAndCast(IGESDimen_OrdinateDimension,anent,ent);
247 if (anent.IsNull()) return;
248 IGESDimen_ToolOrdinateDimension tool;
249 tool.ReadOwnParams(anent,IR,PR);
253 DeclareAndCast(IGESDimen_PointDimension,anent,ent);
254 if (anent.IsNull()) return;
255 IGESDimen_ToolPointDimension tool;
256 tool.ReadOwnParams(anent,IR,PR);
260 DeclareAndCast(IGESDimen_RadiusDimension,anent,ent);
261 if (anent.IsNull()) return;
262 IGESDimen_ToolRadiusDimension tool;
263 tool.ReadOwnParams(anent,IR,PR);
267 DeclareAndCast(IGESDimen_Section,anent,ent);
268 if (anent.IsNull()) return;
269 IGESDimen_ToolSection tool;
270 tool.ReadOwnParams(anent,IR,PR);
274 DeclareAndCast(IGESDimen_SectionedArea,anent,ent);
275 if (anent.IsNull()) return;
276 IGESDimen_ToolSectionedArea tool;
277 tool.ReadOwnParams(anent,IR,PR);
281 DeclareAndCast(IGESDimen_WitnessLine,anent,ent);
282 if (anent.IsNull()) return;
283 IGESDimen_ToolWitnessLine tool;
284 tool.ReadOwnParams(anent,IR,PR);
292 void IGESDimen_ReadWriteModule::WriteOwnParams
293 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
294 IGESData_IGESWriter& IW) const
298 DeclareAndCast(IGESDimen_AngularDimension,anent,ent);
299 if (anent.IsNull()) return;
300 IGESDimen_ToolAngularDimension tool;
301 tool.WriteOwnParams(anent,IW);
305 DeclareAndCast(IGESDimen_BasicDimension,anent,ent);
306 if (anent.IsNull()) return;
307 IGESDimen_ToolBasicDimension tool;
308 tool.WriteOwnParams(anent,IW);
312 DeclareAndCast(IGESDimen_CenterLine,anent,ent);
313 if (anent.IsNull()) return;
314 IGESDimen_ToolCenterLine tool;
315 tool.WriteOwnParams(anent,IW);
319 DeclareAndCast(IGESDimen_CurveDimension,anent,ent);
320 if (anent.IsNull()) return;
321 IGESDimen_ToolCurveDimension tool;
322 tool.WriteOwnParams(anent,IW);
326 DeclareAndCast(IGESDimen_DiameterDimension,anent,ent);
327 if (anent.IsNull()) return;
328 IGESDimen_ToolDiameterDimension tool;
329 tool.WriteOwnParams(anent,IW);
333 DeclareAndCast(IGESDimen_DimensionDisplayData,anent,ent);
334 if (anent.IsNull()) return;
335 IGESDimen_ToolDimensionDisplayData tool;
336 tool.WriteOwnParams(anent,IW);
340 DeclareAndCast(IGESDimen_DimensionTolerance,anent,ent);
341 if (anent.IsNull()) return;
342 IGESDimen_ToolDimensionTolerance tool;
343 tool.WriteOwnParams(anent,IW);
347 DeclareAndCast(IGESDimen_DimensionUnits,anent,ent);
348 if (anent.IsNull()) return;
349 IGESDimen_ToolDimensionUnits tool;
350 tool.WriteOwnParams(anent,IW);
354 DeclareAndCast(IGESDimen_DimensionedGeometry,anent,ent);
355 if (anent.IsNull()) return;
356 IGESDimen_ToolDimensionedGeometry tool;
357 tool.WriteOwnParams(anent,IW);
361 DeclareAndCast(IGESDimen_FlagNote,anent,ent);
362 if (anent.IsNull()) return;
363 IGESDimen_ToolFlagNote tool;
364 tool.WriteOwnParams(anent,IW);
368 DeclareAndCast(IGESDimen_GeneralLabel,anent,ent);
369 if (anent.IsNull()) return;
370 IGESDimen_ToolGeneralLabel tool;
371 tool.WriteOwnParams(anent,IW);
375 DeclareAndCast(IGESDimen_GeneralNote,anent,ent);
376 if (anent.IsNull()) return;
377 IGESDimen_ToolGeneralNote tool;
378 tool.WriteOwnParams(anent,IW);
382 DeclareAndCast(IGESDimen_GeneralSymbol,anent,ent);
383 if (anent.IsNull()) return;
384 IGESDimen_ToolGeneralSymbol tool;
385 tool.WriteOwnParams(anent,IW);
389 DeclareAndCast(IGESDimen_LeaderArrow,anent,ent);
390 if (anent.IsNull()) return;
391 IGESDimen_ToolLeaderArrow tool;
392 tool.WriteOwnParams(anent,IW);
396 DeclareAndCast(IGESDimen_LinearDimension,anent,ent);
397 if (anent.IsNull()) return;
398 IGESDimen_ToolLinearDimension tool;
399 tool.WriteOwnParams(anent,IW);
403 DeclareAndCast(IGESDimen_NewDimensionedGeometry,anent,ent);
404 if (anent.IsNull()) return;
405 IGESDimen_ToolNewDimensionedGeometry tool;
406 tool.WriteOwnParams(anent,IW);
410 DeclareAndCast(IGESDimen_NewGeneralNote,anent,ent);
411 if (anent.IsNull()) return;
412 IGESDimen_ToolNewGeneralNote tool;
413 tool.WriteOwnParams(anent,IW);
417 DeclareAndCast(IGESDimen_OrdinateDimension,anent,ent);
418 if (anent.IsNull()) return;
419 IGESDimen_ToolOrdinateDimension tool;
420 tool.WriteOwnParams(anent,IW);
424 DeclareAndCast(IGESDimen_PointDimension,anent,ent);
425 if (anent.IsNull()) return;
426 IGESDimen_ToolPointDimension tool;
427 tool.WriteOwnParams(anent,IW);
431 DeclareAndCast(IGESDimen_RadiusDimension,anent,ent);
432 if (anent.IsNull()) return;
433 IGESDimen_ToolRadiusDimension tool;
434 tool.WriteOwnParams(anent,IW);
438 DeclareAndCast(IGESDimen_Section,anent,ent);
439 if (anent.IsNull()) return;
440 IGESDimen_ToolSection tool;
441 tool.WriteOwnParams(anent,IW);
445 DeclareAndCast(IGESDimen_SectionedArea,anent,ent);
446 if (anent.IsNull()) return;
447 IGESDimen_ToolSectionedArea tool;
448 tool.WriteOwnParams(anent,IW);
452 DeclareAndCast(IGESDimen_WitnessLine,anent,ent);
453 if (anent.IsNull()) return;
454 IGESDimen_ToolWitnessLine tool;
455 tool.WriteOwnParams(anent,IW);