0031501: Foundation Classes, Message_Printer - remove theToPutEndl argument -- prepar...
[occt.git] / src / IGESGraph / IGESGraph_ReadWriteModule.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 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
973c2be1 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.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
b311480e 13
7fd59977 14
42cf5bc1 15#include <IGESData_IGESEntity.hxx>
16#include <IGESData_IGESReaderData.hxx>
17#include <IGESData_IGESWriter.hxx>
18#include <IGESData_ParamReader.hxx>
7fd59977 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>
7fd59977 26#include <IGESGraph_LineFontDefTemplate.hxx>
42cf5bc1 27#include <IGESGraph_LineFontPredefined.hxx>
7fd59977 28#include <IGESGraph_NominalSize.hxx>
29#include <IGESGraph_Pick.hxx>
42cf5bc1 30#include <IGESGraph_ReadWriteModule.hxx>
7fd59977 31#include <IGESGraph_TextDisplayTemplate.hxx>
32#include <IGESGraph_TextFontDef.hxx>
7fd59977 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>
7fd59977 40#include <IGESGraph_ToolLineFontDefTemplate.hxx>
42cf5bc1 41#include <IGESGraph_ToolLineFontPredefined.hxx>
7fd59977 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>
42cf5bc1 47#include <IGESGraph_UniformRectGrid.hxx>
48#include <Interface_Macros.hxx>
49#include <Standard_DomainError.hxx>
50#include <Standard_Type.hxx>
7fd59977 51
92efcf78 52IMPLEMENT_STANDARD_RTTIEXT(IGESGraph_ReadWriteModule,IGESData_ReadWriteModule)
53
7fd59977 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
b311480e 57IGESGraph_ReadWriteModule::IGESGraph_ReadWriteModule () { }
7fd59977 58
59
60 Standard_Integer IGESGraph_ReadWriteModule::CaseIGES
61 (const Standard_Integer typenum, const Standard_Integer formnum) const
62{
63 switch (typenum) {
64 case 304 :
65 if (formnum == 1) return 9;
66 else if (formnum == 2) return 7;
67 break;
68 case 310 : return 13;
69 case 312 : return 12;
70 case 314 : return 1;
71 case 406 :
72 switch (formnum) {
73 case 1 : return 2;
74 case 13 : return 10;
75 case 16 : return 3;
76 case 17 : return 4;
77 case 18 : return 6;
78 case 19 : return 8;
79 case 20 : return 5;
80 case 21 : return 11;
81 case 22 : return 14;
82 default : break;
83 }
84 break;
85 default : break;
86 }
87 return 0;
88}
89
90
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
94{
95 switch (CN) {
96 case 1 : {
97 DeclareAndCast(IGESGraph_Color,anent,ent);
98 if (anent.IsNull()) return;
99 IGESGraph_ToolColor tool;
100 tool.ReadOwnParams(anent,IR,PR);
101 }
102 break;
103 case 2 : {
104 DeclareAndCast(IGESGraph_DefinitionLevel,anent,ent);
105 if (anent.IsNull()) return;
106 IGESGraph_ToolDefinitionLevel tool;
107 tool.ReadOwnParams(anent,IR,PR);
108 }
109 break;
110 case 3 : {
111 DeclareAndCast(IGESGraph_DrawingSize,anent,ent);
112 if (anent.IsNull()) return;
113 IGESGraph_ToolDrawingSize tool;
114 tool.ReadOwnParams(anent,IR,PR);
115 }
116 break;
117 case 4 : {
118 DeclareAndCast(IGESGraph_DrawingUnits,anent,ent);
119 if (anent.IsNull()) return;
120 IGESGraph_ToolDrawingUnits tool;
121 tool.ReadOwnParams(anent,IR,PR);
122 }
123 break;
124 case 5 : {
125 DeclareAndCast(IGESGraph_HighLight,anent,ent);
126 if (anent.IsNull()) return;
127 IGESGraph_ToolHighLight tool;
128 tool.ReadOwnParams(anent,IR,PR);
129 }
130 break;
131 case 6 : {
132 DeclareAndCast(IGESGraph_IntercharacterSpacing,anent,ent);
133 if (anent.IsNull()) return;
134 IGESGraph_ToolIntercharacterSpacing tool;
135 tool.ReadOwnParams(anent,IR,PR);
136 }
137 break;
138 case 7 : {
139 DeclareAndCast(IGESGraph_LineFontDefPattern,anent,ent);
140 if (anent.IsNull()) return;
141 IGESGraph_ToolLineFontDefPattern tool;
142 tool.ReadOwnParams(anent,IR,PR);
143 }
144 break;
145 case 8 : {
146 DeclareAndCast(IGESGraph_LineFontPredefined,anent,ent);
147 if (anent.IsNull()) return;
148 IGESGraph_ToolLineFontPredefined tool;
149 tool.ReadOwnParams(anent,IR,PR);
150 }
151 break;
152 case 9 : {
153 DeclareAndCast(IGESGraph_LineFontDefTemplate,anent,ent);
154 if (anent.IsNull()) return;
155 IGESGraph_ToolLineFontDefTemplate tool;
156 tool.ReadOwnParams(anent,IR,PR);
157 }
158 break;
159 case 10 : {
160 DeclareAndCast(IGESGraph_NominalSize,anent,ent);
161 if (anent.IsNull()) return;
162 IGESGraph_ToolNominalSize tool;
163 tool.ReadOwnParams(anent,IR,PR);
164 }
165 break;
166 case 11 : {
167 DeclareAndCast(IGESGraph_Pick,anent,ent);
168 if (anent.IsNull()) return;
169 IGESGraph_ToolPick tool;
170 tool.ReadOwnParams(anent,IR,PR);
171 }
172 break;
173 case 12 : {
174 DeclareAndCast(IGESGraph_TextDisplayTemplate,anent,ent);
175 if (anent.IsNull()) return;
176 IGESGraph_ToolTextDisplayTemplate tool;
177 tool.ReadOwnParams(anent,IR,PR);
178 }
179 break;
180 case 13 : {
181 DeclareAndCast(IGESGraph_TextFontDef,anent,ent);
182 if (anent.IsNull()) return;
183 IGESGraph_ToolTextFontDef tool;
184 tool.ReadOwnParams(anent,IR,PR);
185 }
186 break;
187 case 14 : {
188 DeclareAndCast(IGESGraph_UniformRectGrid,anent,ent);
189 if (anent.IsNull()) return;
190 IGESGraph_ToolUniformRectGrid tool;
191 tool.ReadOwnParams(anent,IR,PR);
192 }
193 break;
194 default : break;
195 }
196}
197
198
199 void IGESGraph_ReadWriteModule::WriteOwnParams
200 (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent,
201 IGESData_IGESWriter& IW) const
202{
203 switch (CN) {
204 case 1 : {
205 DeclareAndCast(IGESGraph_Color,anent,ent);
206 if (anent.IsNull()) return;
207 IGESGraph_ToolColor tool;
208 tool.WriteOwnParams(anent,IW);
209 }
210 break;
211 case 2 : {
212 DeclareAndCast(IGESGraph_DefinitionLevel,anent,ent);
213 if (anent.IsNull()) return;
214 IGESGraph_ToolDefinitionLevel tool;
215 tool.WriteOwnParams(anent,IW);
216 }
217 break;
218 case 3 : {
219 DeclareAndCast(IGESGraph_DrawingSize,anent,ent);
220 if (anent.IsNull()) return;
221 IGESGraph_ToolDrawingSize tool;
222 tool.WriteOwnParams(anent,IW);
223 }
224 break;
225 case 4 : {
226 DeclareAndCast(IGESGraph_DrawingUnits,anent,ent);
227 if (anent.IsNull()) return;
228 IGESGraph_ToolDrawingUnits tool;
229 tool.WriteOwnParams(anent,IW);
230 }
231 break;
232 case 5 : {
233 DeclareAndCast(IGESGraph_HighLight,anent,ent);
234 if (anent.IsNull()) return;
235 IGESGraph_ToolHighLight tool;
236 tool.WriteOwnParams(anent,IW);
237 }
238 break;
239 case 6 : {
240 DeclareAndCast(IGESGraph_IntercharacterSpacing,anent,ent);
241 if (anent.IsNull()) return;
242 IGESGraph_ToolIntercharacterSpacing tool;
243 tool.WriteOwnParams(anent,IW);
244 }
245 break;
246 case 7 : {
247 DeclareAndCast(IGESGraph_LineFontDefPattern,anent,ent);
248 if (anent.IsNull()) return;
249 IGESGraph_ToolLineFontDefPattern tool;
250 tool.WriteOwnParams(anent,IW);
251 }
252 break;
253 case 8 : {
254 DeclareAndCast(IGESGraph_LineFontPredefined,anent,ent);
255 if (anent.IsNull()) return;
256 IGESGraph_ToolLineFontPredefined tool;
257 tool.WriteOwnParams(anent,IW);
258 }
259 break;
260 case 9 : {
261 DeclareAndCast(IGESGraph_LineFontDefTemplate,anent,ent);
262 if (anent.IsNull()) return;
263 IGESGraph_ToolLineFontDefTemplate tool;
264 tool.WriteOwnParams(anent,IW);
265 }
266 break;
267 case 10 : {
268 DeclareAndCast(IGESGraph_NominalSize,anent,ent);
269 if (anent.IsNull()) return;
270 IGESGraph_ToolNominalSize tool;
271 tool.WriteOwnParams(anent,IW);
272 }
273 break;
274 case 11 : {
275 DeclareAndCast(IGESGraph_Pick,anent,ent);
276 if (anent.IsNull()) return;
277 IGESGraph_ToolPick tool;
278 tool.WriteOwnParams(anent,IW);
279 }
280 break;
281 case 12 : {
282 DeclareAndCast(IGESGraph_TextDisplayTemplate,anent,ent);
283 if (anent.IsNull()) return;
284 IGESGraph_ToolTextDisplayTemplate tool;
285 tool.WriteOwnParams(anent,IW);
286 }
287 break;
288 case 13 : {
289 DeclareAndCast(IGESGraph_TextFontDef,anent,ent);
290 if (anent.IsNull()) return;
291 IGESGraph_ToolTextFontDef tool;
292 tool.WriteOwnParams(anent,IW);
293 }
294 break;
295 case 14 : {
296 DeclareAndCast(IGESGraph_UniformRectGrid,anent,ent);
297 if (anent.IsNull()) return;
298 IGESGraph_ToolUniformRectGrid tool;
299 tool.WriteOwnParams(anent,IW);
300 }
301 break;
302 default : break;
303 }
304}