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 <IGESDraw_CircArraySubfigure.hxx> |
20 | #include <IGESDraw_ConnectPoint.hxx> |
21 | #include <IGESDraw_Drawing.hxx> |
22 | #include <IGESDraw_DrawingWithRotation.hxx> |
23 | #include <IGESDraw_LabelDisplay.hxx> |
24 | #include <IGESDraw_NetworkSubfigure.hxx> |
25 | #include <IGESDraw_NetworkSubfigureDef.hxx> |
26 | #include <IGESDraw_PerspectiveView.hxx> |
27 | #include <IGESDraw_Planar.hxx> |
42cf5bc1 |
28 | #include <IGESDraw_ReadWriteModule.hxx> |
7fd59977 |
29 | #include <IGESDraw_RectArraySubfigure.hxx> |
30 | #include <IGESDraw_SegmentedViewsVisible.hxx> |
7fd59977 |
31 | #include <IGESDraw_ToolCircArraySubfigure.hxx> |
32 | #include <IGESDraw_ToolConnectPoint.hxx> |
33 | #include <IGESDraw_ToolDrawing.hxx> |
34 | #include <IGESDraw_ToolDrawingWithRotation.hxx> |
35 | #include <IGESDraw_ToolLabelDisplay.hxx> |
36 | #include <IGESDraw_ToolNetworkSubfigure.hxx> |
37 | #include <IGESDraw_ToolNetworkSubfigureDef.hxx> |
38 | #include <IGESDraw_ToolPerspectiveView.hxx> |
39 | #include <IGESDraw_ToolPlanar.hxx> |
40 | #include <IGESDraw_ToolRectArraySubfigure.hxx> |
41 | #include <IGESDraw_ToolSegmentedViewsVisible.hxx> |
42 | #include <IGESDraw_ToolView.hxx> |
43 | #include <IGESDraw_ToolViewsVisible.hxx> |
44 | #include <IGESDraw_ToolViewsVisibleWithAttr.hxx> |
42cf5bc1 |
45 | #include <IGESDraw_View.hxx> |
46 | #include <IGESDraw_ViewsVisible.hxx> |
47 | #include <IGESDraw_ViewsVisibleWithAttr.hxx> |
48 | #include <Interface_Macros.hxx> |
49 | #include <Standard_DomainError.hxx> |
50 | #include <Standard_Type.hxx> |
7fd59977 |
51 | |
92efcf78 |
52 | IMPLEMENT_STANDARD_RTTIEXT(IGESDraw_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 |
57 | IGESDraw_ReadWriteModule::IGESDraw_ReadWriteModule () { } |
7fd59977 |
58 | |
59 | |
60 | Standard_Integer IGESDraw_ReadWriteModule::CaseIGES |
61 | (const Standard_Integer typenum, const Standard_Integer formnum) const |
62 | { |
63 | switch (typenum) { |
64 | case 132 : return 2; |
65 | case 320 : return 7; |
66 | case 402 : |
67 | switch (formnum) { |
68 | case 3 : return 13; |
69 | case 4 : return 14; |
70 | case 5 : return 5; |
71 | case 16 : return 9; |
72 | case 19 : return 11; |
73 | default : break; |
74 | } |
75 | break; |
76 | case 404 : return formnum+3; // 0->3 1->4 |
77 | case 410 : |
78 | if (formnum == 0) return 12; |
79 | else if (formnum == 1) return 8; |
80 | break; |
81 | case 412 : return 10; |
82 | case 414 : return 1; |
83 | case 420 : return 6; |
84 | default : break; |
85 | } |
86 | return 0; |
87 | } |
88 | |
89 | |
90 | void IGESDraw_ReadWriteModule::ReadOwnParams |
91 | (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent, |
92 | const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const |
93 | { |
94 | switch (CN) { |
95 | case 1 : { |
96 | DeclareAndCast(IGESDraw_CircArraySubfigure,anent,ent); |
97 | if (anent.IsNull()) return; |
98 | IGESDraw_ToolCircArraySubfigure tool; |
99 | tool.ReadOwnParams(anent,IR,PR); |
100 | } |
101 | break; |
102 | case 2 : { |
103 | DeclareAndCast(IGESDraw_ConnectPoint,anent,ent); |
104 | if (anent.IsNull()) return; |
105 | IGESDraw_ToolConnectPoint tool; |
106 | tool.ReadOwnParams(anent,IR,PR); |
107 | } |
108 | break; |
109 | case 3 : { |
110 | DeclareAndCast(IGESDraw_Drawing,anent,ent); |
111 | if (anent.IsNull()) return; |
112 | IGESDraw_ToolDrawing tool; |
113 | tool.ReadOwnParams(anent,IR,PR); |
114 | } |
115 | break; |
116 | case 4 : { |
117 | DeclareAndCast(IGESDraw_DrawingWithRotation,anent,ent); |
118 | if (anent.IsNull()) return; |
119 | IGESDraw_ToolDrawingWithRotation tool; |
120 | tool.ReadOwnParams(anent,IR,PR); |
121 | } |
122 | break; |
123 | case 5 : { |
124 | DeclareAndCast(IGESDraw_LabelDisplay,anent,ent); |
125 | if (anent.IsNull()) return; |
126 | IGESDraw_ToolLabelDisplay tool; |
127 | tool.ReadOwnParams(anent,IR,PR); |
128 | } |
129 | break; |
130 | case 6 : { |
131 | DeclareAndCast(IGESDraw_NetworkSubfigure,anent,ent); |
132 | if (anent.IsNull()) return; |
133 | IGESDraw_ToolNetworkSubfigure tool; |
134 | tool.ReadOwnParams(anent,IR,PR); |
135 | } |
136 | break; |
137 | case 7 : { |
138 | DeclareAndCast(IGESDraw_NetworkSubfigureDef,anent,ent); |
139 | if (anent.IsNull()) return; |
140 | IGESDraw_ToolNetworkSubfigureDef tool; |
141 | tool.ReadOwnParams(anent,IR,PR); |
142 | } |
143 | break; |
144 | case 8 : { |
145 | DeclareAndCast(IGESDraw_PerspectiveView,anent,ent); |
146 | if (anent.IsNull()) return; |
147 | IGESDraw_ToolPerspectiveView tool; |
148 | tool.ReadOwnParams(anent,IR,PR); |
149 | } |
150 | break; |
151 | case 9 : { |
152 | DeclareAndCast(IGESDraw_Planar,anent,ent); |
153 | if (anent.IsNull()) return; |
154 | IGESDraw_ToolPlanar tool; |
155 | tool.ReadOwnParams(anent,IR,PR); |
156 | } |
157 | break; |
158 | case 10 : { |
159 | DeclareAndCast(IGESDraw_RectArraySubfigure,anent,ent); |
160 | if (anent.IsNull()) return; |
161 | IGESDraw_ToolRectArraySubfigure tool; |
162 | tool.ReadOwnParams(anent,IR,PR); |
163 | } |
164 | break; |
165 | case 11 : { |
166 | DeclareAndCast(IGESDraw_SegmentedViewsVisible,anent,ent); |
167 | if (anent.IsNull()) return; |
168 | IGESDraw_ToolSegmentedViewsVisible tool; |
169 | tool.ReadOwnParams(anent,IR,PR); |
170 | } |
171 | break; |
172 | case 12 : { |
173 | DeclareAndCast(IGESDraw_View,anent,ent); |
174 | if (anent.IsNull()) return; |
175 | IGESDraw_ToolView tool; |
176 | tool.ReadOwnParams(anent,IR,PR); |
177 | } |
178 | break; |
179 | case 13 : { |
180 | DeclareAndCast(IGESDraw_ViewsVisible,anent,ent); |
181 | if (anent.IsNull()) return; |
182 | IGESDraw_ToolViewsVisible tool; |
183 | tool.ReadOwnParams(anent,IR,PR); |
184 | } |
185 | break; |
186 | case 14 : { |
187 | DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,anent,ent); |
188 | if (anent.IsNull()) return; |
189 | IGESDraw_ToolViewsVisibleWithAttr tool; |
190 | tool.ReadOwnParams(anent,IR,PR); |
191 | } |
192 | break; |
193 | default : break; |
194 | } |
195 | } |
196 | |
197 | |
198 | void IGESDraw_ReadWriteModule::WriteOwnParams |
199 | (const Standard_Integer CN, const Handle(IGESData_IGESEntity)& ent, |
200 | IGESData_IGESWriter& IW) const |
201 | { |
202 | switch (CN) { |
203 | case 1 : { |
204 | DeclareAndCast(IGESDraw_CircArraySubfigure,anent,ent); |
205 | if (anent.IsNull()) return; |
206 | IGESDraw_ToolCircArraySubfigure tool; |
207 | tool.WriteOwnParams(anent,IW); |
208 | } |
209 | break; |
210 | case 2 : { |
211 | DeclareAndCast(IGESDraw_ConnectPoint,anent,ent); |
212 | if (anent.IsNull()) return; |
213 | IGESDraw_ToolConnectPoint tool; |
214 | tool.WriteOwnParams(anent,IW); |
215 | } |
216 | break; |
217 | case 3 : { |
218 | DeclareAndCast(IGESDraw_Drawing,anent,ent); |
219 | if (anent.IsNull()) return; |
220 | IGESDraw_ToolDrawing tool; |
221 | tool.WriteOwnParams(anent,IW); |
222 | } |
223 | break; |
224 | case 4 : { |
225 | DeclareAndCast(IGESDraw_DrawingWithRotation,anent,ent); |
226 | if (anent.IsNull()) return; |
227 | IGESDraw_ToolDrawingWithRotation tool; |
228 | tool.WriteOwnParams(anent,IW); |
229 | } |
230 | break; |
231 | case 5 : { |
232 | DeclareAndCast(IGESDraw_LabelDisplay,anent,ent); |
233 | if (anent.IsNull()) return; |
234 | IGESDraw_ToolLabelDisplay tool; |
235 | tool.WriteOwnParams(anent,IW); |
236 | } |
237 | break; |
238 | case 6 : { |
239 | DeclareAndCast(IGESDraw_NetworkSubfigure,anent,ent); |
240 | if (anent.IsNull()) return; |
241 | IGESDraw_ToolNetworkSubfigure tool; |
242 | tool.WriteOwnParams(anent,IW); |
243 | } |
244 | break; |
245 | case 7 : { |
246 | DeclareAndCast(IGESDraw_NetworkSubfigureDef,anent,ent); |
247 | if (anent.IsNull()) return; |
248 | IGESDraw_ToolNetworkSubfigureDef tool; |
249 | tool.WriteOwnParams(anent,IW); |
250 | } |
251 | break; |
252 | case 8 : { |
253 | DeclareAndCast(IGESDraw_PerspectiveView,anent,ent); |
254 | if (anent.IsNull()) return; |
255 | IGESDraw_ToolPerspectiveView tool; |
256 | tool.WriteOwnParams(anent,IW); |
257 | } |
258 | break; |
259 | case 9 : { |
260 | DeclareAndCast(IGESDraw_Planar,anent,ent); |
261 | if (anent.IsNull()) return; |
262 | IGESDraw_ToolPlanar tool; |
263 | tool.WriteOwnParams(anent,IW); |
264 | } |
265 | break; |
266 | case 10 : { |
267 | DeclareAndCast(IGESDraw_RectArraySubfigure,anent,ent); |
268 | if (anent.IsNull()) return; |
269 | IGESDraw_ToolRectArraySubfigure tool; |
270 | tool.WriteOwnParams(anent,IW); |
271 | } |
272 | break; |
273 | case 11 : { |
274 | DeclareAndCast(IGESDraw_SegmentedViewsVisible,anent,ent); |
275 | if (anent.IsNull()) return; |
276 | IGESDraw_ToolSegmentedViewsVisible tool; |
277 | tool.WriteOwnParams(anent,IW); |
278 | } |
279 | break; |
280 | case 12 : { |
281 | DeclareAndCast(IGESDraw_View,anent,ent); |
282 | if (anent.IsNull()) return; |
283 | IGESDraw_ToolView tool; |
284 | tool.WriteOwnParams(anent,IW); |
285 | } |
286 | break; |
287 | case 13 : { |
288 | DeclareAndCast(IGESDraw_ViewsVisible,anent,ent); |
289 | if (anent.IsNull()) return; |
290 | IGESDraw_ToolViewsVisible tool; |
291 | tool.WriteOwnParams(anent,IW); |
292 | } |
293 | break; |
294 | case 14 : { |
295 | DeclareAndCast(IGESDraw_ViewsVisibleWithAttr,anent,ent); |
296 | if (anent.IsNull()) return; |
297 | IGESDraw_ToolViewsVisibleWithAttr tool; |
298 | tool.WriteOwnParams(anent,IW); |
299 | } |
300 | break; |
301 | default : break; |
302 | } |
303 | } |