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 //--------------------------------------------------------------------
19 #include <IGESSolid_ToolConicalSurface.ixx>
20 #include <IGESData_ParamCursor.hxx>
21 #include <IGESGeom_Point.hxx>
22 #include <IGESGeom_Direction.hxx>
23 #include <Interface_Macros.hxx>
26 IGESSolid_ToolConicalSurface::IGESSolid_ToolConicalSurface () { }
29 void IGESSolid_ToolConicalSurface::ReadOwnParams
30 (const Handle(IGESSolid_ConicalSurface)& ent,
31 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
33 Handle(IGESGeom_Point) tempLocation;
34 Handle(IGESGeom_Direction) tempAxis;
35 Handle(IGESGeom_Direction) tempRefdir; // default Unparametrised
36 Standard_Real tempRadius, tempAngle;
37 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
39 PR.ReadEntity(IR, PR.Current(), "Point on axis",
40 STANDARD_TYPE(IGESGeom_Point), tempLocation); //szv#4:S4163:12Mar99 `st=` not needed
42 PR.ReadEntity(IR, PR.Current(), "Axis direction",
43 STANDARD_TYPE(IGESGeom_Direction), tempAxis); //szv#4:S4163:12Mar99 `st=` not needed
45 PR.ReadReal(PR.Current(), "Radius", tempRadius); //szv#4:S4163:12Mar99 `st=` not needed
47 PR.ReadReal(PR.Current(), "Semi-angle", tempAngle); //szv#4:S4163:12Mar99 `st=` not needed
49 if (ent->FormNumber() == 1) // Parametrised surface
50 PR.ReadEntity(IR, PR.Current(), "Reference direction",
51 STANDARD_TYPE(IGESGeom_Direction), tempRefdir); //szv#4:S4163:12Mar99 `st=` not needed
53 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
55 (tempLocation, tempAxis, tempRadius, tempAngle, tempRefdir);
58 void IGESSolid_ToolConicalSurface::WriteOwnParams
59 (const Handle(IGESSolid_ConicalSurface)& ent, IGESData_IGESWriter& IW) const
61 IW.Send(ent->LocationPoint());
63 IW.Send(ent->Radius());
64 IW.Send(ent->SemiAngle());
65 if (ent->IsParametrised()) IW.Send(ent->ReferenceDir()); // cf FormNumber
68 void IGESSolid_ToolConicalSurface::OwnShared
69 (const Handle(IGESSolid_ConicalSurface)& ent, Interface_EntityIterator& iter) const
71 iter.GetOneItem(ent->LocationPoint());
72 iter.GetOneItem(ent->Axis());
73 iter.GetOneItem(ent->ReferenceDir());
76 void IGESSolid_ToolConicalSurface::OwnCopy
77 (const Handle(IGESSolid_ConicalSurface)& another,
78 const Handle(IGESSolid_ConicalSurface)& ent, Interface_CopyTool& TC) const
80 Standard_Real tempRadius, tempAngle;
81 //Standard_Boolean IsItParametrised = Standard_False; //szv#4:S4163:12Mar99 unused
83 DeclareAndCast(IGESGeom_Point, tempLocation,
84 TC.Transferred(another->LocationPoint()));
85 DeclareAndCast(IGESGeom_Direction, tempAxis,
86 TC.Transferred(another->Axis()));
87 tempRadius = another->Radius();
88 tempAngle = another->SemiAngle();
89 if (another->IsParametrised())
91 DeclareAndCast(IGESGeom_Direction, tempRefdir,
92 TC.Transferred(another->ReferenceDir()));
93 ent->Init (tempLocation, tempAxis, tempRadius, tempAngle, tempRefdir);
97 Handle(IGESGeom_Direction) tempRefdir;
98 ent->Init (tempLocation, tempAxis, tempRadius, tempAngle, tempRefdir);
102 IGESData_DirChecker IGESSolid_ToolConicalSurface::DirChecker
103 (const Handle(IGESSolid_ConicalSurface)& /*ent*/) const
105 IGESData_DirChecker DC(194, 0, 1);
107 DC.Structure (IGESData_DefVoid);
108 DC.LineFont (IGESData_DefAny);
109 DC.Color (IGESData_DefAny);
111 DC.BlankStatusIgnored ();
112 DC.SubordinateStatusRequired (1);
113 DC.HierarchyStatusIgnored ();
117 void IGESSolid_ToolConicalSurface::OwnCheck
118 (const Handle(IGESSolid_ConicalSurface)& ent,
119 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
121 if (ent->Radius() < 0.0)
122 ach->AddFail("Radius : Value Negative");
123 if (ent->SemiAngle() < 0.0 || ent->SemiAngle() > 90.0)
124 ach->AddFail("Semi-angle : Value not in the range [0 - 90]");
125 Standard_Integer fn = 0;
126 if (ent->IsParametrised()) fn = 1;
127 if (fn != ent->FormNumber()) ach->AddFail
128 ("Parametrised Status Mismatches with Form Number");
131 void IGESSolid_ToolConicalSurface::OwnDump
132 (const Handle(IGESSolid_ConicalSurface)& ent, const IGESData_IGESDumper& dumper,
133 const Handle(Message_Messenger)& S, const Standard_Integer level) const
135 S << "IGESSolid_ConicalSurface" << endl;
137 Standard_Integer sublevel = (level <= 4) ? 0 : 1;
138 S << "Point on axis : ";
139 dumper.Dump(ent->LocationPoint(),S, sublevel);
141 S << "Axis direction : ";
142 dumper.Dump(ent->Axis(),S, sublevel);
144 S << "Radius : " << ent->Radius() << " ";
145 S << "Semi-angle : " << ent->SemiAngle() << endl;
146 if (ent->IsParametrised())
148 S << "Surface is Parametrised - Reference direction : " << endl;
149 dumper.Dump(ent->ReferenceDir(),S, sublevel);
152 else S << "Surface is UnParametrised" << endl;