973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
7fd59977 |
13 | |
7fd59977 |
14 | |
42cf5bc1 |
15 | #include <Interface_Check.hxx> |
7fd59977 |
16 | #include <Interface_EntityIterator.hxx> |
42cf5bc1 |
17 | #include <RWStepGeom_RWCartesianTransformationOperator.hxx> |
18 | #include <StepData_StepReaderData.hxx> |
19 | #include <StepData_StepWriter.hxx> |
20 | #include <StepGeom_CartesianPoint.hxx> |
7fd59977 |
21 | #include <StepGeom_CartesianTransformationOperator.hxx> |
42cf5bc1 |
22 | #include <StepGeom_Direction.hxx> |
7fd59977 |
23 | |
24 | RWStepGeom_RWCartesianTransformationOperator::RWStepGeom_RWCartesianTransformationOperator () {} |
25 | |
26 | void RWStepGeom_RWCartesianTransformationOperator::ReadStep |
27 | (const Handle(StepData_StepReaderData)& data, |
28 | const Standard_Integer num, |
29 | Handle(Interface_Check)& ach, |
30 | const Handle(StepGeom_CartesianTransformationOperator)& 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 7 champs au lieu de 5 et on commence au champ 3 |
37 | |
38 | // --- Number of Parameter Control --- |
39 | |
40 | if (!data->CheckNbParams(num,7,ach,"cartesian_transformation_operator")) 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 | // --- own 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 | // --- own 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 | // --- own 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 | // --- own 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 | //--- Initialisation of the read entity --- |
94 | |
95 | |
96 | ent->Init(aName, hasAaxis1, aAxis1, hasAaxis2, aAxis2, aLocalOrigin, hasAscale, aScale); |
97 | } |
98 | |
99 | |
100 | void RWStepGeom_RWCartesianTransformationOperator::WriteStep |
101 | (StepData_StepWriter& SW, |
102 | const Handle(StepGeom_CartesianTransformationOperator)& ent) const |
103 | { |
104 | |
105 | // --- inherited field name --- |
106 | // PATCH CKY : name depuis geometric_representation_item |
107 | // et name + descr depuis functionally_defined_transformation |
108 | |
109 | SW.Send(ent->Name()); |
110 | SW.Send(ent->Name()); |
111 | SW.Send(ent->Name()); |
112 | |
113 | // --- own field : axis1 --- |
114 | |
115 | Standard_Boolean hasAaxis1 = ent->HasAxis1(); |
116 | if (hasAaxis1) { |
117 | SW.Send(ent->Axis1()); |
118 | } |
119 | else { |
120 | SW.SendUndef(); |
121 | } |
122 | |
123 | // --- own field : axis2 --- |
124 | |
125 | Standard_Boolean hasAaxis2 = ent->HasAxis2(); |
126 | if (hasAaxis2) { |
127 | SW.Send(ent->Axis2()); |
128 | } |
129 | else { |
130 | SW.SendUndef(); |
131 | } |
132 | |
133 | // --- own field : localOrigin --- |
134 | |
135 | SW.Send(ent->LocalOrigin()); |
136 | |
137 | // --- own field : scale --- |
138 | |
139 | Standard_Boolean hasAscale = ent->HasScale(); |
140 | if (hasAscale) { |
141 | SW.Send(ent->Scale()); |
142 | } |
143 | else { |
144 | SW.SendUndef(); |
145 | } |
146 | } |
147 | |
148 | |
149 | void RWStepGeom_RWCartesianTransformationOperator::Share(const Handle(StepGeom_CartesianTransformationOperator)& ent, Interface_EntityIterator& iter) const |
150 | { |
151 | if (ent->HasAxis1()) { |
152 | iter.GetOneItem(ent->Axis1()); |
153 | } |
154 | |
155 | |
156 | if (ent->HasAxis2()) { |
157 | iter.GetOneItem(ent->Axis2()); |
158 | } |
159 | |
160 | |
161 | |
162 | iter.GetOneItem(ent->LocalOrigin()); |
163 | } |
164 | |