0030895: Coding Rules - specify std namespace explicitly for std::cout and streams
[occt.git] / src / IGESGeom / IGESGeom_ToolTabulatedCylinder.cxx
1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
18
19 #include <gp_Pnt.hxx>
20 #include <gp_XYZ.hxx>
21 #include <IGESData_DirChecker.hxx>
22 #include <IGESData_Dump.hxx>
23 #include <IGESData_IGESDumper.hxx>
24 #include <IGESData_IGESEntity.hxx>
25 #include <IGESData_IGESReaderData.hxx>
26 #include <IGESData_IGESWriter.hxx>
27 #include <IGESData_ParamCursor.hxx>
28 #include <IGESData_ParamReader.hxx>
29 #include <IGESData_Status.hxx>
30 #include <IGESGeom_TabulatedCylinder.hxx>
31 #include <IGESGeom_ToolTabulatedCylinder.hxx>
32 #include <Interface_Check.hxx>
33 #include <Interface_CopyTool.hxx>
34 #include <Interface_EntityIterator.hxx>
35 #include <Interface_Macros.hxx>
36 #include <Interface_ShareTool.hxx>
37 #include <Message_Messenger.hxx>
38 #include <Message_Msg.hxx>
39 #include <Standard_DomainError.hxx>
40
41 // MGE 31/07/98
42 IGESGeom_ToolTabulatedCylinder::IGESGeom_ToolTabulatedCylinder ()    {  }
43
44
45 void IGESGeom_ToolTabulatedCylinder::ReadOwnParams
46   (const Handle(IGESGeom_TabulatedCylinder)& ent,
47    const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
48 {
49   // MGE 31/07/98
50   // Building of messages
51   //========================================
52   Message_Msg Msg157("XSTEP_157");
53   //========================================
54
55   Handle(IGESData_IGESEntity) aDirectrix;
56   gp_XYZ anEnd;
57   IGESData_Status aStatus;
58
59   //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
60
61   // Reading the directrix curve entity
62   if (!PR.ReadEntity(IR, PR.Current(), aStatus, aDirectrix)){ //szv#4:S4163:12Mar99 `st=` not needed
63     Message_Msg Msg156("XSTEP_156");
64     switch(aStatus) {
65     case IGESData_ReferenceError: {  
66       Message_Msg Msg216 ("IGES_216");
67       Msg156.Arg(Msg216.Value());
68       PR.SendFail(Msg156);
69       break; }
70     case IGESData_EntityError: {
71       Message_Msg Msg217 ("IGES_217");
72       Msg156.Arg(Msg217.Value());
73       PR.SendFail(Msg156);
74       break; }
75     default:{
76     }
77     }
78   } 
79   //st = PR.ReadEntity(IR, PR.Current(), "Directrix", aDirectrix);
80
81   // Reading the terminate point of the generatrix
82   PR.ReadXYZ(PR.CurrentList(1, 3), Msg157, anEnd); //szv#4:S4163:12Mar99 `st=` not needed
83   //st = PR.ReadXYZ(PR.CurrentList(1, 3), "Terminate Point", anEnd);
84
85   DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
86   ent->Init(aDirectrix, anEnd);
87 }
88
89 void IGESGeom_ToolTabulatedCylinder::WriteOwnParams
90   (const Handle(IGESGeom_TabulatedCylinder)& ent, IGESData_IGESWriter& IW)  const
91 {
92   IW.Send( ent->Directrix() );
93   IW.Send( ent->EndPoint().X() );
94   IW.Send( ent->EndPoint().Y() );
95   IW.Send( ent->EndPoint().Z() );
96 }
97
98 void  IGESGeom_ToolTabulatedCylinder::OwnShared
99   (const Handle(IGESGeom_TabulatedCylinder)& ent, Interface_EntityIterator& iter) const
100 {
101   iter.GetOneItem( ent->Directrix() );
102 }
103
104 void IGESGeom_ToolTabulatedCylinder::OwnCopy
105   (const Handle(IGESGeom_TabulatedCylinder)& another,
106    const Handle(IGESGeom_TabulatedCylinder)& ent, Interface_CopyTool& TC) const
107 {
108   DeclareAndCast(IGESData_IGESEntity, aDirectrix,
109                  TC.Transferred(another->Directrix()));
110
111   gp_XYZ anEnd = another->EndPoint().XYZ();
112
113   ent->Init(aDirectrix, anEnd);
114 }
115
116
117 IGESData_DirChecker IGESGeom_ToolTabulatedCylinder::DirChecker
118   (const Handle(IGESGeom_TabulatedCylinder)& /* ent */ )  const
119 {
120   IGESData_DirChecker DC(122, 0);
121   DC.Structure(IGESData_DefVoid);
122   DC.LineFont(IGESData_DefAny);
123 //  DC.LineWeight(IGESData_DefValue);
124   DC.Color(IGESData_DefAny);
125   DC.HierarchyStatusIgnored();
126   return DC;
127 }
128
129 void IGESGeom_ToolTabulatedCylinder::OwnCheck
130   (const Handle(IGESGeom_TabulatedCylinder)& /* ent */,
131    const Interface_ShareTool& , Handle(Interface_Check)& /* ach */)  const
132 {  }
133
134 void IGESGeom_ToolTabulatedCylinder::OwnDump
135   (const Handle(IGESGeom_TabulatedCylinder)& ent, const IGESData_IGESDumper& dumper,
136    const Handle(Message_Messenger)& S, const Standard_Integer level)  const
137 {
138   Standard_Integer sublevel = (level <= 4) ? 0 : 1;
139
140   S << "IGESGeom_TabulatedCylinder" << Message_EndLine;
141
142   S << "Directrix       : ";
143   dumper.Dump(ent->Directrix(),S, sublevel);
144   S << Message_EndLine;
145   S << "Terminate Point : ";
146   IGESData_DumpXYZL(S,level, ent->EndPoint(), ent->Location());
147   S << Message_EndLine;
148 }