d00379d04ce6c003d771408b0add8df6b5e2ede5
[occt.git] / src / RWStepRepr / RWStepRepr_RWShapeRepresentationRelationshipWithTransformation.cxx
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 <RWStepRepr_RWShapeRepresentationRelationshipWithTransformation.hxx>
18 #include <StepData_StepReaderData.hxx>
19 #include <StepData_StepWriter.hxx>
20 #include <StepRepr_Representation.hxx>
21 #include <StepRepr_ShapeRepresentationRelationshipWithTransformation.hxx>
22 #include <StepRepr_Transformation.hxx>
23
24 RWStepRepr_RWShapeRepresentationRelationshipWithTransformation::RWStepRepr_RWShapeRepresentationRelationshipWithTransformation () {}
25
26 void RWStepRepr_RWShapeRepresentationRelationshipWithTransformation::ReadStep
27         (const Handle(StepData_StepReaderData)& data,
28          const Standard_Integer num0,
29          Handle(Interface_Check)& ach,
30          const Handle(StepRepr_ShapeRepresentationRelationshipWithTransformation)& ent) const
31 {
32
33 //  Complex entity
34 //  REPR_RLTS,REPR_RLTS_WITH_TR,SHAPE_REPR_RLTS
35 //  But same fields as RepresentationRelationshipWithTransformation
36
37         // --- Instance of plex componant RepresentationRelationship ---
38
39         Standard_Integer num = 0;  // num0;
40         data->NamedForComplex("REPRESENTATION_RELATIONSHIP RPRRLT",num0,num,ach);
41
42         // --- Number of Parameter Control ---
43
44         if (!data->CheckNbParams(num,4,ach,"representation_relationship")) return;
45
46         // --- inherited field : name ---
47
48         Handle(TCollection_HAsciiString) aName;
49         //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
50         data->ReadString (num,1,"name",ach,aName);
51
52         // --- inherited field : description ---
53
54         Handle(TCollection_HAsciiString) aDescription;
55         if (data->IsParamDefined (num,2)) { //abv 08.10.99 TRJ2
56           data->ReadString (num,2,"description",ach,aDescription);
57         }
58
59         // --- inherited field : rep1 ---
60
61         Handle(StepRepr_Representation) aRep1;
62         //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
63         data->ReadEntity(num, 3,"rep_1", ach, STANDARD_TYPE(StepRepr_Representation), aRep1);
64
65         // --- inherited field : rep2 ---
66
67         Handle(StepRepr_Representation) aRep2;
68         //szv#4:S4163:12Mar99 `Standard_Boolean stat4 =` not needed
69         data->ReadEntity(num, 4,"rep_2", ach, STANDARD_TYPE(StepRepr_Representation), aRep2);
70
71         // --- Instance of plex componant RepresentationRelationshipWithTransformation ---
72
73         data->NamedForComplex("REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION RRWT",num0,num,ach);
74         if (!data->CheckNbParams(num,1,ach,"representation_relationship_with_transformation")) return;
75
76         // --- own field : transformation_operator
77
78         StepRepr_Transformation aTrans;
79         //szv#4:S4163:12Mar99 `Standard_Boolean stat5 =` not needed
80         data->ReadEntity(num,1,"transformation_operator",ach,aTrans);
81
82         // --- Instance of plex componant ShapeRepresentationRelationship ---
83
84         data->NamedForComplex("SHAPE_REPRESENTATION_RELATIONSHIP SHRPRL",num0,num,ach);
85         if (!data->CheckNbParams(num,0,ach,"shape_representation_relationship")) return;
86
87         //--- Initialisation of the read entity ---
88
89
90         ent->Init(aName, aDescription, aRep1, aRep2, aTrans);
91 }
92
93
94 void RWStepRepr_RWShapeRepresentationRelationshipWithTransformation::WriteStep
95         (StepData_StepWriter& SW,
96          const Handle(StepRepr_ShapeRepresentationRelationshipWithTransformation)& ent) const
97 {
98         // --- Instance of plex componant RepresentationRelationship ---
99
100   SW.StartEntity ("REPRESENTATION_RELATIONSHIP");
101
102         // --- inherited field : name ---
103
104         SW.Send(ent->Name());
105
106         // --- inherited field : description ---
107
108         SW.Send(ent->Description());
109
110         // --- inherited field : rep1 ---
111
112         SW.Send(ent->Rep1());
113
114         // --- inherited field : rep2 ---
115
116         SW.Send(ent->Rep2());
117
118
119         // --- Instance of plex componant RepresentationRelationshipWithTransformation ---
120   SW.StartEntity ("REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION");
121
122         SW.Send(ent->TransformationOperator().Value());
123
124         // --- Instance of plex componant ShapeRepresentationRelationship ---
125
126   SW.StartEntity ("SHAPE_REPRESENTATION_RELATIONSHIP");
127 }
128
129
130 void RWStepRepr_RWShapeRepresentationRelationshipWithTransformation::Share(const Handle(StepRepr_ShapeRepresentationRelationshipWithTransformation)& ent, Interface_EntityIterator& iter) const
131 {
132
133         iter.GetOneItem(ent->Rep1());
134
135         iter.GetOneItem(ent->Rep2());
136
137         iter.GetOneItem(ent->TransformationOperator().Value());
138 }
139