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 | #include <IGESGraph_GeneralModule.ixx> |
15 | #include <Interface_Macros.hxx> |
16 | #include <Interface_Category.hxx> |
17 | |
18 | #include <IGESGraph_Color.hxx> |
19 | #include <IGESGraph_DefinitionLevel.hxx> |
20 | #include <IGESGraph_DrawingSize.hxx> |
21 | #include <IGESGraph_DrawingUnits.hxx> |
22 | #include <IGESGraph_HighLight.hxx> |
23 | #include <IGESGraph_IntercharacterSpacing.hxx> |
24 | #include <IGESGraph_LineFontDefPattern.hxx> |
25 | #include <IGESGraph_LineFontPredefined.hxx> |
26 | #include <IGESGraph_LineFontDefTemplate.hxx> |
27 | #include <IGESGraph_NominalSize.hxx> |
28 | #include <IGESGraph_Pick.hxx> |
29 | #include <IGESGraph_TextDisplayTemplate.hxx> |
30 | #include <IGESGraph_TextFontDef.hxx> |
31 | #include <IGESGraph_UniformRectGrid.hxx> |
32 | |
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_ToolLineFontPredefined.hxx> |
41 | #include <IGESGraph_ToolLineFontDefTemplate.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 | |
48 | |
49 | |
50 | // Each Module is attached to a Protocol : it must interprete Case Numbers |
51 | // (arguments <CN> of various methods) in accordance to values returned by |
52 | // the method TypeNumber from this Protocol |
53 | |
54 | |
b311480e |
55 | IGESGraph_GeneralModule::IGESGraph_GeneralModule () { } |
7fd59977 |
56 | |
57 | |
58 | void IGESGraph_GeneralModule::OwnSharedCase |
59 | (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent, |
60 | Interface_EntityIterator& iter) const |
61 | { |
62 | switch (CN) { |
63 | case 1 : { |
64 | DeclareAndCast(IGESGraph_Color,anent,ent); |
65 | if (anent.IsNull()) return; |
66 | IGESGraph_ToolColor tool; |
67 | tool.OwnShared(anent,iter); |
68 | } |
69 | break; |
70 | case 2 : { |
71 | DeclareAndCast(IGESGraph_DefinitionLevel,anent,ent); |
72 | if (anent.IsNull()) return; |
73 | IGESGraph_ToolDefinitionLevel tool; |
74 | tool.OwnShared(anent,iter); |
75 | } |
76 | break; |
77 | case 3 : { |
78 | DeclareAndCast(IGESGraph_DrawingSize,anent,ent); |
79 | if (anent.IsNull()) return; |
80 | IGESGraph_ToolDrawingSize tool; |
81 | tool.OwnShared(anent,iter); |
82 | } |
83 | break; |
84 | case 4 : { |
85 | DeclareAndCast(IGESGraph_DrawingUnits,anent,ent); |
86 | if (anent.IsNull()) return; |
87 | IGESGraph_ToolDrawingUnits tool; |
88 | tool.OwnShared(anent,iter); |
89 | } |
90 | break; |
91 | case 5 : { |
92 | DeclareAndCast(IGESGraph_HighLight,anent,ent); |
93 | if (anent.IsNull()) return; |
94 | IGESGraph_ToolHighLight tool; |
95 | tool.OwnShared(anent,iter); |
96 | } |
97 | break; |
98 | case 6 : { |
99 | DeclareAndCast(IGESGraph_IntercharacterSpacing,anent,ent); |
100 | if (anent.IsNull()) return; |
101 | IGESGraph_ToolIntercharacterSpacing tool; |
102 | tool.OwnShared(anent,iter); |
103 | } |
104 | break; |
105 | case 7 : { |
106 | DeclareAndCast(IGESGraph_LineFontDefPattern,anent,ent); |
107 | if (anent.IsNull()) return; |
108 | IGESGraph_ToolLineFontDefPattern tool; |
109 | tool.OwnShared(anent,iter); |
110 | } |
111 | break; |
112 | case 8 : { |
113 | DeclareAndCast(IGESGraph_LineFontPredefined,anent,ent); |
114 | if (anent.IsNull()) return; |
115 | IGESGraph_ToolLineFontPredefined tool; |
116 | tool.OwnShared(anent,iter); |
117 | } |
118 | break; |
119 | case 9 : { |
120 | DeclareAndCast(IGESGraph_LineFontDefTemplate,anent,ent); |
121 | if (anent.IsNull()) return; |
122 | IGESGraph_ToolLineFontDefTemplate tool; |
123 | tool.OwnShared(anent,iter); |
124 | } |
125 | break; |
126 | case 10 : { |
127 | DeclareAndCast(IGESGraph_NominalSize,anent,ent); |
128 | if (anent.IsNull()) return; |
129 | IGESGraph_ToolNominalSize tool; |
130 | tool.OwnShared(anent,iter); |
131 | } |
132 | break; |
133 | case 11 : { |
134 | DeclareAndCast(IGESGraph_Pick,anent,ent); |
135 | if (anent.IsNull()) return; |
136 | IGESGraph_ToolPick tool; |
137 | tool.OwnShared(anent,iter); |
138 | } |
139 | break; |
140 | case 12 : { |
141 | DeclareAndCast(IGESGraph_TextDisplayTemplate,anent,ent); |
142 | if (anent.IsNull()) return; |
143 | IGESGraph_ToolTextDisplayTemplate tool; |
144 | tool.OwnShared(anent,iter); |
145 | } |
146 | break; |
147 | case 13 : { |
148 | DeclareAndCast(IGESGraph_TextFontDef,anent,ent); |
149 | if (anent.IsNull()) return; |
150 | IGESGraph_ToolTextFontDef tool; |
151 | tool.OwnShared(anent,iter); |
152 | } |
153 | break; |
154 | case 14 : { |
155 | DeclareAndCast(IGESGraph_UniformRectGrid,anent,ent); |
156 | if (anent.IsNull()) return; |
157 | IGESGraph_ToolUniformRectGrid tool; |
158 | tool.OwnShared(anent,iter); |
159 | } |
160 | break; |
161 | default : break; |
162 | } |
163 | } |
164 | |
165 | |
166 | IGESData_DirChecker IGESGraph_GeneralModule::DirChecker |
167 | (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent) const |
168 | { |
169 | switch (CN) { |
170 | case 1 : { |
171 | DeclareAndCast(IGESGraph_Color,anent,ent); |
172 | if (anent.IsNull()) break; |
173 | IGESGraph_ToolColor tool; |
174 | return tool.DirChecker(anent); |
175 | } |
176 | case 2 : { |
177 | DeclareAndCast(IGESGraph_DefinitionLevel,anent,ent); |
178 | if (anent.IsNull()) break; |
179 | IGESGraph_ToolDefinitionLevel tool; |
180 | return tool.DirChecker(anent); |
181 | } |
182 | case 3 : { |
183 | DeclareAndCast(IGESGraph_DrawingSize,anent,ent); |
184 | if (anent.IsNull()) break; |
185 | IGESGraph_ToolDrawingSize tool; |
186 | return tool.DirChecker(anent); |
187 | } |
188 | case 4 : { |
189 | DeclareAndCast(IGESGraph_DrawingUnits,anent,ent); |
190 | if (anent.IsNull()) break; |
191 | IGESGraph_ToolDrawingUnits tool; |
192 | return tool.DirChecker(anent); |
193 | } |
194 | case 5 : { |
195 | DeclareAndCast(IGESGraph_HighLight,anent,ent); |
196 | if (anent.IsNull()) break; |
197 | IGESGraph_ToolHighLight tool; |
198 | return tool.DirChecker(anent); |
199 | } |
200 | case 6 : { |
201 | DeclareAndCast(IGESGraph_IntercharacterSpacing,anent,ent); |
202 | if (anent.IsNull()) break; |
203 | IGESGraph_ToolIntercharacterSpacing tool; |
204 | return tool.DirChecker(anent); |
205 | } |
206 | case 7 : { |
207 | DeclareAndCast(IGESGraph_LineFontDefPattern,anent,ent); |
208 | if (anent.IsNull()) break; |
209 | IGESGraph_ToolLineFontDefPattern tool; |
210 | return tool.DirChecker(anent); |
211 | } |
212 | case 8 : { |
213 | DeclareAndCast(IGESGraph_LineFontPredefined,anent,ent); |
214 | if (anent.IsNull()) break; |
215 | IGESGraph_ToolLineFontPredefined tool; |
216 | return tool.DirChecker(anent); |
217 | } |
218 | case 9 : { |
219 | DeclareAndCast(IGESGraph_LineFontDefTemplate,anent,ent); |
220 | if (anent.IsNull()) break; |
221 | IGESGraph_ToolLineFontDefTemplate tool; |
222 | return tool.DirChecker(anent); |
223 | } |
224 | case 10 : { |
225 | DeclareAndCast(IGESGraph_NominalSize,anent,ent); |
226 | if (anent.IsNull()) break; |
227 | IGESGraph_ToolNominalSize tool; |
228 | return tool.DirChecker(anent); |
229 | } |
230 | case 11 : { |
231 | DeclareAndCast(IGESGraph_Pick,anent,ent); |
232 | if (anent.IsNull()) break; |
233 | IGESGraph_ToolPick tool; |
234 | return tool.DirChecker(anent); |
235 | } |
236 | case 12 : { |
237 | DeclareAndCast(IGESGraph_TextDisplayTemplate,anent,ent); |
238 | if (anent.IsNull()) break; |
239 | IGESGraph_ToolTextDisplayTemplate tool; |
240 | return tool.DirChecker(anent); |
241 | } |
242 | case 13 : { |
243 | DeclareAndCast(IGESGraph_TextFontDef,anent,ent); |
244 | if (anent.IsNull()) break; |
245 | IGESGraph_ToolTextFontDef tool; |
246 | return tool.DirChecker(anent); |
247 | } |
248 | case 14 : { |
249 | DeclareAndCast(IGESGraph_UniformRectGrid,anent,ent); |
250 | if (anent.IsNull()) break; |
251 | IGESGraph_ToolUniformRectGrid tool; |
252 | return tool.DirChecker(anent); |
253 | } |
254 | default : break; |
255 | } |
256 | return IGESData_DirChecker(); // by default, no specific criterium |
257 | } |
258 | |
259 | |
260 | void IGESGraph_GeneralModule::OwnCheckCase |
261 | (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent, |
262 | const Interface_ShareTool& shares, Handle(Interface_Check)& ach) const |
263 | { |
264 | switch (CN) { |
265 | case 1 : { |
266 | DeclareAndCast(IGESGraph_Color,anent,ent); |
267 | if (anent.IsNull()) return; |
268 | IGESGraph_ToolColor tool; |
269 | tool.OwnCheck(anent,shares,ach); |
270 | } |
271 | break; |
272 | case 2 : { |
273 | DeclareAndCast(IGESGraph_DefinitionLevel,anent,ent); |
274 | if (anent.IsNull()) return; |
275 | IGESGraph_ToolDefinitionLevel tool; |
276 | tool.OwnCheck(anent,shares,ach); |
277 | } |
278 | break; |
279 | case 3 : { |
280 | DeclareAndCast(IGESGraph_DrawingSize,anent,ent); |
281 | if (anent.IsNull()) return; |
282 | IGESGraph_ToolDrawingSize tool; |
283 | tool.OwnCheck(anent,shares,ach); |
284 | } |
285 | break; |
286 | case 4 : { |
287 | DeclareAndCast(IGESGraph_DrawingUnits,anent,ent); |
288 | if (anent.IsNull()) return; |
289 | IGESGraph_ToolDrawingUnits tool; |
290 | tool.OwnCheck(anent,shares,ach); |
291 | } |
292 | break; |
293 | case 5 : { |
294 | DeclareAndCast(IGESGraph_HighLight,anent,ent); |
295 | if (anent.IsNull()) return; |
296 | IGESGraph_ToolHighLight tool; |
297 | tool.OwnCheck(anent,shares,ach); |
298 | } |
299 | break; |
300 | case 6 : { |
301 | DeclareAndCast(IGESGraph_IntercharacterSpacing,anent,ent); |
302 | if (anent.IsNull()) return; |
303 | IGESGraph_ToolIntercharacterSpacing tool; |
304 | tool.OwnCheck(anent,shares,ach); |
305 | } |
306 | break; |
307 | case 7 : { |
308 | DeclareAndCast(IGESGraph_LineFontDefPattern,anent,ent); |
309 | if (anent.IsNull()) return; |
310 | IGESGraph_ToolLineFontDefPattern tool; |
311 | tool.OwnCheck(anent,shares,ach); |
312 | } |
313 | break; |
314 | case 8 : { |
315 | DeclareAndCast(IGESGraph_LineFontPredefined,anent,ent); |
316 | if (anent.IsNull()) return; |
317 | IGESGraph_ToolLineFontPredefined tool; |
318 | tool.OwnCheck(anent,shares,ach); |
319 | } |
320 | break; |
321 | case 9 : { |
322 | DeclareAndCast(IGESGraph_LineFontDefTemplate,anent,ent); |
323 | if (anent.IsNull()) return; |
324 | IGESGraph_ToolLineFontDefTemplate tool; |
325 | tool.OwnCheck(anent,shares,ach); |
326 | } |
327 | break; |
328 | case 10 : { |
329 | DeclareAndCast(IGESGraph_NominalSize,anent,ent); |
330 | if (anent.IsNull()) return; |
331 | IGESGraph_ToolNominalSize tool; |
332 | tool.OwnCheck(anent,shares,ach); |
333 | } |
334 | break; |
335 | case 11 : { |
336 | DeclareAndCast(IGESGraph_Pick,anent,ent); |
337 | if (anent.IsNull()) return; |
338 | IGESGraph_ToolPick tool; |
339 | tool.OwnCheck(anent,shares,ach); |
340 | } |
341 | break; |
342 | case 12 : { |
343 | DeclareAndCast(IGESGraph_TextDisplayTemplate,anent,ent); |
344 | if (anent.IsNull()) return; |
345 | IGESGraph_ToolTextDisplayTemplate tool; |
346 | tool.OwnCheck(anent,shares,ach); |
347 | } |
348 | break; |
349 | case 13 : { |
350 | DeclareAndCast(IGESGraph_TextFontDef,anent,ent); |
351 | if (anent.IsNull()) return; |
352 | IGESGraph_ToolTextFontDef tool; |
353 | tool.OwnCheck(anent,shares,ach); |
354 | } |
355 | break; |
356 | case 14 : { |
357 | DeclareAndCast(IGESGraph_UniformRectGrid,anent,ent); |
358 | if (anent.IsNull()) return; |
359 | IGESGraph_ToolUniformRectGrid tool; |
360 | tool.OwnCheck(anent,shares,ach); |
361 | } |
362 | break; |
363 | default : break; |
364 | } |
365 | } |
366 | |
367 | |
368 | Standard_Boolean IGESGraph_GeneralModule::NewVoid |
369 | (const Standard_Integer CN, Handle(Standard_Transient)& ent) const |
370 | { |
371 | switch (CN) { |
372 | case 1 : ent = new IGESGraph_Color; break; |
373 | case 2 : ent = new IGESGraph_DefinitionLevel; break; |
374 | case 3 : ent = new IGESGraph_DrawingSize; break; |
375 | case 4 : ent = new IGESGraph_DrawingUnits; break; |
376 | case 5 : ent = new IGESGraph_HighLight; break; |
377 | case 6 : ent = new IGESGraph_IntercharacterSpacing; break; |
378 | case 7 : ent = new IGESGraph_LineFontDefPattern; break; |
379 | case 8 : ent = new IGESGraph_LineFontPredefined; break; |
380 | case 9 : ent = new IGESGraph_LineFontDefTemplate; break; |
381 | case 10 : ent = new IGESGraph_NominalSize; break; |
382 | case 11 : ent = new IGESGraph_Pick; break; |
383 | case 12 : ent = new IGESGraph_TextDisplayTemplate; break; |
384 | case 13 : ent = new IGESGraph_TextFontDef; break; |
385 | case 14 : ent = new IGESGraph_UniformRectGrid; break; |
386 | default : return Standard_False; // by default, Failure on Recognize |
387 | } |
388 | return Standard_True; |
389 | } |
390 | |
391 | |
392 | void IGESGraph_GeneralModule::OwnCopyCase |
393 | (const Standard_Integer CN, |
394 | const Handle(IGESData_IGESEntity)& entfrom, |
395 | const Handle(IGESData_IGESEntity)& entto, |
396 | Interface_CopyTool& TC) const |
397 | { |
398 | switch (CN) { |
399 | case 1 : { |
400 | DeclareAndCast(IGESGraph_Color,enfr,entfrom); |
401 | DeclareAndCast(IGESGraph_Color,ento,entto); |
402 | IGESGraph_ToolColor tool; |
403 | tool.OwnCopy(enfr,ento,TC); |
404 | } |
405 | break; |
406 | case 2 : { |
407 | DeclareAndCast(IGESGraph_DefinitionLevel,enfr,entfrom); |
408 | DeclareAndCast(IGESGraph_DefinitionLevel,ento,entto); |
409 | IGESGraph_ToolDefinitionLevel tool; |
410 | tool.OwnCopy(enfr,ento,TC); |
411 | } |
412 | break; |
413 | case 3 : { |
414 | DeclareAndCast(IGESGraph_DrawingSize,enfr,entfrom); |
415 | DeclareAndCast(IGESGraph_DrawingSize,ento,entto); |
416 | IGESGraph_ToolDrawingSize tool; |
417 | tool.OwnCopy(enfr,ento,TC); |
418 | } |
419 | break; |
420 | case 4 : { |
421 | DeclareAndCast(IGESGraph_DrawingUnits,enfr,entfrom); |
422 | DeclareAndCast(IGESGraph_DrawingUnits,ento,entto); |
423 | IGESGraph_ToolDrawingUnits tool; |
424 | tool.OwnCopy(enfr,ento,TC); |
425 | } |
426 | break; |
427 | case 5 : { |
428 | DeclareAndCast(IGESGraph_HighLight,enfr,entfrom); |
429 | DeclareAndCast(IGESGraph_HighLight,ento,entto); |
430 | IGESGraph_ToolHighLight tool; |
431 | tool.OwnCopy(enfr,ento,TC); |
432 | } |
433 | break; |
434 | case 6 : { |
435 | DeclareAndCast(IGESGraph_IntercharacterSpacing,enfr,entfrom); |
436 | DeclareAndCast(IGESGraph_IntercharacterSpacing,ento,entto); |
437 | IGESGraph_ToolIntercharacterSpacing tool; |
438 | tool.OwnCopy(enfr,ento,TC); |
439 | } |
440 | break; |
441 | case 7 : { |
442 | DeclareAndCast(IGESGraph_LineFontDefPattern,enfr,entfrom); |
443 | DeclareAndCast(IGESGraph_LineFontDefPattern,ento,entto); |
444 | IGESGraph_ToolLineFontDefPattern tool; |
445 | tool.OwnCopy(enfr,ento,TC); |
446 | } |
447 | break; |
448 | case 8 : { |
449 | DeclareAndCast(IGESGraph_LineFontPredefined,enfr,entfrom); |
450 | DeclareAndCast(IGESGraph_LineFontPredefined,ento,entto); |
451 | IGESGraph_ToolLineFontPredefined tool; |
452 | tool.OwnCopy(enfr,ento,TC); |
453 | } |
454 | break; |
455 | case 9 : { |
456 | DeclareAndCast(IGESGraph_LineFontDefTemplate,enfr,entfrom); |
457 | DeclareAndCast(IGESGraph_LineFontDefTemplate,ento,entto); |
458 | IGESGraph_ToolLineFontDefTemplate tool; |
459 | tool.OwnCopy(enfr,ento,TC); |
460 | } |
461 | break; |
462 | case 10 : { |
463 | DeclareAndCast(IGESGraph_NominalSize,enfr,entfrom); |
464 | DeclareAndCast(IGESGraph_NominalSize,ento,entto); |
465 | IGESGraph_ToolNominalSize tool; |
466 | tool.OwnCopy(enfr,ento,TC); |
467 | } |
468 | break; |
469 | case 11 : { |
470 | DeclareAndCast(IGESGraph_Pick,enfr,entfrom); |
471 | DeclareAndCast(IGESGraph_Pick,ento,entto); |
472 | IGESGraph_ToolPick tool; |
473 | tool.OwnCopy(enfr,ento,TC); |
474 | } |
475 | break; |
476 | case 12 : { |
477 | DeclareAndCast(IGESGraph_TextDisplayTemplate,enfr,entfrom); |
478 | DeclareAndCast(IGESGraph_TextDisplayTemplate,ento,entto); |
479 | IGESGraph_ToolTextDisplayTemplate tool; |
480 | tool.OwnCopy(enfr,ento,TC); |
481 | } |
482 | break; |
483 | case 13 : { |
484 | DeclareAndCast(IGESGraph_TextFontDef,enfr,entfrom); |
485 | DeclareAndCast(IGESGraph_TextFontDef,ento,entto); |
486 | IGESGraph_ToolTextFontDef tool; |
487 | tool.OwnCopy(enfr,ento,TC); |
488 | } |
489 | break; |
490 | case 14 : { |
491 | DeclareAndCast(IGESGraph_UniformRectGrid,enfr,entfrom); |
492 | DeclareAndCast(IGESGraph_UniformRectGrid,ento,entto); |
493 | IGESGraph_ToolUniformRectGrid tool; |
494 | tool.OwnCopy(enfr,ento,TC); |
495 | } |
496 | break; |
497 | default : break; |
498 | } |
499 | } |
500 | |
501 | |
502 | Standard_Integer IGESGraph_GeneralModule::CategoryNumber |
35e08fe8 |
503 | (const Standard_Integer /*CN*/, const Handle(Standard_Transient)& , |
7fd59977 |
504 | const Interface_ShareTool& ) const |
505 | { |
506 | return Interface_Category::Number("Drawing"); |
507 | } |