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_IGESDumper.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> |
21 | #include <IGESGraph_HighLight.hxx> |
22 | #include <IGESGraph_IntercharacterSpacing.hxx> |
23 | #include <IGESGraph_LineFontDefPattern.hxx> |
7fd59977 |
24 | #include <IGESGraph_LineFontDefTemplate.hxx> |
42cf5bc1 |
25 | #include <IGESGraph_LineFontPredefined.hxx> |
7fd59977 |
26 | #include <IGESGraph_NominalSize.hxx> |
27 | #include <IGESGraph_Pick.hxx> |
42cf5bc1 |
28 | #include <IGESGraph_SpecificModule.hxx> |
7fd59977 |
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_Macros.hxx> |
47 | #include <Message_Messenger.hxx> |
48 | #include <Standard_Type.hxx> |
7fd59977 |
49 | |
92efcf78 |
50 | IMPLEMENT_STANDARD_RTTIEXT(IGESGraph_SpecificModule,IGESData_SpecificModule) |
51 | |
7fd59977 |
52 | // Each Module is attached to a Protocol : it must interprete Case Numbers |
53 | // (arguments <CN> of various methods) in accordance to values returned by |
54 | // the method TypeNumber from this Protocol |
b311480e |
55 | IGESGraph_SpecificModule::IGESGraph_SpecificModule() { } |
7fd59977 |
56 | |
57 | |
58 | void IGESGraph_SpecificModule::OwnDump |
59 | (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent, |
0ebe5b0a |
60 | const IGESData_IGESDumper& dumper, Standard_OStream& S, |
7fd59977 |
61 | const Standard_Integer own) const |
62 | { |
63 | switch (CN) { |
64 | case 1 : { |
65 | DeclareAndCast(IGESGraph_Color,anent,ent); |
66 | if (anent.IsNull()) return; |
67 | IGESGraph_ToolColor tool; |
68 | tool.OwnDump(anent,dumper,S,own); |
69 | } |
70 | break; |
71 | case 2 : { |
72 | DeclareAndCast(IGESGraph_DefinitionLevel,anent,ent); |
73 | if (anent.IsNull()) return; |
74 | IGESGraph_ToolDefinitionLevel tool; |
75 | tool.OwnDump(anent,dumper,S,own); |
76 | } |
77 | break; |
78 | case 3 : { |
79 | DeclareAndCast(IGESGraph_DrawingSize,anent,ent); |
80 | if (anent.IsNull()) return; |
81 | IGESGraph_ToolDrawingSize tool; |
82 | tool.OwnDump(anent,dumper,S,own); |
83 | } |
84 | break; |
85 | case 4 : { |
86 | DeclareAndCast(IGESGraph_DrawingUnits,anent,ent); |
87 | if (anent.IsNull()) return; |
88 | IGESGraph_ToolDrawingUnits tool; |
89 | tool.OwnDump(anent,dumper,S,own); |
90 | } |
91 | break; |
92 | case 5 : { |
93 | DeclareAndCast(IGESGraph_HighLight,anent,ent); |
94 | if (anent.IsNull()) return; |
95 | IGESGraph_ToolHighLight tool; |
96 | tool.OwnDump(anent,dumper,S,own); |
97 | } |
98 | break; |
99 | case 6 : { |
100 | DeclareAndCast(IGESGraph_IntercharacterSpacing,anent,ent); |
101 | if (anent.IsNull()) return; |
102 | IGESGraph_ToolIntercharacterSpacing tool; |
103 | tool.OwnDump(anent,dumper,S,own); |
104 | } |
105 | break; |
106 | case 7 : { |
107 | DeclareAndCast(IGESGraph_LineFontDefPattern,anent,ent); |
108 | if (anent.IsNull()) return; |
109 | IGESGraph_ToolLineFontDefPattern tool; |
110 | tool.OwnDump(anent,dumper,S,own); |
111 | } |
112 | break; |
113 | case 8 : { |
114 | DeclareAndCast(IGESGraph_LineFontPredefined,anent,ent); |
115 | if (anent.IsNull()) return; |
116 | IGESGraph_ToolLineFontPredefined tool; |
117 | tool.OwnDump(anent,dumper,S,own); |
118 | } |
119 | break; |
120 | case 9 : { |
121 | DeclareAndCast(IGESGraph_LineFontDefTemplate,anent,ent); |
122 | if (anent.IsNull()) return; |
123 | IGESGraph_ToolLineFontDefTemplate tool; |
124 | tool.OwnDump(anent,dumper,S,own); |
125 | } |
126 | break; |
127 | case 10 : { |
128 | DeclareAndCast(IGESGraph_NominalSize,anent,ent); |
129 | if (anent.IsNull()) return; |
130 | IGESGraph_ToolNominalSize tool; |
131 | tool.OwnDump(anent,dumper,S,own); |
132 | } |
133 | break; |
134 | case 11 : { |
135 | DeclareAndCast(IGESGraph_Pick,anent,ent); |
136 | if (anent.IsNull()) return; |
137 | IGESGraph_ToolPick tool; |
138 | tool.OwnDump(anent,dumper,S,own); |
139 | } |
140 | break; |
141 | case 12 : { |
142 | DeclareAndCast(IGESGraph_TextDisplayTemplate,anent,ent); |
143 | if (anent.IsNull()) return; |
144 | IGESGraph_ToolTextDisplayTemplate tool; |
145 | tool.OwnDump(anent,dumper,S,own); |
146 | } |
147 | break; |
148 | case 13 : { |
149 | DeclareAndCast(IGESGraph_TextFontDef,anent,ent); |
150 | if (anent.IsNull()) return; |
151 | IGESGraph_ToolTextFontDef tool; |
152 | tool.OwnDump(anent,dumper,S,own); |
153 | } |
154 | break; |
155 | case 14 : { |
156 | DeclareAndCast(IGESGraph_UniformRectGrid,anent,ent); |
157 | if (anent.IsNull()) return; |
158 | IGESGraph_ToolUniformRectGrid tool; |
159 | tool.OwnDump(anent,dumper,S,own); |
160 | } |
161 | break; |
162 | default : break; |
163 | } |
164 | } |
165 | |
166 | |
167 | Standard_Boolean IGESGraph_SpecificModule::OwnCorrect |
168 | (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent) const |
169 | { |
170 | // Applies only on some types |
171 | switch (CN) { |
172 | case 3 : { |
173 | DeclareAndCast(IGESGraph_DrawingSize,anent,ent); |
174 | if (anent.IsNull()) break; |
175 | IGESGraph_ToolDrawingSize tool; |
176 | return tool.OwnCorrect(anent); |
177 | } |
178 | case 4 : { |
179 | DeclareAndCast(IGESGraph_DrawingUnits,anent,ent); |
180 | if (anent.IsNull()) break; |
181 | IGESGraph_ToolDrawingUnits tool; |
182 | return tool.OwnCorrect(anent); |
183 | } |
184 | case 5 : { |
185 | DeclareAndCast(IGESGraph_HighLight,anent,ent); |
186 | if (anent.IsNull()) break; |
187 | IGESGraph_ToolHighLight tool; |
188 | return tool.OwnCorrect(anent); |
189 | } |
190 | case 6 : { |
191 | DeclareAndCast(IGESGraph_IntercharacterSpacing,anent,ent); |
192 | if (anent.IsNull()) break; |
193 | IGESGraph_ToolIntercharacterSpacing tool; |
194 | return tool.OwnCorrect(anent); |
195 | } |
196 | case 8 : { |
197 | DeclareAndCast(IGESGraph_LineFontPredefined,anent,ent); |
198 | if (anent.IsNull()) break; |
199 | IGESGraph_ToolLineFontPredefined tool; |
200 | return tool.OwnCorrect(anent); |
201 | } |
202 | case 10 : { |
203 | DeclareAndCast(IGESGraph_NominalSize,anent,ent); |
204 | if (anent.IsNull()) break; |
205 | IGESGraph_ToolNominalSize tool; |
206 | return tool.OwnCorrect(anent); |
207 | } |
208 | case 11 : { |
209 | DeclareAndCast(IGESGraph_Pick,anent,ent); |
210 | if (anent.IsNull()) break; |
211 | IGESGraph_ToolPick tool; |
212 | return tool.OwnCorrect(anent); |
213 | } |
214 | case 14 : { |
215 | DeclareAndCast(IGESGraph_UniformRectGrid,anent,ent); |
216 | if (anent.IsNull()) break; |
217 | IGESGraph_ToolUniformRectGrid tool; |
218 | return tool.OwnCorrect(anent); |
219 | } |
220 | default : break; |
221 | } |
222 | return Standard_False; |
223 | } |