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