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 <IGESGraph_Color.hxx>
20 #include <IGESGraph_DefinitionLevel.hxx>
21 #include <IGESGraph_DrawingSize.hxx>
22 #include <IGESGraph_DrawingUnits.hxx>
23 #include <IGESGraph_HighLight.hxx>
24 #include <IGESGraph_IntercharacterSpacing.hxx>
25 #include <IGESGraph_LineFontDefPattern.hxx>
26 #include <IGESGraph_LineFontDefTemplate.hxx>
27 #include <IGESGraph_LineFontPredefined.hxx>
28 #include <IGESGraph_NominalSize.hxx>
29 #include <IGESGraph_Pick.hxx>
30 #include <IGESGraph_ReadWriteModule.hxx>
31 #include <IGESGraph_TextDisplayTemplate.hxx>
32 #include <IGESGraph_TextFontDef.hxx>
33 #include <IGESGraph_ToolColor.hxx>
34 #include <IGESGraph_ToolDefinitionLevel.hxx>
35 #include <IGESGraph_ToolDrawingSize.hxx>
36 #include <IGESGraph_ToolDrawingUnits.hxx>
37 #include <IGESGraph_ToolHighLight.hxx>
38 #include <IGESGraph_ToolIntercharacterSpacing.hxx>
39 #include <IGESGraph_ToolLineFontDefPattern.hxx>
40 #include <IGESGraph_ToolLineFontDefTemplate.hxx>
41 #include <IGESGraph_ToolLineFontPredefined.hxx>
42 #include <IGESGraph_ToolNominalSize.hxx>
43 #include <IGESGraph_ToolPick.hxx>
44 #include <IGESGraph_ToolTextDisplayTemplate.hxx>
45 #include <IGESGraph_ToolTextFontDef.hxx>
46 #include <IGESGraph_ToolUniformRectGrid.hxx>
47 #include <IGESGraph_UniformRectGrid.hxx>
48 #include <Interface_Macros.hxx>
49 #include <Standard_DomainError.hxx>
50 #include <Standard_Type.hxx>
52 IMPLEMENT_STANDARD_RTTIEXT(IGESGraph_ReadWriteModule,IGESData_ReadWriteModule)
54 // Each Module is attached to a Protocol : it must interprete Case Numbers
55 // (arguments <CN> of various methods) in accordance to values returned by
56 // the method TypeNumber from this Protocol
57 IGESGraph_ReadWriteModule::IGESGraph_ReadWriteModule () { }
60 Standard_Integer IGESGraph_ReadWriteModule::CaseIGES
61 (const Standard_Integer typenum, const Standard_Integer formnum) const
65 if (formnum == 1) return 9;
66 else if (formnum == 2) return 7;
91 void IGESGraph_ReadWriteModule::ReadOwnParams
92 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
93 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
97 DeclareAndCast(IGESGraph_Color,anent,ent);
98 if (anent.IsNull()) return;
99 IGESGraph_ToolColor tool;
100 tool.ReadOwnParams(anent,IR,PR);
104 DeclareAndCast(IGESGraph_DefinitionLevel,anent,ent);
105 if (anent.IsNull()) return;
106 IGESGraph_ToolDefinitionLevel tool;
107 tool.ReadOwnParams(anent,IR,PR);
111 DeclareAndCast(IGESGraph_DrawingSize,anent,ent);
112 if (anent.IsNull()) return;
113 IGESGraph_ToolDrawingSize tool;
114 tool.ReadOwnParams(anent,IR,PR);
118 DeclareAndCast(IGESGraph_DrawingUnits,anent,ent);
119 if (anent.IsNull()) return;
120 IGESGraph_ToolDrawingUnits tool;
121 tool.ReadOwnParams(anent,IR,PR);
125 DeclareAndCast(IGESGraph_HighLight,anent,ent);
126 if (anent.IsNull()) return;
127 IGESGraph_ToolHighLight tool;
128 tool.ReadOwnParams(anent,IR,PR);
132 DeclareAndCast(IGESGraph_IntercharacterSpacing,anent,ent);
133 if (anent.IsNull()) return;
134 IGESGraph_ToolIntercharacterSpacing tool;
135 tool.ReadOwnParams(anent,IR,PR);
139 DeclareAndCast(IGESGraph_LineFontDefPattern,anent,ent);
140 if (anent.IsNull()) return;
141 IGESGraph_ToolLineFontDefPattern tool;
142 tool.ReadOwnParams(anent,IR,PR);
146 DeclareAndCast(IGESGraph_LineFontPredefined,anent,ent);
147 if (anent.IsNull()) return;
148 IGESGraph_ToolLineFontPredefined tool;
149 tool.ReadOwnParams(anent,IR,PR);
153 DeclareAndCast(IGESGraph_LineFontDefTemplate,anent,ent);
154 if (anent.IsNull()) return;
155 IGESGraph_ToolLineFontDefTemplate tool;
156 tool.ReadOwnParams(anent,IR,PR);
160 DeclareAndCast(IGESGraph_NominalSize,anent,ent);
161 if (anent.IsNull()) return;
162 IGESGraph_ToolNominalSize tool;
163 tool.ReadOwnParams(anent,IR,PR);
167 DeclareAndCast(IGESGraph_Pick,anent,ent);
168 if (anent.IsNull()) return;
169 IGESGraph_ToolPick tool;
170 tool.ReadOwnParams(anent,IR,PR);
174 DeclareAndCast(IGESGraph_TextDisplayTemplate,anent,ent);
175 if (anent.IsNull()) return;
176 IGESGraph_ToolTextDisplayTemplate tool;
177 tool.ReadOwnParams(anent,IR,PR);
181 DeclareAndCast(IGESGraph_TextFontDef,anent,ent);
182 if (anent.IsNull()) return;
183 IGESGraph_ToolTextFontDef tool;
184 tool.ReadOwnParams(anent,IR,PR);
188 DeclareAndCast(IGESGraph_UniformRectGrid,anent,ent);
189 if (anent.IsNull()) return;
190 IGESGraph_ToolUniformRectGrid tool;
191 tool.ReadOwnParams(anent,IR,PR);
199 void IGESGraph_ReadWriteModule::WriteOwnParams
200 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
201 IGESData_IGESWriter& IW) const
205 DeclareAndCast(IGESGraph_Color,anent,ent);
206 if (anent.IsNull()) return;
207 IGESGraph_ToolColor tool;
208 tool.WriteOwnParams(anent,IW);
212 DeclareAndCast(IGESGraph_DefinitionLevel,anent,ent);
213 if (anent.IsNull()) return;
214 IGESGraph_ToolDefinitionLevel tool;
215 tool.WriteOwnParams(anent,IW);
219 DeclareAndCast(IGESGraph_DrawingSize,anent,ent);
220 if (anent.IsNull()) return;
221 IGESGraph_ToolDrawingSize tool;
222 tool.WriteOwnParams(anent,IW);
226 DeclareAndCast(IGESGraph_DrawingUnits,anent,ent);
227 if (anent.IsNull()) return;
228 IGESGraph_ToolDrawingUnits tool;
229 tool.WriteOwnParams(anent,IW);
233 DeclareAndCast(IGESGraph_HighLight,anent,ent);
234 if (anent.IsNull()) return;
235 IGESGraph_ToolHighLight tool;
236 tool.WriteOwnParams(anent,IW);
240 DeclareAndCast(IGESGraph_IntercharacterSpacing,anent,ent);
241 if (anent.IsNull()) return;
242 IGESGraph_ToolIntercharacterSpacing tool;
243 tool.WriteOwnParams(anent,IW);
247 DeclareAndCast(IGESGraph_LineFontDefPattern,anent,ent);
248 if (anent.IsNull()) return;
249 IGESGraph_ToolLineFontDefPattern tool;
250 tool.WriteOwnParams(anent,IW);
254 DeclareAndCast(IGESGraph_LineFontPredefined,anent,ent);
255 if (anent.IsNull()) return;
256 IGESGraph_ToolLineFontPredefined tool;
257 tool.WriteOwnParams(anent,IW);
261 DeclareAndCast(IGESGraph_LineFontDefTemplate,anent,ent);
262 if (anent.IsNull()) return;
263 IGESGraph_ToolLineFontDefTemplate tool;
264 tool.WriteOwnParams(anent,IW);
268 DeclareAndCast(IGESGraph_NominalSize,anent,ent);
269 if (anent.IsNull()) return;
270 IGESGraph_ToolNominalSize tool;
271 tool.WriteOwnParams(anent,IW);
275 DeclareAndCast(IGESGraph_Pick,anent,ent);
276 if (anent.IsNull()) return;
277 IGESGraph_ToolPick tool;
278 tool.WriteOwnParams(anent,IW);
282 DeclareAndCast(IGESGraph_TextDisplayTemplate,anent,ent);
283 if (anent.IsNull()) return;
284 IGESGraph_ToolTextDisplayTemplate tool;
285 tool.WriteOwnParams(anent,IW);
289 DeclareAndCast(IGESGraph_TextFontDef,anent,ent);
290 if (anent.IsNull()) return;
291 IGESGraph_ToolTextFontDef tool;
292 tool.WriteOwnParams(anent,IW);
296 DeclareAndCast(IGESGraph_UniformRectGrid,anent,ent);
297 if (anent.IsNull()) return;
298 IGESGraph_ToolUniformRectGrid tool;
299 tool.WriteOwnParams(anent,IW);