0033018: Coding - get rid of unused headers [Plugin to ShapeAnalysis]
[occt.git] / src / RWStepKinematics / RWStepKinematics_RWSphericalPair.cxx
1 // Created on : Sat May 02 12:41:16 2020 
2 // Created by: Irina KRYLOVA
3 // Generator:   Express (EXPRESS -> CASCADE/XSTEP Translator) V3.0
4 // Copyright (c) Open CASCADE 2020
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <RWStepKinematics_RWSphericalPair.hxx>
18
19 #include <Interface_EntityIterator.hxx>
20 #include <StepData_StepReaderData.hxx>
21 #include <StepData_StepWriter.hxx>
22 #include <StepKinematics_SphericalPair.hxx>
23 #include <TCollection_HAsciiString.hxx>
24 #include <StepRepr_ItemDefinedTransformation.hxx>
25 #include <StepRepr_RepresentationItem.hxx>
26 #include <StepKinematics_KinematicJoint.hxx>
27
28 //=======================================================================
29 //function : RWStepKinematics_RWSphericalPair
30 //purpose  :
31 //=======================================================================
32 RWStepKinematics_RWSphericalPair::RWStepKinematics_RWSphericalPair() {}
33
34
35 //=======================================================================
36 //function : ReadStep
37 //purpose  :
38 //=======================================================================
39 void RWStepKinematics_RWSphericalPair::ReadStep (const Handle(StepData_StepReaderData)& theData,
40                                                  const Standard_Integer theNum,
41                                                  Handle(Interface_Check)& theArch,
42                                                  const Handle(StepKinematics_SphericalPair)& theEnt) const
43 {
44   // Check number of parameters
45   if ( ! theData->CheckNbParams(theNum,12,theArch,"spherical_pair") ) return;
46
47   // Inherited fields of RepresentationItem
48
49   Handle(TCollection_HAsciiString) aRepresentationItem_Name;
50   theData->ReadString (theNum, 1, "representation_item.name", theArch, aRepresentationItem_Name);
51
52   // Inherited fields of ItemDefinedTransformation
53
54   Handle(TCollection_HAsciiString) aItemDefinedTransformation_Name;
55   theData->ReadString (theNum, 2, "item_defined_transformation.name", theArch, aItemDefinedTransformation_Name);
56
57   Handle(TCollection_HAsciiString) aItemDefinedTransformation_Description;
58   Standard_Boolean hasItemDefinedTransformation_Description = Standard_True;
59   if ( theData->IsParamDefined (theNum,3) ) {
60     theData->ReadString (theNum, 3, "item_defined_transformation.description", theArch, aItemDefinedTransformation_Description);
61   }
62   else {
63     hasItemDefinedTransformation_Description = Standard_False;
64     aItemDefinedTransformation_Description.Nullify();
65   }
66
67   Handle(StepRepr_RepresentationItem) aItemDefinedTransformation_TransformItem1;
68   theData->ReadEntity (theNum, 4, "item_defined_transformation.transform_item1", theArch, STANDARD_TYPE(StepRepr_RepresentationItem), aItemDefinedTransformation_TransformItem1);
69
70   Handle(StepRepr_RepresentationItem) aItemDefinedTransformation_TransformItem2;
71   theData->ReadEntity (theNum, 5, "item_defined_transformation.transform_item2", theArch, STANDARD_TYPE(StepRepr_RepresentationItem), aItemDefinedTransformation_TransformItem2);
72
73   // Inherited fields of KinematicPair
74
75   Handle(StepKinematics_KinematicJoint) aKinematicPair_Joint;
76   theData->ReadEntity (theNum, 6, "kinematic_pair.joint", theArch, STANDARD_TYPE(StepKinematics_KinematicJoint), aKinematicPair_Joint);
77
78   // Inherited fields of LowOrderKinematicPair
79
80   Standard_Boolean aLowOrderKinematicPair_TX;
81   theData->ReadBoolean (theNum, 7, "low_order_kinematic_pair.t_x", theArch, aLowOrderKinematicPair_TX);
82
83   Standard_Boolean aLowOrderKinematicPair_TY;
84   theData->ReadBoolean (theNum, 8, "low_order_kinematic_pair.t_y", theArch, aLowOrderKinematicPair_TY);
85
86   Standard_Boolean aLowOrderKinematicPair_TZ;
87   theData->ReadBoolean (theNum, 9, "low_order_kinematic_pair.t_z", theArch, aLowOrderKinematicPair_TZ);
88
89   Standard_Boolean aLowOrderKinematicPair_RX;
90   theData->ReadBoolean (theNum, 10, "low_order_kinematic_pair.r_x", theArch, aLowOrderKinematicPair_RX);
91
92   Standard_Boolean aLowOrderKinematicPair_RY;
93   theData->ReadBoolean (theNum, 11, "low_order_kinematic_pair.r_y", theArch, aLowOrderKinematicPair_RY);
94
95   Standard_Boolean aLowOrderKinematicPair_RZ;
96   theData->ReadBoolean (theNum, 12, "low_order_kinematic_pair.r_z", theArch, aLowOrderKinematicPair_RZ);
97
98   // Initialize entity
99   theEnt->Init(aRepresentationItem_Name,
100             aItemDefinedTransformation_Name,
101             hasItemDefinedTransformation_Description,
102             aItemDefinedTransformation_Description,
103             aItemDefinedTransformation_TransformItem1,
104             aItemDefinedTransformation_TransformItem2,
105             aKinematicPair_Joint,
106             aLowOrderKinematicPair_TX,
107             aLowOrderKinematicPair_TY,
108             aLowOrderKinematicPair_TZ,
109             aLowOrderKinematicPair_RX,
110             aLowOrderKinematicPair_RY,
111             aLowOrderKinematicPair_RZ);
112 }
113
114 //=======================================================================
115 //function : WriteStep
116 //purpose  :
117 //=======================================================================
118 void RWStepKinematics_RWSphericalPair::WriteStep (StepData_StepWriter& theSW,
119                                                   const Handle(StepKinematics_SphericalPair)& theEnt) const
120 {
121
122   // Own fields of RepresentationItem
123
124   theSW.Send (theEnt->Name());
125
126   // Inherited fields of ItemDefinedTransformation
127
128   theSW.Send (theEnt->ItemDefinedTransformation()->Name());
129
130   if ( theEnt->ItemDefinedTransformation()->HasDescription() ) {
131     theSW.Send (theEnt->ItemDefinedTransformation()->Description());
132   }
133   else theSW.SendUndef();
134
135   theSW.Send (theEnt->ItemDefinedTransformation()->TransformItem1());
136
137   theSW.Send (theEnt->ItemDefinedTransformation()->TransformItem2());
138
139   // Own fields of KinematicPair
140
141   theSW.Send (theEnt->Joint());
142
143   // Own fields of LowOrderKinematicPair
144
145   theSW.SendBoolean (theEnt->TX());
146
147   theSW.SendBoolean (theEnt->TY());
148
149   theSW.SendBoolean (theEnt->TZ());
150
151   theSW.SendBoolean (theEnt->RX());
152
153   theSW.SendBoolean (theEnt->RY());
154
155   theSW.SendBoolean (theEnt->RZ());
156 }
157
158 //=======================================================================
159 //function : Share
160 //purpose  :
161 //=======================================================================
162 void RWStepKinematics_RWSphericalPair::Share (const Handle(StepKinematics_SphericalPair)& theEnt,
163                                               Interface_EntityIterator& iter) const
164 {
165
166   // Inherited fields of RepresentationItem
167
168   // Inherited fields of ItemDefinedTransformation
169
170   iter.AddItem (theEnt->ItemDefinedTransformation()->TransformItem1());
171
172   iter.AddItem (theEnt->ItemDefinedTransformation()->TransformItem2());
173
174   // Inherited fields of KinematicPair
175
176   iter.AddItem (theEnt->StepKinematics_KinematicPair::Joint());
177
178   // Inherited fields of LowOrderKinematicPair
179 }