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_IGESEntity.hxx>
16 #include <IGESData_IGESReaderData.hxx>
17 #include <IGESData_IGESWriter.hxx>
18 #include <IGESData_ParamReader.hxx>
19 #include <IGESGeom_Boundary.hxx>
20 #include <IGESGeom_BoundedSurface.hxx>
21 #include <IGESGeom_BSplineCurve.hxx>
22 #include <IGESGeom_BSplineSurface.hxx>
23 #include <IGESGeom_CircularArc.hxx>
24 #include <IGESGeom_CompositeCurve.hxx>
25 #include <IGESGeom_ConicArc.hxx>
26 #include <IGESGeom_CopiousData.hxx>
27 #include <IGESGeom_CurveOnSurface.hxx>
28 #include <IGESGeom_Direction.hxx>
29 #include <IGESGeom_Flash.hxx>
30 #include <IGESGeom_Line.hxx>
31 #include <IGESGeom_OffsetCurve.hxx>
32 #include <IGESGeom_OffsetSurface.hxx>
33 #include <IGESGeom_Plane.hxx>
34 #include <IGESGeom_Point.hxx>
35 #include <IGESGeom_ReadWriteModule.hxx>
36 #include <IGESGeom_RuledSurface.hxx>
37 #include <IGESGeom_SplineCurve.hxx>
38 #include <IGESGeom_SplineSurface.hxx>
39 #include <IGESGeom_SurfaceOfRevolution.hxx>
40 #include <IGESGeom_TabulatedCylinder.hxx>
41 #include <IGESGeom_ToolBoundary.hxx>
42 #include <IGESGeom_ToolBoundedSurface.hxx>
43 #include <IGESGeom_ToolBSplineCurve.hxx>
44 #include <IGESGeom_ToolBSplineSurface.hxx>
45 #include <IGESGeom_ToolCircularArc.hxx>
46 #include <IGESGeom_ToolCompositeCurve.hxx>
47 #include <IGESGeom_ToolConicArc.hxx>
48 #include <IGESGeom_ToolCopiousData.hxx>
49 #include <IGESGeom_ToolCurveOnSurface.hxx>
50 #include <IGESGeom_ToolDirection.hxx>
51 #include <IGESGeom_ToolFlash.hxx>
52 #include <IGESGeom_ToolLine.hxx>
53 #include <IGESGeom_ToolOffsetCurve.hxx>
54 #include <IGESGeom_ToolOffsetSurface.hxx>
55 #include <IGESGeom_ToolPlane.hxx>
56 #include <IGESGeom_ToolPoint.hxx>
57 #include <IGESGeom_ToolRuledSurface.hxx>
58 #include <IGESGeom_ToolSplineCurve.hxx>
59 #include <IGESGeom_ToolSplineSurface.hxx>
60 #include <IGESGeom_ToolSurfaceOfRevolution.hxx>
61 #include <IGESGeom_ToolTabulatedCylinder.hxx>
62 #include <IGESGeom_ToolTransformationMatrix.hxx>
63 #include <IGESGeom_ToolTrimmedSurface.hxx>
64 #include <IGESGeom_TransformationMatrix.hxx>
65 #include <IGESGeom_TrimmedSurface.hxx>
66 #include <Interface_Macros.hxx>
67 #include <Standard_DomainError.hxx>
68 #include <Standard_Type.hxx>
70 IMPLEMENT_STANDARD_RTTIEXT(IGESGeom_ReadWriteModule,IGESData_ReadWriteModule)
72 // Each Module is attached to a Protocol : it must interprete Case Numbers
73 // (arguments <CN> of various methods) in accordance to values returned by
74 // the method TypeNumber from this Protocol
75 IGESGeom_ReadWriteModule::IGESGeom_ReadWriteModule () { }
78 Standard_Integer IGESGeom_ReadWriteModule::CaseIGES
79 (const Standard_Integer typenum, const Standard_Integer formnum) const
85 case 106 : if (formnum < 20 || formnum > 40) return 8;
100 case 130 : return 13;
101 case 140 : return 14;
105 case 144 : return 23;
112 void IGESGeom_ReadWriteModule::ReadOwnParams
113 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
114 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
118 DeclareAndCast(IGESGeom_BSplineCurve,anent,ent);
119 if (anent.IsNull()) return;
120 IGESGeom_ToolBSplineCurve tool;
121 tool.ReadOwnParams(anent,IR,PR);
125 DeclareAndCast(IGESGeom_BSplineSurface,anent,ent);
126 if (anent.IsNull()) return;
127 IGESGeom_ToolBSplineSurface tool;
128 tool.ReadOwnParams(anent,IR,PR);
132 DeclareAndCast(IGESGeom_Boundary,anent,ent);
133 if (anent.IsNull()) return;
134 IGESGeom_ToolBoundary tool;
135 tool.ReadOwnParams(anent,IR,PR);
139 DeclareAndCast(IGESGeom_BoundedSurface,anent,ent);
140 if (anent.IsNull()) return;
141 IGESGeom_ToolBoundedSurface tool;
142 tool.ReadOwnParams(anent,IR,PR);
146 DeclareAndCast(IGESGeom_CircularArc,anent,ent);
147 if (anent.IsNull()) return;
148 IGESGeom_ToolCircularArc tool;
149 tool.ReadOwnParams(anent,IR,PR);
153 DeclareAndCast(IGESGeom_CompositeCurve,anent,ent);
154 if (anent.IsNull()) return;
155 IGESGeom_ToolCompositeCurve tool;
156 tool.ReadOwnParams(anent,IR,PR);
160 DeclareAndCast(IGESGeom_ConicArc,anent,ent);
161 if (anent.IsNull()) return;
162 IGESGeom_ToolConicArc tool;
163 tool.ReadOwnParams(anent,IR,PR);
167 DeclareAndCast(IGESGeom_CopiousData,anent,ent);
168 if (anent.IsNull()) return;
169 IGESGeom_ToolCopiousData tool;
170 tool.ReadOwnParams(anent,IR,PR);
174 DeclareAndCast(IGESGeom_CurveOnSurface,anent,ent);
175 if (anent.IsNull()) return;
176 IGESGeom_ToolCurveOnSurface tool;
177 tool.ReadOwnParams(anent,IR,PR);
181 DeclareAndCast(IGESGeom_Direction,anent,ent);
182 if (anent.IsNull()) return;
183 IGESGeom_ToolDirection tool;
184 tool.ReadOwnParams(anent,IR,PR);
188 DeclareAndCast(IGESGeom_Flash,anent,ent);
189 if (anent.IsNull()) return;
190 IGESGeom_ToolFlash tool;
191 tool.ReadOwnParams(anent,IR,PR);
195 DeclareAndCast(IGESGeom_Line,anent,ent);
196 if (anent.IsNull()) return;
197 IGESGeom_ToolLine tool;
198 tool.ReadOwnParams(anent,IR,PR);
202 DeclareAndCast(IGESGeom_OffsetCurve,anent,ent);
203 if (anent.IsNull()) return;
204 IGESGeom_ToolOffsetCurve tool;
205 tool.ReadOwnParams(anent,IR,PR);
209 DeclareAndCast(IGESGeom_OffsetSurface,anent,ent);
210 if (anent.IsNull()) return;
211 IGESGeom_ToolOffsetSurface tool;
212 tool.ReadOwnParams(anent,IR,PR);
216 DeclareAndCast(IGESGeom_Plane,anent,ent);
217 if (anent.IsNull()) return;
218 IGESGeom_ToolPlane tool;
219 tool.ReadOwnParams(anent,IR,PR);
223 DeclareAndCast(IGESGeom_Point,anent,ent);
224 if (anent.IsNull()) return;
225 IGESGeom_ToolPoint tool;
226 tool.ReadOwnParams(anent,IR,PR);
230 DeclareAndCast(IGESGeom_RuledSurface,anent,ent);
231 if (anent.IsNull()) return;
232 IGESGeom_ToolRuledSurface tool;
233 tool.ReadOwnParams(anent,IR,PR);
237 DeclareAndCast(IGESGeom_SplineCurve,anent,ent);
238 if (anent.IsNull()) return;
239 IGESGeom_ToolSplineCurve tool;
240 tool.ReadOwnParams(anent,IR,PR);
244 DeclareAndCast(IGESGeom_SplineSurface,anent,ent);
245 if (anent.IsNull()) return;
246 IGESGeom_ToolSplineSurface tool;
247 tool.ReadOwnParams(anent,IR,PR);
251 DeclareAndCast(IGESGeom_SurfaceOfRevolution,anent,ent);
252 if (anent.IsNull()) return;
253 IGESGeom_ToolSurfaceOfRevolution tool;
254 tool.ReadOwnParams(anent,IR,PR);
258 DeclareAndCast(IGESGeom_TabulatedCylinder,anent,ent);
259 if (anent.IsNull()) return;
260 IGESGeom_ToolTabulatedCylinder tool;
261 tool.ReadOwnParams(anent,IR,PR);
265 DeclareAndCast(IGESGeom_TransformationMatrix,anent,ent);
266 if (anent.IsNull()) return;
267 IGESGeom_ToolTransformationMatrix tool;
268 tool.ReadOwnParams(anent,IR,PR);
272 DeclareAndCast(IGESGeom_TrimmedSurface,anent,ent);
273 if (anent.IsNull()) return;
274 IGESGeom_ToolTrimmedSurface tool;
275 tool.ReadOwnParams(anent,IR,PR);
283 void IGESGeom_ReadWriteModule::WriteOwnParams
284 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
285 IGESData_IGESWriter& IW) const
289 DeclareAndCast(IGESGeom_BSplineCurve,anent,ent);
290 if (anent.IsNull()) return;
291 IGESGeom_ToolBSplineCurve tool;
292 tool.WriteOwnParams(anent,IW);
296 DeclareAndCast(IGESGeom_BSplineSurface,anent,ent);
297 if (anent.IsNull()) return;
298 IGESGeom_ToolBSplineSurface tool;
299 tool.WriteOwnParams(anent,IW);
303 DeclareAndCast(IGESGeom_Boundary,anent,ent);
304 if (anent.IsNull()) return;
305 IGESGeom_ToolBoundary tool;
306 tool.WriteOwnParams(anent,IW);
310 DeclareAndCast(IGESGeom_BoundedSurface,anent,ent);
311 if (anent.IsNull()) return;
312 IGESGeom_ToolBoundedSurface tool;
313 tool.WriteOwnParams(anent,IW);
317 DeclareAndCast(IGESGeom_CircularArc,anent,ent);
318 if (anent.IsNull()) return;
319 IGESGeom_ToolCircularArc tool;
320 tool.WriteOwnParams(anent,IW);
324 DeclareAndCast(IGESGeom_CompositeCurve,anent,ent);
325 if (anent.IsNull()) return;
326 IGESGeom_ToolCompositeCurve tool;
327 tool.WriteOwnParams(anent,IW);
331 DeclareAndCast(IGESGeom_ConicArc,anent,ent);
332 if (anent.IsNull()) return;
333 IGESGeom_ToolConicArc tool;
334 tool.WriteOwnParams(anent,IW);
338 DeclareAndCast(IGESGeom_CopiousData,anent,ent);
339 if (anent.IsNull()) return;
340 IGESGeom_ToolCopiousData tool;
341 tool.WriteOwnParams(anent,IW);
345 DeclareAndCast(IGESGeom_CurveOnSurface,anent,ent);
346 if (anent.IsNull()) return;
347 IGESGeom_ToolCurveOnSurface tool;
348 tool.WriteOwnParams(anent,IW);
352 DeclareAndCast(IGESGeom_Direction,anent,ent);
353 if (anent.IsNull()) return;
354 IGESGeom_ToolDirection tool;
355 tool.WriteOwnParams(anent,IW);
359 DeclareAndCast(IGESGeom_Flash,anent,ent);
360 if (anent.IsNull()) return;
361 IGESGeom_ToolFlash tool;
362 tool.WriteOwnParams(anent,IW);
366 DeclareAndCast(IGESGeom_Line,anent,ent);
367 if (anent.IsNull()) return;
368 IGESGeom_ToolLine tool;
369 tool.WriteOwnParams(anent,IW);
373 DeclareAndCast(IGESGeom_OffsetCurve,anent,ent);
374 if (anent.IsNull()) return;
375 IGESGeom_ToolOffsetCurve tool;
376 tool.WriteOwnParams(anent,IW);
380 DeclareAndCast(IGESGeom_OffsetSurface,anent,ent);
381 if (anent.IsNull()) return;
382 IGESGeom_ToolOffsetSurface tool;
383 tool.WriteOwnParams(anent,IW);
387 DeclareAndCast(IGESGeom_Plane,anent,ent);
388 if (anent.IsNull()) return;
389 IGESGeom_ToolPlane tool;
390 tool.WriteOwnParams(anent,IW);
394 DeclareAndCast(IGESGeom_Point,anent,ent);
395 if (anent.IsNull()) return;
396 IGESGeom_ToolPoint tool;
397 tool.WriteOwnParams(anent,IW);
401 DeclareAndCast(IGESGeom_RuledSurface,anent,ent);
402 if (anent.IsNull()) return;
403 IGESGeom_ToolRuledSurface tool;
404 tool.WriteOwnParams(anent,IW);
408 DeclareAndCast(IGESGeom_SplineCurve,anent,ent);
409 if (anent.IsNull()) return;
410 IGESGeom_ToolSplineCurve tool;
411 tool.WriteOwnParams(anent,IW);
415 DeclareAndCast(IGESGeom_SplineSurface,anent,ent);
416 if (anent.IsNull()) return;
417 IGESGeom_ToolSplineSurface tool;
418 tool.WriteOwnParams(anent,IW);
422 DeclareAndCast(IGESGeom_SurfaceOfRevolution,anent,ent);
423 if (anent.IsNull()) return;
424 IGESGeom_ToolSurfaceOfRevolution tool;
425 tool.WriteOwnParams(anent,IW);
429 DeclareAndCast(IGESGeom_TabulatedCylinder,anent,ent);
430 if (anent.IsNull()) return;
431 IGESGeom_ToolTabulatedCylinder tool;
432 tool.WriteOwnParams(anent,IW);
436 DeclareAndCast(IGESGeom_TransformationMatrix,anent,ent);
437 if (anent.IsNull()) return;
438 IGESGeom_ToolTransformationMatrix tool;
439 tool.WriteOwnParams(anent,IW);
443 DeclareAndCast(IGESGeom_TrimmedSurface,anent,ent);
444 if (anent.IsNull()) return;
445 IGESGeom_ToolTrimmedSurface tool;
446 tool.WriteOwnParams(anent,IW);