0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / IGESGeom / IGESGeom_ToolSurfaceOfRevolution.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_IGESEntity.hxx>
22#include <IGESData_IGESReaderData.hxx>
23#include <IGESData_IGESWriter.hxx>
7fd59977 24#include <IGESData_ParamCursor.hxx>
42cf5bc1 25#include <IGESData_ParamReader.hxx>
26#include <IGESData_Status.hxx>
7fd59977 27#include <IGESGeom_Line.hxx>
42cf5bc1 28#include <IGESGeom_SurfaceOfRevolution.hxx>
29#include <IGESGeom_ToolSurfaceOfRevolution.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 40IGESGeom_ToolSurfaceOfRevolution::IGESGeom_ToolSurfaceOfRevolution () { }
41
42
43void IGESGeom_ToolSurfaceOfRevolution::ReadOwnParams
44 (const Handle(IGESGeom_SurfaceOfRevolution)& ent,
45 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
46{
47 // MGE 31/07/98
48
49 Handle(IGESGeom_Line) anAxis;
50 Handle(IGESData_IGESEntity) aGeneratrix;
51 Standard_Real aStartAngle, anEndAngle;
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_Line), anAxis)){ //szv#4:S4163:12Mar99 `st=` not needed
56 Message_Msg Msg152("XSTEP_152");
57 switch(aStatus) {
58 case IGESData_ReferenceError: {
59 Message_Msg Msg216 ("IGES_216");
60 Msg152.Arg(Msg216.Value());
61 PR.SendFail(Msg152);
62 break; }
63 case IGESData_EntityError: {
64 Message_Msg Msg217 ("IGES_217");
65 Msg152.Arg(Msg217.Value());
66 PR.SendFail(Msg152);
67 break; }
68 case IGESData_TypeError: {
69 Message_Msg Msg218 ("IGES_218");
70 Msg152.Arg(Msg218.Value());
71 PR.SendFail(Msg152);
72 break; }
73 default:{
74 }
75 }
76 }
77 if (!PR.ReadEntity(IR, PR.Current(), aStatus, aGeneratrix)){ //szv#4:S4163:12Mar99 `st=` not needed
78 Message_Msg Msg153("XSTEP_153");
79 switch(aStatus) {
80 case IGESData_ReferenceError: {
81 Message_Msg Msg216 ("IGES_216");
82 Msg153.Arg(Msg216.Value());
83 PR.SendFail(Msg153);
84 break; }
85 case IGESData_EntityError: {
86 Message_Msg Msg217 ("IGES_217");
87 Msg153.Arg(Msg217.Value());
88 PR.SendFail(Msg153);
89 break; }
90 default:{
91 }
92 }
93 }
94 if (!PR.ReadReal(PR.Current(), aStartAngle)){ //szv#4:S4163:12Mar99 `st=` not needed
95 Message_Msg Msg154("XSTEP_154");
96 PR.SendFail(Msg154);
97 }
98 if (!PR.ReadReal(PR.Current(), anEndAngle)){ //szv#4:S4163:12Mar99 `st=` not needed
99 Message_Msg Msg155("XSTEP_155");
100 PR.SendFail(Msg155);
101 }
102/*
103 st = PR.ReadEntity(IR, PR.Current(), "Axis", STANDARD_TYPE(IGESGeom_Line), anAxis);
104 st = PR.ReadEntity(IR, PR.Current(), "Generatrix", aGeneratrix);
105 st = PR.ReadReal(PR.Current(), "StartAngle", aStartAngle);
106 st = PR.ReadReal(PR.Current(), "EndAngle", anEndAngle);
107*/
108 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
109 ent->Init(anAxis, aGeneratrix, aStartAngle, anEndAngle);
110}
111
112void IGESGeom_ToolSurfaceOfRevolution::WriteOwnParams
113 (const Handle(IGESGeom_SurfaceOfRevolution)& ent, IGESData_IGESWriter& IW) const
114{
115 IW.Send(ent->AxisOfRevolution());
116 IW.Send(ent->Generatrix());
117 IW.Send(ent->StartAngle());
118 IW.Send(ent->EndAngle());
119}
120
121void IGESGeom_ToolSurfaceOfRevolution::OwnShared
122 (const Handle(IGESGeom_SurfaceOfRevolution)& ent, Interface_EntityIterator& iter) const
123{
124 iter.GetOneItem(ent->AxisOfRevolution());
125 iter.GetOneItem(ent->Generatrix());
126}
127
128void IGESGeom_ToolSurfaceOfRevolution::OwnCopy
129 (const Handle(IGESGeom_SurfaceOfRevolution)& another,
130 const Handle(IGESGeom_SurfaceOfRevolution)& ent, Interface_CopyTool& TC) const
131{
132 DeclareAndCast(IGESGeom_Line, anAxis,
133 TC.Transferred(another->AxisOfRevolution()));
134 DeclareAndCast(IGESData_IGESEntity, aGeneratrix,
135 TC.Transferred(another->Generatrix()));
136 Standard_Real aStartAngle = another->StartAngle();
137 Standard_Real anEndAngle = another->EndAngle();
138
139 ent->Init(anAxis, aGeneratrix, aStartAngle, anEndAngle);
140}
141
142
143IGESData_DirChecker IGESGeom_ToolSurfaceOfRevolution::DirChecker
144 (const Handle(IGESGeom_SurfaceOfRevolution)& /*ent*/ ) const
145{
146 IGESData_DirChecker DC(120, 0);
147 DC.Structure(IGESData_DefVoid);
148 DC.LineFont(IGESData_DefAny);
149// DC.LineWeight(IGESData_DefValue);
150 DC.Color(IGESData_DefAny);
151
152 DC.HierarchyStatusIgnored ();
153 return DC;
154}
155
156void IGESGeom_ToolSurfaceOfRevolution::OwnCheck
157 (const Handle(IGESGeom_SurfaceOfRevolution)& /*ent*/,
158 const Interface_ShareTool& , Handle(Interface_Check)& /*ach*/) const
159{
160// Standard_Real diffang = ent->EndAngle() - ent->StartAngle();
c6541a0c 161// if (diffang <= 0.0 || diffang > 2.0 * M_PI)
7fd59977 162// ach.AddFail("0 < TA - SA <= 2Pi is not satisfied");
163}
164
165void IGESGeom_ToolSurfaceOfRevolution::OwnDump
166 (const Handle(IGESGeom_SurfaceOfRevolution)& ent, const IGESData_IGESDumper& dumper,
167 const Handle(Message_Messenger)& S, const Standard_Integer level) const
168{
169
170 S << "IGESGeom_SurfaceOfRevolution" << endl << endl;
171 Standard_Integer sublevel = (level <= 4) ? 0 : 1;
172
173 S << "Axis Of Revolution : ";
174 dumper.Dump(ent->AxisOfRevolution(),S, sublevel);
175 S << endl;
176 S << "Generatrix : ";
177 dumper.Dump(ent->Generatrix(),S, sublevel);
178 S << endl;
179 S << "Start Angle : " << ent->StartAngle() << " ";
180 S << "End Angle : " << ent->EndAngle() << endl;
181}