b311480e |
1 | // Created by: CKY / Contract Toubro-Larsen |
2 | // Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
3 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
7fd59977 |
6 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
7fd59977 |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
b311480e |
15 | |
16 | //-------------------------------------------------------------------- |
7fd59977 |
17 | //-------------------------------------------------------------------- |
18 | |
19 | #include <IGESSolid_ToolPlaneSurface.ixx> |
20 | #include <IGESData_ParamCursor.hxx> |
21 | #include <IGESGeom_Point.hxx> |
22 | #include <IGESGeom_Direction.hxx> |
23 | #include <Interface_Macros.hxx> |
24 | |
25 | |
26 | // MGE 31/07/98 |
27 | #include <Message_Msg.hxx> |
28 | #include <IGESData_Status.hxx> |
29 | |
30 | //======================================================================= |
31 | //function : IGESSolid_ToolPlaneSurface |
32 | //purpose : |
33 | //======================================================================= |
34 | |
35 | IGESSolid_ToolPlaneSurface::IGESSolid_ToolPlaneSurface () |
36 | { |
37 | } |
38 | |
39 | |
40 | //======================================================================= |
41 | //function : ReadOwnParams |
42 | //purpose : |
43 | //======================================================================= |
44 | |
45 | void IGESSolid_ToolPlaneSurface::ReadOwnParams(const Handle(IGESSolid_PlaneSurface)& ent, |
46 | const Handle(IGESData_IGESReaderData)& IR, |
47 | IGESData_ParamReader& PR) const |
48 | { |
49 | Handle(IGESGeom_Point) tempLocation; |
50 | Handle(IGESGeom_Direction) tempNormal; |
51 | Handle(IGESGeom_Direction) tempRefdir; // default Unparametrised |
52 | IGESData_Status aStatus; |
53 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
54 | |
55 | if (!PR.ReadEntity(IR, PR.Current(),aStatus,STANDARD_TYPE(IGESGeom_Point), tempLocation)){ //szv#4:S4163:12Mar99 `st=` not needed |
56 | Message_Msg Msg174("XSTEP_174"); |
57 | switch(aStatus) { |
58 | case IGESData_ReferenceError: { |
59 | Message_Msg Msg216 ("IGES_216"); |
60 | Msg174.Arg(Msg216.Value()); |
61 | PR.SendFail(Msg174); |
62 | break; } |
63 | case IGESData_EntityError: { |
64 | Message_Msg Msg217 ("IGES_217"); |
65 | Msg174.Arg(Msg217.Value()); |
66 | PR.SendFail(Msg174); |
67 | break; } |
68 | case IGESData_TypeError: { |
69 | Message_Msg Msg218 ("IGES_218"); |
70 | Msg174.Arg(Msg218.Value()); |
71 | PR.SendFail(Msg174); |
72 | break; } |
73 | default:{ |
74 | } |
75 | } |
76 | } |
77 | /* |
78 | st = PR.ReadEntity(IR, PR.Current(), "Point on axis", |
79 | STANDARD_TYPE(IGESGeom_Point), tempLocation); |
80 | */ |
81 | if (!PR.ReadEntity(IR, PR.Current(),aStatus,STANDARD_TYPE(IGESGeom_Direction), tempNormal)){ //szv#4:S4163:12Mar99 `st=` not needed |
82 | Message_Msg Msg175("XSTEP_175"); |
83 | switch(aStatus) { |
84 | case IGESData_ReferenceError: { |
85 | Message_Msg Msg216 ("IGES_216"); |
86 | Msg175.Arg(Msg216.Value()); |
87 | PR.SendFail(Msg175); |
88 | break; } |
89 | case IGESData_EntityError: { |
90 | Message_Msg Msg217 ("IGES_217"); |
91 | Msg175.Arg(Msg217.Value()); |
92 | PR.SendFail(Msg175); |
93 | break; } |
94 | case IGESData_TypeError: { |
95 | Message_Msg Msg218 ("IGES_218"); |
96 | Msg175.Arg(Msg218.Value()); |
97 | PR.SendFail(Msg175); |
98 | break; } |
99 | default:{ |
100 | } |
101 | } |
102 | } |
103 | /* |
104 | st = PR.ReadEntity(IR, PR.Current(), "Normal direction", |
105 | STANDARD_TYPE(IGESGeom_Direction), tempNormal); |
106 | */ |
107 | if (ent->FormNumber() == 1){ |
108 | // Parametrised surface |
109 | if (!PR.ReadEntity(IR, PR.Current(), aStatus, STANDARD_TYPE(IGESGeom_Direction), tempRefdir)){ //szv#4:S4163:12Mar99 `st=` not needed |
110 | Message_Msg Msg176("XSTEP_176"); |
111 | switch(aStatus) { |
112 | case IGESData_ReferenceError: { |
113 | Message_Msg Msg216 ("IGES_216"); |
114 | Msg176.Arg(Msg216.Value()); |
115 | PR.SendFail(Msg176); |
116 | break; } |
117 | case IGESData_EntityError: { |
118 | Message_Msg Msg217 ("IGES_217"); |
119 | Msg176.Arg(Msg217.Value()); |
120 | PR.SendFail(Msg176); |
121 | break; } |
122 | case IGESData_TypeError: { |
123 | Message_Msg Msg218 ("IGES_218"); |
124 | Msg176.Arg(Msg218.Value()); |
125 | PR.SendFail(Msg176); |
126 | break; } |
127 | default:{ |
128 | } |
129 | } |
130 | } |
131 | } |
132 | /* |
133 | st = PR.ReadEntity(IR, PR.Current(), "Reference direction", |
134 | STANDARD_TYPE(IGESGeom_Direction), tempRefdir); |
135 | */ |
136 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
137 | ent->Init (tempLocation, tempNormal, tempRefdir); |
138 | } |
139 | |
140 | |
141 | //======================================================================= |
142 | //function : WriteOwnParams |
143 | //purpose : |
144 | //======================================================================= |
145 | |
146 | void IGESSolid_ToolPlaneSurface::WriteOwnParams |
147 | (const Handle(IGESSolid_PlaneSurface)& ent, IGESData_IGESWriter& IW) const |
148 | { |
149 | IW.Send(ent->LocationPoint()); |
150 | IW.Send(ent->Normal()); |
151 | if (ent->IsParametrised()) IW.Send(ent->ReferenceDir()); |
152 | } |
153 | |
154 | |
155 | //======================================================================= |
156 | //function : OwnShared |
157 | //purpose : |
158 | //======================================================================= |
159 | |
160 | void IGESSolid_ToolPlaneSurface::OwnShared(const Handle(IGESSolid_PlaneSurface)& ent, |
161 | Interface_EntityIterator& iter) const |
162 | { |
163 | iter.GetOneItem(ent->LocationPoint()); |
164 | iter.GetOneItem(ent->Normal()); |
165 | iter.GetOneItem(ent->ReferenceDir()); |
166 | } |
167 | |
168 | |
169 | //======================================================================= |
170 | //function : OwnCopy |
171 | //purpose : |
172 | //======================================================================= |
173 | |
174 | void IGESSolid_ToolPlaneSurface::OwnCopy |
175 | (const Handle(IGESSolid_PlaneSurface)& another, |
176 | const Handle(IGESSolid_PlaneSurface)& ent, Interface_CopyTool& TC) const |
177 | { |
178 | DeclareAndCast(IGESGeom_Point, tempLocation, |
179 | TC.Transferred(another->LocationPoint())); |
180 | DeclareAndCast(IGESGeom_Direction, tempNormal, |
181 | TC.Transferred(another->Normal())); |
182 | if (another->IsParametrised()) |
183 | { |
184 | DeclareAndCast(IGESGeom_Direction, tempRefdir, |
185 | TC.Transferred(another->ReferenceDir())); |
186 | ent->Init (tempLocation, tempNormal, tempRefdir); |
187 | } |
188 | else |
189 | { |
190 | Handle(IGESGeom_Direction) tempRefdir; |
191 | ent->Init (tempLocation, tempNormal, tempRefdir); |
192 | } |
193 | } |
194 | |
195 | |
196 | //======================================================================= |
197 | //function : DirChecker |
198 | //purpose : |
199 | //======================================================================= |
200 | |
201 | IGESData_DirChecker IGESSolid_ToolPlaneSurface::DirChecker |
202 | (const Handle(IGESSolid_PlaneSurface)& /*ent*/) const |
203 | { |
204 | IGESData_DirChecker DC(190, 0, 1); |
205 | |
206 | DC.Structure (IGESData_DefVoid); |
207 | DC.LineFont (IGESData_DefAny); |
208 | DC.Color (IGESData_DefAny); |
209 | |
210 | DC.BlankStatusIgnored (); |
211 | DC.HierarchyStatusIgnored (); |
212 | return DC; |
213 | } |
214 | |
215 | |
216 | //======================================================================= |
217 | //function : OwnCheck |
218 | //purpose : |
219 | //======================================================================= |
220 | |
221 | void IGESSolid_ToolPlaneSurface::OwnCheck(const Handle(IGESSolid_PlaneSurface)& ent, |
222 | const Interface_ShareTool&, |
223 | Handle(Interface_Check)& ach) const |
224 | { |
225 | |
226 | // MGE 31/07/98 |
227 | // Building of messages |
228 | //======================================== |
229 | //Message_Msg Msg177("XSTEP_177"); |
230 | //======================================== |
231 | |
232 | Standard_Integer fn = 0; |
233 | if (ent->IsParametrised()) fn = 1; |
234 | if (fn != ent->FormNumber()) { |
235 | Message_Msg Msg177("XSTEP_177"); |
236 | ach->SendFail (Msg177); |
237 | } |
238 | } |
239 | |
240 | |
241 | //======================================================================= |
242 | //function : OwnDump |
243 | //purpose : |
244 | //======================================================================= |
245 | |
246 | void IGESSolid_ToolPlaneSurface::OwnDump(const Handle(IGESSolid_PlaneSurface)& ent, |
247 | const IGESData_IGESDumper& dumper, |
248 | const Handle(Message_Messenger)& S, |
249 | const Standard_Integer level) const |
250 | { |
251 | S << "IGESSolid_PlaneSurface" << endl; |
252 | |
253 | Standard_Integer sublevel = (level <= 4) ? 0 : 1; |
254 | S << "Point on axis : "; |
255 | dumper.Dump(ent->LocationPoint(),S, sublevel); |
256 | S << endl; |
257 | S << "Normal direction : "; |
258 | dumper.Dump(ent->Normal(),S, sublevel); |
259 | S << endl; |
260 | if (ent->IsParametrised()) |
261 | { |
262 | S << "Surface is Parametrised - Reference direction : "; |
263 | dumper.Dump(ent->ReferenceDir(),S, sublevel); |
264 | S << endl; |
265 | } |
266 | else S << "Surface is UnParametrised" << endl; |
267 | } |