1 //--------------------------------------------------------------------
3 // File Name : IGESGeom_SurfaceOfRevolution.cxx
5 // Author : CKY / Contract Toubro-Larsen
6 // Copyright : MATRA-DATAVISION 1993
8 //--------------------------------------------------------------------
10 #include <IGESGeom_ToolSurfaceOfRevolution.ixx>
11 #include <IGESData_ParamCursor.hxx>
12 #include <IGESGeom_Line.hxx>
13 #include <IGESData_IGESEntity.hxx>
14 #include <Interface_Macros.hxx>
18 #include <Message_Msg.hxx>
19 #include <IGESData_Status.hxx>
21 IGESGeom_ToolSurfaceOfRevolution::IGESGeom_ToolSurfaceOfRevolution () { }
24 void IGESGeom_ToolSurfaceOfRevolution::ReadOwnParams
25 (const Handle(IGESGeom_SurfaceOfRevolution)& ent,
26 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
30 Handle(IGESGeom_Line) anAxis;
31 Handle(IGESData_IGESEntity) aGeneratrix;
32 Standard_Real aStartAngle, anEndAngle;
33 IGESData_Status aStatus;
34 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
36 if (!PR.ReadEntity(IR, PR.Current(), aStatus, STANDARD_TYPE(IGESGeom_Line), anAxis)){ //szv#4:S4163:12Mar99 `st=` not needed
37 Message_Msg Msg152("XSTEP_152");
39 case IGESData_ReferenceError: {
40 Message_Msg Msg216 ("IGES_216");
41 Msg152.Arg(Msg216.Value());
44 case IGESData_EntityError: {
45 Message_Msg Msg217 ("IGES_217");
46 Msg152.Arg(Msg217.Value());
49 case IGESData_TypeError: {
50 Message_Msg Msg218 ("IGES_218");
51 Msg152.Arg(Msg218.Value());
58 if (!PR.ReadEntity(IR, PR.Current(), aStatus, aGeneratrix)){ //szv#4:S4163:12Mar99 `st=` not needed
59 Message_Msg Msg153("XSTEP_153");
61 case IGESData_ReferenceError: {
62 Message_Msg Msg216 ("IGES_216");
63 Msg153.Arg(Msg216.Value());
66 case IGESData_EntityError: {
67 Message_Msg Msg217 ("IGES_217");
68 Msg153.Arg(Msg217.Value());
75 if (!PR.ReadReal(PR.Current(), aStartAngle)){ //szv#4:S4163:12Mar99 `st=` not needed
76 Message_Msg Msg154("XSTEP_154");
79 if (!PR.ReadReal(PR.Current(), anEndAngle)){ //szv#4:S4163:12Mar99 `st=` not needed
80 Message_Msg Msg155("XSTEP_155");
84 st = PR.ReadEntity(IR, PR.Current(), "Axis", STANDARD_TYPE(IGESGeom_Line), anAxis);
85 st = PR.ReadEntity(IR, PR.Current(), "Generatrix", aGeneratrix);
86 st = PR.ReadReal(PR.Current(), "StartAngle", aStartAngle);
87 st = PR.ReadReal(PR.Current(), "EndAngle", anEndAngle);
89 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
90 ent->Init(anAxis, aGeneratrix, aStartAngle, anEndAngle);
93 void IGESGeom_ToolSurfaceOfRevolution::WriteOwnParams
94 (const Handle(IGESGeom_SurfaceOfRevolution)& ent, IGESData_IGESWriter& IW) const
96 IW.Send(ent->AxisOfRevolution());
97 IW.Send(ent->Generatrix());
98 IW.Send(ent->StartAngle());
99 IW.Send(ent->EndAngle());
102 void IGESGeom_ToolSurfaceOfRevolution::OwnShared
103 (const Handle(IGESGeom_SurfaceOfRevolution)& ent, Interface_EntityIterator& iter) const
105 iter.GetOneItem(ent->AxisOfRevolution());
106 iter.GetOneItem(ent->Generatrix());
109 void IGESGeom_ToolSurfaceOfRevolution::OwnCopy
110 (const Handle(IGESGeom_SurfaceOfRevolution)& another,
111 const Handle(IGESGeom_SurfaceOfRevolution)& ent, Interface_CopyTool& TC) const
113 DeclareAndCast(IGESGeom_Line, anAxis,
114 TC.Transferred(another->AxisOfRevolution()));
115 DeclareAndCast(IGESData_IGESEntity, aGeneratrix,
116 TC.Transferred(another->Generatrix()));
117 Standard_Real aStartAngle = another->StartAngle();
118 Standard_Real anEndAngle = another->EndAngle();
120 ent->Init(anAxis, aGeneratrix, aStartAngle, anEndAngle);
124 IGESData_DirChecker IGESGeom_ToolSurfaceOfRevolution::DirChecker
125 (const Handle(IGESGeom_SurfaceOfRevolution)& /*ent*/ ) const
127 IGESData_DirChecker DC(120, 0);
128 DC.Structure(IGESData_DefVoid);
129 DC.LineFont(IGESData_DefAny);
130 // DC.LineWeight(IGESData_DefValue);
131 DC.Color(IGESData_DefAny);
133 DC.HierarchyStatusIgnored ();
137 void IGESGeom_ToolSurfaceOfRevolution::OwnCheck
138 (const Handle(IGESGeom_SurfaceOfRevolution)& /*ent*/,
139 const Interface_ShareTool& , Handle(Interface_Check)& /*ach*/) const
141 // Standard_Real diffang = ent->EndAngle() - ent->StartAngle();
142 // if (diffang <= 0.0 || diffang > 2.0 * M_PI)
143 // ach.AddFail("0 < TA - SA <= 2Pi is not satisfied");
146 void IGESGeom_ToolSurfaceOfRevolution::OwnDump
147 (const Handle(IGESGeom_SurfaceOfRevolution)& ent, const IGESData_IGESDumper& dumper,
148 const Handle(Message_Messenger)& S, const Standard_Integer level) const
151 S << "IGESGeom_SurfaceOfRevolution" << endl << endl;
152 Standard_Integer sublevel = (level <= 4) ? 0 : 1;
154 S << "Axis Of Revolution : ";
155 dumper.Dump(ent->AxisOfRevolution(),S, sublevel);
157 S << "Generatrix : ";
158 dumper.Dump(ent->Generatrix(),S, sublevel);
160 S << "Start Angle : " << ent->StartAngle() << " ";
161 S << "End Angle : " << ent->EndAngle() << endl;