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 | // |
973c2be1 |
5 | // This library is free software; you can redistribute it and / or modify it |
6 | // under the terms of the GNU Lesser General Public 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. |
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 | #include <IGESDimen_ReadWriteModule.ixx> |
15 | #include <Interface_Macros.hxx> |
16 | |
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_DimensionTolerance.hxx> |
24 | #include <IGESDimen_DimensionUnits.hxx> |
25 | #include <IGESDimen_DimensionedGeometry.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_WitnessLine.hxx> |
40 | |
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_ToolDimensionTolerance.hxx> |
48 | #include <IGESDimen_ToolDimensionUnits.hxx> |
49 | #include <IGESDimen_ToolDimensionedGeometry.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 | |
65 | |
66 | |
67 | // Each Module is attached to a Protocol : it must interprete Case Numbers |
68 | // (arguments <CN> of various methods) in accordance to values returned by |
69 | // the method TypeNumber from this Protocol |
70 | |
71 | |
b311480e |
72 | IGESDimen_ReadWriteModule::IGESDimen_ReadWriteModule () { } |
7fd59977 |
73 | |
74 | |
75 | Standard_Integer IGESDimen_ReadWriteModule::CaseIGES |
76 | (const Standard_Integer typenum, const Standard_Integer formnum) const |
77 | { |
78 | switch (typenum) { |
79 | case 106 : |
80 | if (formnum == 20 || formnum == 21) return 3; |
81 | else if (formnum > 30 && formnum < 40) return 21; |
82 | else if (formnum == 40) return 23; |
83 | break; |
84 | case 202 : return 1; |
85 | case 204 : return 4; |
86 | case 206 : return 5; |
87 | case 208 : return 10; |
88 | case 210 : return 11; |
89 | case 212 : return 12; |
90 | case 213 : return 17; |
91 | case 214 : return 14; |
92 | case 216 : return 15; |
93 | case 218 : return 18; |
94 | case 220 : return 19; |
95 | case 222 : return 20; |
96 | case 228 : return 13; |
97 | case 230 : return 22; |
98 | case 402 : |
99 | switch (formnum) { |
100 | case 13 : return 9; |
101 | case 21 : return 16; |
102 | default : break; |
103 | } |
104 | break; |
105 | case 406 : |
106 | switch (formnum) { |
107 | case 28 : return 8; |
108 | case 29 : return 7; |
109 | case 30 : return 6; |
110 | case 31 : return 2; |
111 | default : break; |
112 | } |
113 | break; |
114 | default : break; |
115 | } |
116 | return 0; |
117 | } |
118 | |
119 | |
120 | void IGESDimen_ReadWriteModule::ReadOwnParams |
121 | (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent, |
122 | const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const |
123 | { |
124 | switch (CN) { |
125 | case 1 : { |
126 | DeclareAndCast(IGESDimen_AngularDimension,anent,ent); |
127 | if (anent.IsNull()) return; |
128 | IGESDimen_ToolAngularDimension tool; |
129 | tool.ReadOwnParams(anent,IR,PR); |
130 | } |
131 | break; |
132 | case 2 : { |
133 | DeclareAndCast(IGESDimen_BasicDimension,anent,ent); |
134 | if (anent.IsNull()) return; |
135 | IGESDimen_ToolBasicDimension tool; |
136 | tool.ReadOwnParams(anent,IR,PR); |
137 | } |
138 | break; |
139 | case 3 : { |
140 | DeclareAndCast(IGESDimen_CenterLine,anent,ent); |
141 | if (anent.IsNull()) return; |
142 | IGESDimen_ToolCenterLine tool; |
143 | tool.ReadOwnParams(anent,IR,PR); |
144 | } |
145 | break; |
146 | case 4 : { |
147 | DeclareAndCast(IGESDimen_CurveDimension,anent,ent); |
148 | if (anent.IsNull()) return; |
149 | IGESDimen_ToolCurveDimension tool; |
150 | tool.ReadOwnParams(anent,IR,PR); |
151 | } |
152 | break; |
153 | case 5 : { |
154 | DeclareAndCast(IGESDimen_DiameterDimension,anent,ent); |
155 | if (anent.IsNull()) return; |
156 | IGESDimen_ToolDiameterDimension tool; |
157 | tool.ReadOwnParams(anent,IR,PR); |
158 | } |
159 | break; |
160 | case 6 : { |
161 | DeclareAndCast(IGESDimen_DimensionDisplayData,anent,ent); |
162 | if (anent.IsNull()) return; |
163 | IGESDimen_ToolDimensionDisplayData tool; |
164 | tool.ReadOwnParams(anent,IR,PR); |
165 | } |
166 | break; |
167 | case 7 : { |
168 | DeclareAndCast(IGESDimen_DimensionTolerance,anent,ent); |
169 | if (anent.IsNull()) return; |
170 | IGESDimen_ToolDimensionTolerance tool; |
171 | tool.ReadOwnParams(anent,IR,PR); |
172 | } |
173 | break; |
174 | case 8 : { |
175 | DeclareAndCast(IGESDimen_DimensionUnits,anent,ent); |
176 | if (anent.IsNull()) return; |
177 | IGESDimen_ToolDimensionUnits tool; |
178 | tool.ReadOwnParams(anent,IR,PR); |
179 | } |
180 | break; |
181 | case 9 : { |
182 | DeclareAndCast(IGESDimen_DimensionedGeometry,anent,ent); |
183 | if (anent.IsNull()) return; |
184 | IGESDimen_ToolDimensionedGeometry tool; |
185 | tool.ReadOwnParams(anent,IR,PR); |
186 | } |
187 | break; |
188 | case 10 : { |
189 | DeclareAndCast(IGESDimen_FlagNote,anent,ent); |
190 | if (anent.IsNull()) return; |
191 | IGESDimen_ToolFlagNote tool; |
192 | tool.ReadOwnParams(anent,IR,PR); |
193 | } |
194 | break; |
195 | case 11 : { |
196 | DeclareAndCast(IGESDimen_GeneralLabel,anent,ent); |
197 | if (anent.IsNull()) return; |
198 | IGESDimen_ToolGeneralLabel tool; |
199 | tool.ReadOwnParams(anent,IR,PR); |
200 | } |
201 | break; |
202 | case 12 : { |
203 | DeclareAndCast(IGESDimen_GeneralNote,anent,ent); |
204 | if (anent.IsNull()) return; |
205 | IGESDimen_ToolGeneralNote tool; |
206 | tool.ReadOwnParams(anent,IR,PR); |
207 | } |
208 | break; |
209 | case 13 : { |
210 | DeclareAndCast(IGESDimen_GeneralSymbol,anent,ent); |
211 | if (anent.IsNull()) return; |
212 | IGESDimen_ToolGeneralSymbol tool; |
213 | tool.ReadOwnParams(anent,IR,PR); |
214 | } |
215 | break; |
216 | case 14 : { |
217 | DeclareAndCast(IGESDimen_LeaderArrow,anent,ent); |
218 | if (anent.IsNull()) return; |
219 | IGESDimen_ToolLeaderArrow tool; |
220 | tool.ReadOwnParams(anent,IR,PR); |
221 | } |
222 | break; |
223 | case 15 : { |
224 | DeclareAndCast(IGESDimen_LinearDimension,anent,ent); |
225 | if (anent.IsNull()) return; |
226 | IGESDimen_ToolLinearDimension tool; |
227 | tool.ReadOwnParams(anent,IR,PR); |
228 | } |
229 | break; |
230 | case 16 : { |
231 | DeclareAndCast(IGESDimen_NewDimensionedGeometry,anent,ent); |
232 | if (anent.IsNull()) return; |
233 | IGESDimen_ToolNewDimensionedGeometry tool; |
234 | tool.ReadOwnParams(anent,IR,PR); |
235 | } |
236 | break; |
237 | case 17 : { |
238 | DeclareAndCast(IGESDimen_NewGeneralNote,anent,ent); |
239 | if (anent.IsNull()) return; |
240 | IGESDimen_ToolNewGeneralNote tool; |
241 | tool.ReadOwnParams(anent,IR,PR); |
242 | } |
243 | break; |
244 | case 18 : { |
245 | DeclareAndCast(IGESDimen_OrdinateDimension,anent,ent); |
246 | if (anent.IsNull()) return; |
247 | IGESDimen_ToolOrdinateDimension tool; |
248 | tool.ReadOwnParams(anent,IR,PR); |
249 | } |
250 | break; |
251 | case 19 : { |
252 | DeclareAndCast(IGESDimen_PointDimension,anent,ent); |
253 | if (anent.IsNull()) return; |
254 | IGESDimen_ToolPointDimension tool; |
255 | tool.ReadOwnParams(anent,IR,PR); |
256 | } |
257 | break; |
258 | case 20 : { |
259 | DeclareAndCast(IGESDimen_RadiusDimension,anent,ent); |
260 | if (anent.IsNull()) return; |
261 | IGESDimen_ToolRadiusDimension tool; |
262 | tool.ReadOwnParams(anent,IR,PR); |
263 | } |
264 | break; |
265 | case 21 : { |
266 | DeclareAndCast(IGESDimen_Section,anent,ent); |
267 | if (anent.IsNull()) return; |
268 | IGESDimen_ToolSection tool; |
269 | tool.ReadOwnParams(anent,IR,PR); |
270 | } |
271 | break; |
272 | case 22 : { |
273 | DeclareAndCast(IGESDimen_SectionedArea,anent,ent); |
274 | if (anent.IsNull()) return; |
275 | IGESDimen_ToolSectionedArea tool; |
276 | tool.ReadOwnParams(anent,IR,PR); |
277 | } |
278 | break; |
279 | case 23 : { |
280 | DeclareAndCast(IGESDimen_WitnessLine,anent,ent); |
281 | if (anent.IsNull()) return; |
282 | IGESDimen_ToolWitnessLine tool; |
283 | tool.ReadOwnParams(anent,IR,PR); |
284 | } |
285 | break; |
286 | default : break; |
287 | } |
288 | } |
289 | |
290 | |
291 | void IGESDimen_ReadWriteModule::WriteOwnParams |
292 | (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent, |
293 | IGESData_IGESWriter& IW) const |
294 | { |
295 | switch (CN) { |
296 | case 1 : { |
297 | DeclareAndCast(IGESDimen_AngularDimension,anent,ent); |
298 | if (anent.IsNull()) return; |
299 | IGESDimen_ToolAngularDimension tool; |
300 | tool.WriteOwnParams(anent,IW); |
301 | } |
302 | break; |
303 | case 2 : { |
304 | DeclareAndCast(IGESDimen_BasicDimension,anent,ent); |
305 | if (anent.IsNull()) return; |
306 | IGESDimen_ToolBasicDimension tool; |
307 | tool.WriteOwnParams(anent,IW); |
308 | } |
309 | break; |
310 | case 3 : { |
311 | DeclareAndCast(IGESDimen_CenterLine,anent,ent); |
312 | if (anent.IsNull()) return; |
313 | IGESDimen_ToolCenterLine tool; |
314 | tool.WriteOwnParams(anent,IW); |
315 | } |
316 | break; |
317 | case 4 : { |
318 | DeclareAndCast(IGESDimen_CurveDimension,anent,ent); |
319 | if (anent.IsNull()) return; |
320 | IGESDimen_ToolCurveDimension tool; |
321 | tool.WriteOwnParams(anent,IW); |
322 | } |
323 | break; |
324 | case 5 : { |
325 | DeclareAndCast(IGESDimen_DiameterDimension,anent,ent); |
326 | if (anent.IsNull()) return; |
327 | IGESDimen_ToolDiameterDimension tool; |
328 | tool.WriteOwnParams(anent,IW); |
329 | } |
330 | break; |
331 | case 6 : { |
332 | DeclareAndCast(IGESDimen_DimensionDisplayData,anent,ent); |
333 | if (anent.IsNull()) return; |
334 | IGESDimen_ToolDimensionDisplayData tool; |
335 | tool.WriteOwnParams(anent,IW); |
336 | } |
337 | break; |
338 | case 7 : { |
339 | DeclareAndCast(IGESDimen_DimensionTolerance,anent,ent); |
340 | if (anent.IsNull()) return; |
341 | IGESDimen_ToolDimensionTolerance tool; |
342 | tool.WriteOwnParams(anent,IW); |
343 | } |
344 | break; |
345 | case 8 : { |
346 | DeclareAndCast(IGESDimen_DimensionUnits,anent,ent); |
347 | if (anent.IsNull()) return; |
348 | IGESDimen_ToolDimensionUnits tool; |
349 | tool.WriteOwnParams(anent,IW); |
350 | } |
351 | break; |
352 | case 9 : { |
353 | DeclareAndCast(IGESDimen_DimensionedGeometry,anent,ent); |
354 | if (anent.IsNull()) return; |
355 | IGESDimen_ToolDimensionedGeometry tool; |
356 | tool.WriteOwnParams(anent,IW); |
357 | } |
358 | break; |
359 | case 10 : { |
360 | DeclareAndCast(IGESDimen_FlagNote,anent,ent); |
361 | if (anent.IsNull()) return; |
362 | IGESDimen_ToolFlagNote tool; |
363 | tool.WriteOwnParams(anent,IW); |
364 | } |
365 | break; |
366 | case 11 : { |
367 | DeclareAndCast(IGESDimen_GeneralLabel,anent,ent); |
368 | if (anent.IsNull()) return; |
369 | IGESDimen_ToolGeneralLabel tool; |
370 | tool.WriteOwnParams(anent,IW); |
371 | } |
372 | break; |
373 | case 12 : { |
374 | DeclareAndCast(IGESDimen_GeneralNote,anent,ent); |
375 | if (anent.IsNull()) return; |
376 | IGESDimen_ToolGeneralNote tool; |
377 | tool.WriteOwnParams(anent,IW); |
378 | } |
379 | break; |
380 | case 13 : { |
381 | DeclareAndCast(IGESDimen_GeneralSymbol,anent,ent); |
382 | if (anent.IsNull()) return; |
383 | IGESDimen_ToolGeneralSymbol tool; |
384 | tool.WriteOwnParams(anent,IW); |
385 | } |
386 | break; |
387 | case 14 : { |
388 | DeclareAndCast(IGESDimen_LeaderArrow,anent,ent); |
389 | if (anent.IsNull()) return; |
390 | IGESDimen_ToolLeaderArrow tool; |
391 | tool.WriteOwnParams(anent,IW); |
392 | } |
393 | break; |
394 | case 15 : { |
395 | DeclareAndCast(IGESDimen_LinearDimension,anent,ent); |
396 | if (anent.IsNull()) return; |
397 | IGESDimen_ToolLinearDimension tool; |
398 | tool.WriteOwnParams(anent,IW); |
399 | } |
400 | break; |
401 | case 16 : { |
402 | DeclareAndCast(IGESDimen_NewDimensionedGeometry,anent,ent); |
403 | if (anent.IsNull()) return; |
404 | IGESDimen_ToolNewDimensionedGeometry tool; |
405 | tool.WriteOwnParams(anent,IW); |
406 | } |
407 | break; |
408 | case 17 : { |
409 | DeclareAndCast(IGESDimen_NewGeneralNote,anent,ent); |
410 | if (anent.IsNull()) return; |
411 | IGESDimen_ToolNewGeneralNote tool; |
412 | tool.WriteOwnParams(anent,IW); |
413 | } |
414 | break; |
415 | case 18 : { |
416 | DeclareAndCast(IGESDimen_OrdinateDimension,anent,ent); |
417 | if (anent.IsNull()) return; |
418 | IGESDimen_ToolOrdinateDimension tool; |
419 | tool.WriteOwnParams(anent,IW); |
420 | } |
421 | break; |
422 | case 19 : { |
423 | DeclareAndCast(IGESDimen_PointDimension,anent,ent); |
424 | if (anent.IsNull()) return; |
425 | IGESDimen_ToolPointDimension tool; |
426 | tool.WriteOwnParams(anent,IW); |
427 | } |
428 | break; |
429 | case 20 : { |
430 | DeclareAndCast(IGESDimen_RadiusDimension,anent,ent); |
431 | if (anent.IsNull()) return; |
432 | IGESDimen_ToolRadiusDimension tool; |
433 | tool.WriteOwnParams(anent,IW); |
434 | } |
435 | break; |
436 | case 21 : { |
437 | DeclareAndCast(IGESDimen_Section,anent,ent); |
438 | if (anent.IsNull()) return; |
439 | IGESDimen_ToolSection tool; |
440 | tool.WriteOwnParams(anent,IW); |
441 | } |
442 | break; |
443 | case 22 : { |
444 | DeclareAndCast(IGESDimen_SectionedArea,anent,ent); |
445 | if (anent.IsNull()) return; |
446 | IGESDimen_ToolSectionedArea tool; |
447 | tool.WriteOwnParams(anent,IW); |
448 | } |
449 | break; |
450 | case 23 : { |
451 | DeclareAndCast(IGESDimen_WitnessLine,anent,ent); |
452 | if (anent.IsNull()) return; |
453 | IGESDimen_ToolWitnessLine tool; |
454 | tool.WriteOwnParams(anent,IW); |
455 | } |
456 | break; |
457 | default : break; |
458 | } |
459 | } |