0027961: Visualization - remove unused and no more working OpenGl_AVIWriter
[occt.git] / src / IGESSolid / IGESSolid_ToolPlaneSurface.cxx
CommitLineData
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
42cf5bc1 19#include <IGESData_DirChecker.hxx>
20#include <IGESData_IGESDumper.hxx>
21#include <IGESData_IGESReaderData.hxx>
22#include <IGESData_IGESWriter.hxx>
7fd59977 23#include <IGESData_ParamCursor.hxx>
42cf5bc1 24#include <IGESData_ParamReader.hxx>
25#include <IGESData_Status.hxx>
7fd59977 26#include <IGESGeom_Direction.hxx>
42cf5bc1 27#include <IGESGeom_Point.hxx>
28#include <IGESSolid_PlaneSurface.hxx>
29#include <IGESSolid_ToolPlaneSurface.hxx>
30#include <Interface_Check.hxx>
31#include <Interface_CopyTool.hxx>
32#include <Interface_EntityIterator.hxx>
7fd59977 33#include <Interface_Macros.hxx>
42cf5bc1 34#include <Interface_ShareTool.hxx>
35#include <Message_Messenger.hxx>
7fd59977 36#include <Message_Msg.hxx>
42cf5bc1 37#include <Standard_DomainError.hxx>
7fd59977 38
42cf5bc1 39// MGE 31/07/98
7fd59977 40//=======================================================================
41//function : IGESSolid_ToolPlaneSurface
42//purpose :
43//=======================================================================
7fd59977 44IGESSolid_ToolPlaneSurface::IGESSolid_ToolPlaneSurface ()
45{
46}
47
48
49//=======================================================================
50//function : ReadOwnParams
51//purpose :
52//=======================================================================
53
54void IGESSolid_ToolPlaneSurface::ReadOwnParams(const Handle(IGESSolid_PlaneSurface)& ent,
55 const Handle(IGESData_IGESReaderData)& IR,
56 IGESData_ParamReader& PR) const
57{
58 Handle(IGESGeom_Point) tempLocation;
59 Handle(IGESGeom_Direction) tempNormal;
60 Handle(IGESGeom_Direction) tempRefdir; // default Unparametrised
61 IGESData_Status aStatus;
62 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
63
64 if (!PR.ReadEntity(IR, PR.Current(),aStatus,STANDARD_TYPE(IGESGeom_Point), tempLocation)){ //szv#4:S4163:12Mar99 `st=` not needed
65 Message_Msg Msg174("XSTEP_174");
66 switch(aStatus) {
67 case IGESData_ReferenceError: {
68 Message_Msg Msg216 ("IGES_216");
69 Msg174.Arg(Msg216.Value());
70 PR.SendFail(Msg174);
71 break; }
72 case IGESData_EntityError: {
73 Message_Msg Msg217 ("IGES_217");
74 Msg174.Arg(Msg217.Value());
75 PR.SendFail(Msg174);
76 break; }
77 case IGESData_TypeError: {
78 Message_Msg Msg218 ("IGES_218");
79 Msg174.Arg(Msg218.Value());
80 PR.SendFail(Msg174);
81 break; }
82 default:{
83 }
84 }
85 }
86/*
87 st = PR.ReadEntity(IR, PR.Current(), "Point on axis",
88 STANDARD_TYPE(IGESGeom_Point), tempLocation);
89*/
90 if (!PR.ReadEntity(IR, PR.Current(),aStatus,STANDARD_TYPE(IGESGeom_Direction), tempNormal)){ //szv#4:S4163:12Mar99 `st=` not needed
91 Message_Msg Msg175("XSTEP_175");
92 switch(aStatus) {
93 case IGESData_ReferenceError: {
94 Message_Msg Msg216 ("IGES_216");
95 Msg175.Arg(Msg216.Value());
96 PR.SendFail(Msg175);
97 break; }
98 case IGESData_EntityError: {
99 Message_Msg Msg217 ("IGES_217");
100 Msg175.Arg(Msg217.Value());
101 PR.SendFail(Msg175);
102 break; }
103 case IGESData_TypeError: {
104 Message_Msg Msg218 ("IGES_218");
105 Msg175.Arg(Msg218.Value());
106 PR.SendFail(Msg175);
107 break; }
108 default:{
109 }
110 }
111}
112/*
113 st = PR.ReadEntity(IR, PR.Current(), "Normal direction",
114 STANDARD_TYPE(IGESGeom_Direction), tempNormal);
115*/
116 if (ent->FormNumber() == 1){
117 // Parametrised surface
118 if (!PR.ReadEntity(IR, PR.Current(), aStatus, STANDARD_TYPE(IGESGeom_Direction), tempRefdir)){ //szv#4:S4163:12Mar99 `st=` not needed
119 Message_Msg Msg176("XSTEP_176");
120 switch(aStatus) {
121 case IGESData_ReferenceError: {
122 Message_Msg Msg216 ("IGES_216");
123 Msg176.Arg(Msg216.Value());
124 PR.SendFail(Msg176);
125 break; }
126 case IGESData_EntityError: {
127 Message_Msg Msg217 ("IGES_217");
128 Msg176.Arg(Msg217.Value());
129 PR.SendFail(Msg176);
130 break; }
131 case IGESData_TypeError: {
132 Message_Msg Msg218 ("IGES_218");
133 Msg176.Arg(Msg218.Value());
134 PR.SendFail(Msg176);
135 break; }
136 default:{
137 }
138 }
139 }
140 }
141/*
142 st = PR.ReadEntity(IR, PR.Current(), "Reference direction",
143 STANDARD_TYPE(IGESGeom_Direction), tempRefdir);
144*/
145 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
146 ent->Init (tempLocation, tempNormal, tempRefdir);
147}
148
149
150//=======================================================================
151//function : WriteOwnParams
152//purpose :
153//=======================================================================
154
155void IGESSolid_ToolPlaneSurface::WriteOwnParams
156 (const Handle(IGESSolid_PlaneSurface)& ent, IGESData_IGESWriter& IW) const
157{
158 IW.Send(ent->LocationPoint());
159 IW.Send(ent->Normal());
160 if (ent->IsParametrised()) IW.Send(ent->ReferenceDir());
161}
162
163
164//=======================================================================
165//function : OwnShared
166//purpose :
167//=======================================================================
168
169void IGESSolid_ToolPlaneSurface::OwnShared(const Handle(IGESSolid_PlaneSurface)& ent,
170 Interface_EntityIterator& iter) const
171{
172 iter.GetOneItem(ent->LocationPoint());
173 iter.GetOneItem(ent->Normal());
174 iter.GetOneItem(ent->ReferenceDir());
175}
176
177
178//=======================================================================
179//function : OwnCopy
180//purpose :
181//=======================================================================
182
183void IGESSolid_ToolPlaneSurface::OwnCopy
184 (const Handle(IGESSolid_PlaneSurface)& another,
185 const Handle(IGESSolid_PlaneSurface)& ent, Interface_CopyTool& TC) const
186{
187 DeclareAndCast(IGESGeom_Point, tempLocation,
188 TC.Transferred(another->LocationPoint()));
189 DeclareAndCast(IGESGeom_Direction, tempNormal,
190 TC.Transferred(another->Normal()));
191 if (another->IsParametrised())
192 {
193 DeclareAndCast(IGESGeom_Direction, tempRefdir,
194 TC.Transferred(another->ReferenceDir()));
195 ent->Init (tempLocation, tempNormal, tempRefdir);
196 }
197 else
198 {
199 Handle(IGESGeom_Direction) tempRefdir;
200 ent->Init (tempLocation, tempNormal, tempRefdir);
201 }
202}
203
204
205//=======================================================================
206//function : DirChecker
207//purpose :
208//=======================================================================
209
210IGESData_DirChecker IGESSolid_ToolPlaneSurface::DirChecker
211 (const Handle(IGESSolid_PlaneSurface)& /*ent*/) const
212{
213 IGESData_DirChecker DC(190, 0, 1);
214
215 DC.Structure (IGESData_DefVoid);
216 DC.LineFont (IGESData_DefAny);
217 DC.Color (IGESData_DefAny);
218
219 DC.BlankStatusIgnored ();
220 DC.HierarchyStatusIgnored ();
221 return DC;
222}
223
224
225//=======================================================================
226//function : OwnCheck
227//purpose :
228//=======================================================================
229
230void IGESSolid_ToolPlaneSurface::OwnCheck(const Handle(IGESSolid_PlaneSurface)& ent,
231 const Interface_ShareTool&,
232 Handle(Interface_Check)& ach) const
233{
234
235 // MGE 31/07/98
236 // Building of messages
237 //========================================
238 //Message_Msg Msg177("XSTEP_177");
239 //========================================
240
241 Standard_Integer fn = 0;
242 if (ent->IsParametrised()) fn = 1;
243 if (fn != ent->FormNumber()) {
244 Message_Msg Msg177("XSTEP_177");
245 ach->SendFail (Msg177);
246 }
247}
248
249
250//=======================================================================
251//function : OwnDump
252//purpose :
253//=======================================================================
254
255void IGESSolid_ToolPlaneSurface::OwnDump(const Handle(IGESSolid_PlaneSurface)& ent,
256 const IGESData_IGESDumper& dumper,
257 const Handle(Message_Messenger)& S,
258 const Standard_Integer level) const
259{
260 S << "IGESSolid_PlaneSurface" << endl;
261
262 Standard_Integer sublevel = (level <= 4) ? 0 : 1;
263 S << "Point on axis : ";
264 dumper.Dump(ent->LocationPoint(),S, sublevel);
265 S << endl;
266 S << "Normal direction : ";
267 dumper.Dump(ent->Normal(),S, sublevel);
268 S << endl;
269 if (ent->IsParametrised())
270 {
271 S << "Surface is Parametrised - Reference direction : ";
272 dumper.Dump(ent->ReferenceDir(),S, sublevel);
273 S << endl;
274 }
275 else S << "Surface is UnParametrised" << endl;
276}