1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13 
14 
15 #include <Interface_Check.hxx>
16 #include <Interface_EntityIterator.hxx>
17 #include <RWStepGeom_RWCartesianTransformationOperator3d.hxx>
18 #include <StepData_StepReaderData.hxx>
19 #include <StepData_StepWriter.hxx>
20 #include <StepGeom_CartesianPoint.hxx>
21 #include <StepGeom_CartesianTransformationOperator3d.hxx>
22 #include <StepGeom_Direction.hxx>
23 
RWStepGeom_RWCartesianTransformationOperator3d()24 RWStepGeom_RWCartesianTransformationOperator3d::RWStepGeom_RWCartesianTransformationOperator3d () {}
25 
ReadStep(const Handle (StepData_StepReaderData)& data,const Standard_Integer num,Handle (Interface_Check)& ach,const Handle (StepGeom_CartesianTransformationOperator3d)& ent) const26 void RWStepGeom_RWCartesianTransformationOperator3d::ReadStep
27 	(const Handle(StepData_StepReaderData)& data,
28 	 const Standard_Integer num,
29 	 Handle(Interface_Check)& ach,
30 	 const Handle(StepGeom_CartesianTransformationOperator3d)& ent) const
31 {
32 
33 // 29 MAI 1997
34 // PATCH CKY : functionally_defined_transformation est aussi supertype, avec
35 //  deux champs STRING. Pour bien faire, les ajouter. Au minimum, les faire
36 //  sauter. On attend 8 champs au lieu de 6 et on commence au champ 3
37 
38 	// --- Number of Parameter Control ---
39 
40 	if (!data->CheckNbParams(num,8,ach,"cartesian_transformation_operator_3d")) return;
41 
42 	// --- inherited field : name ---
43 
44 	Handle(TCollection_HAsciiString) aName;
45 	//szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
46 	data->ReadString (num,3,"name",ach,aName);
47 
48 	// --- inherited field : axis1 ---
49 
50 	Handle(StepGeom_Direction) aAxis1;
51 	Standard_Boolean hasAaxis1 = Standard_True;
52 	if (data->IsParamDefined(num,4)) {
53 	  //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
54 	  data->ReadEntity(num, 4,"axis1", ach, STANDARD_TYPE(StepGeom_Direction), aAxis1);
55 	}
56 	else {
57 	  hasAaxis1 = Standard_False;
58 	  aAxis1.Nullify();
59 	}
60 
61 	// --- inherited field : axis2 ---
62 
63 	Handle(StepGeom_Direction) aAxis2;
64 	Standard_Boolean hasAaxis2 = Standard_True;
65 	if (data->IsParamDefined(num,5)) {
66 	  //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
67 	  data->ReadEntity(num, 5,"axis2", ach, STANDARD_TYPE(StepGeom_Direction), aAxis2);
68 	}
69 	else {
70 	  hasAaxis2 = Standard_False;
71 	  aAxis2.Nullify();
72 	}
73 
74 	// --- inherited field : localOrigin ---
75 
76 	Handle(StepGeom_CartesianPoint) aLocalOrigin;
77 	//szv#4:S4163:12Mar99 `Standard_Boolean stat4 =` not needed
78 	data->ReadEntity(num, 6,"local_origin", ach, STANDARD_TYPE(StepGeom_CartesianPoint), aLocalOrigin);
79 
80 	// --- inherited field : scale ---
81 
82 	Standard_Real aScale;
83 	Standard_Boolean hasAscale = Standard_True;
84 	if (data->IsParamDefined(num,7)) {
85 	  //szv#4:S4163:12Mar99 `Standard_Boolean stat5 =` not needed
86 	  data->ReadReal (num,7,"scale",ach,aScale);
87 	}
88 	else {
89 	  hasAscale = Standard_False;
90 	  aScale = 0.;
91 	}
92 
93 	// --- own field : axis3 ---
94 
95 	Handle(StepGeom_Direction) aAxis3;
96 	Standard_Boolean hasAaxis3 = Standard_True;
97 	if (data->IsParamDefined(num,8)) {
98 	  //szv#4:S4163:12Mar99 `Standard_Boolean stat6 =` not needed
99 	  data->ReadEntity(num, 8,"axis3", ach, STANDARD_TYPE(StepGeom_Direction), aAxis3);
100 	}
101 	else {
102 	  hasAaxis3 = Standard_False;
103 	  aAxis3.Nullify();
104 	}
105 
106 	//--- Initialisation of the read entity ---
107 
108 
109 	ent->Init(aName, hasAaxis1, aAxis1, hasAaxis2, aAxis2, aLocalOrigin, hasAscale, aScale, hasAaxis3, aAxis3);
110 }
111 
112 
WriteStep(StepData_StepWriter & SW,const Handle (StepGeom_CartesianTransformationOperator3d)& ent) const113 void RWStepGeom_RWCartesianTransformationOperator3d::WriteStep
114 	(StepData_StepWriter& SW,
115 	 const Handle(StepGeom_CartesianTransformationOperator3d)& ent) const
116 {
117 
118 	// --- inherited field name ---
119 // PATCH CKY : name depuis geometric_representation_item
120 //    et name + descr depuis functionally_defined_transformation
121 
122 	SW.Send(ent->Name());
123 	SW.Send(ent->Name());
124 	SW.Send(ent->Name());
125 
126 	// --- inherited field axis1 ---
127 
128 	Standard_Boolean hasAaxis1 = ent->HasAxis1();
129 	if (hasAaxis1) {
130 	  SW.Send(ent->Axis1());
131 	}
132 	else {
133 	  SW.SendUndef();
134 	}
135 
136 	// --- inherited field axis2 ---
137 
138 	Standard_Boolean hasAaxis2 = ent->HasAxis2();
139 	if (hasAaxis2) {
140 	  SW.Send(ent->Axis2());
141 	}
142 	else {
143 	  SW.SendUndef();
144 	}
145 
146 	// --- inherited field localOrigin ---
147 
148 	SW.Send(ent->LocalOrigin());
149 
150 	// --- inherited field scale ---
151 
152 	Standard_Boolean hasAscale = ent->HasScale();
153 	if (hasAscale) {
154 	  SW.Send(ent->Scale());
155 	}
156 	else {
157 	  SW.SendUndef();
158 	}
159 
160 	// --- own field : axis3 ---
161 
162 	Standard_Boolean hasAaxis3 = ent->HasAxis3();
163 	if (hasAaxis3) {
164 	  SW.Send(ent->Axis3());
165 	}
166 	else {
167 	  SW.SendUndef();
168 	}
169 }
170 
171 
Share(const Handle (StepGeom_CartesianTransformationOperator3d)& ent,Interface_EntityIterator & iter) const172 void RWStepGeom_RWCartesianTransformationOperator3d::Share(const Handle(StepGeom_CartesianTransformationOperator3d)& ent, Interface_EntityIterator& iter) const
173 {
174 	if (ent->HasAxis1()) {
175 	  iter.GetOneItem(ent->Axis1());
176 	}
177 
178 
179 	if (ent->HasAxis2()) {
180 	  iter.GetOneItem(ent->Axis2());
181 	}
182 
183 
184 
185 	iter.GetOneItem(ent->LocalOrigin());
186 
187 	if (ent->HasAxis3()) {
188 	  iter.GetOneItem(ent->Axis3());
189 	}
190 
191 }
192 
193