1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
21 #include <IGESData_DirChecker.hxx>
22 #include <IGESData_Dump.hxx>
23 #include <IGESData_IGESDumper.hxx>
24 #include <IGESData_IGESReaderData.hxx>
25 #include <IGESData_IGESWriter.hxx>
26 #include <IGESData_ParamCursor.hxx>
27 #include <IGESData_ParamReader.hxx>
28 #include <IGESSolid_Sphere.hxx>
29 #include <IGESSolid_ToolSphere.hxx>
30 #include <Interface_Check.hxx>
31 #include <Interface_CopyTool.hxx>
32 #include <Interface_EntityIterator.hxx>
33 #include <Interface_ShareTool.hxx>
34 #include <Message_Messenger.hxx>
35 #include <Standard_DomainError.hxx>
37 IGESSolid_ToolSphere::IGESSolid_ToolSphere () { }
40 void IGESSolid_ToolSphere::ReadOwnParams
41 (const Handle(IGESSolid_Sphere)& ent,
42 const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
44 Standard_Real tempRadius, tempreal;
46 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
48 PR.ReadReal(PR.Current(), "Radius", tempRadius); //szv#4:S4163:12Mar99 `st=` not needed
50 if (PR.DefinedElseSkip())
52 //st = PR.ReadReal(PR.Current(), "Center (X)", tempreal); //szv#4:S4163:12Mar99 moved in if
53 if (PR.ReadReal(PR.Current(), "Center (X)", tempreal))
54 tempCenter.SetX(tempreal);
56 else tempCenter.SetX(0.0);
58 if (PR.DefinedElseSkip())
60 //st = PR.ReadReal(PR.Current(), "Center (Y)", tempreal); //szv#4:S4163:12Mar99 moved in if
61 if (PR.ReadReal(PR.Current(), "Center (Y)", tempreal))
62 tempCenter.SetY(tempreal);
64 else tempCenter.SetY(0.0);
66 if (PR.DefinedElseSkip())
68 //st = PR.ReadReal(PR.Current(), "Center (Z)", tempreal); //szv#4:S4163:12Mar99 moved in if
69 if (PR.ReadReal(PR.Current(), "Center (Z)", tempreal))
70 tempCenter.SetZ(tempreal);
72 else tempCenter.SetZ(0.0);
74 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
75 ent->Init (tempRadius, tempCenter);
78 void IGESSolid_ToolSphere::WriteOwnParams
79 (const Handle(IGESSolid_Sphere)& ent, IGESData_IGESWriter& IW) const
81 IW.Send(ent->Radius());
82 IW.Send(ent->Center().X());
83 IW.Send(ent->Center().Y());
84 IW.Send(ent->Center().Z());
87 void IGESSolid_ToolSphere::OwnShared
88 (const Handle(IGESSolid_Sphere)& /* ent */, Interface_EntityIterator& /* iter */) const
92 void IGESSolid_ToolSphere::OwnCopy
93 (const Handle(IGESSolid_Sphere)& another,
94 const Handle(IGESSolid_Sphere)& ent, Interface_CopyTool& /* TC */) const
96 ent->Init (another->Radius(), another->Center().XYZ());
99 IGESData_DirChecker IGESSolid_ToolSphere::DirChecker
100 (const Handle(IGESSolid_Sphere)& /* ent */ ) const
102 IGESData_DirChecker DC(158, 0);
104 DC.Structure (IGESData_DefVoid);
105 DC.LineFont (IGESData_DefAny);
106 DC.Color (IGESData_DefAny);
108 DC.UseFlagRequired (0);
109 DC.HierarchyStatusIgnored ();
113 void IGESSolid_ToolSphere::OwnCheck
114 (const Handle(IGESSolid_Sphere)& ent,
115 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
117 if (ent->Radius() <= 0.0)
118 ach->AddFail("Radius : Not Positive");
121 void IGESSolid_ToolSphere::OwnDump
122 (const Handle(IGESSolid_Sphere)& ent, const IGESData_IGESDumper& /* dumper */,
123 Standard_OStream& S, const Standard_Integer level) const
125 S << "IGESSolid_Sphere\n"
126 << "Radius : " << ent->Radius() << "\n"
128 IGESData_DumpXYZL(S,level, ent->Center(), ent->Location());