0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / RWStepRepr / RWStepRepr_RWSpecifiedHigherUsageOccurrence.cxx
1 // Created on: 2000-07-03
2 // Created by: Andrey BETENEV
3 // Copyright (c) 2000-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 // Generator:   ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.1
17
18 #include <Interface_Check.hxx>
19 #include <Interface_EntityIterator.hxx>
20 #include <RWStepRepr_RWSpecifiedHigherUsageOccurrence.hxx>
21 #include <StepBasic_ProductDefinition.hxx>
22 #include <StepData_StepReaderData.hxx>
23 #include <StepData_StepWriter.hxx>
24 #include <StepRepr_AssemblyComponentUsage.hxx>
25 #include <StepRepr_NextAssemblyUsageOccurrence.hxx>
26 #include <StepRepr_SpecifiedHigherUsageOccurrence.hxx>
27
28 //=======================================================================
29 //function : RWStepRepr_RWSpecifiedHigherUsageOccurrence
30 //purpose  : 
31 //=======================================================================
32 RWStepRepr_RWSpecifiedHigherUsageOccurrence::RWStepRepr_RWSpecifiedHigherUsageOccurrence ()
33 {
34 }
35
36 //=======================================================================
37 //function : ReadStep
38 //purpose  : 
39 //=======================================================================
40
41 void RWStepRepr_RWSpecifiedHigherUsageOccurrence::ReadStep (const Handle(StepData_StepReaderData)& data,
42                                                             const Standard_Integer num,
43                                                             Handle(Interface_Check)& ach,
44                                                             const Handle(StepRepr_SpecifiedHigherUsageOccurrence) &ent) const
45 {
46   // Check number of parameters
47   if ( ! data->CheckNbParams(num,8,ach,"specified_higher_usage_occurrence") ) return;
48
49   // Inherited fields of ProductDefinitionRelationship
50
51   Handle(TCollection_HAsciiString) aProductDefinitionRelationship_Id;
52   data->ReadString (num, 1, "product_definition_relationship.id", ach, aProductDefinitionRelationship_Id);
53
54   Handle(TCollection_HAsciiString) aProductDefinitionRelationship_Name;
55   data->ReadString (num, 2, "product_definition_relationship.name", ach, aProductDefinitionRelationship_Name);
56
57   Handle(TCollection_HAsciiString) aProductDefinitionRelationship_Description;
58   Standard_Boolean hasProductDefinitionRelationship_Description = Standard_True;
59   if ( data->IsParamDefined (num,3) ) {
60     data->ReadString (num, 3, "product_definition_relationship.description", ach, aProductDefinitionRelationship_Description);
61   }
62   else {
63     hasProductDefinitionRelationship_Description = Standard_False;
64   }
65
66   StepBasic_ProductDefinitionOrReference aProductDefinitionRelationship_RelatingProductDefinition;
67   data->ReadEntity (num, 4, "product_definition_relationship.relating_product_definition", ach, aProductDefinitionRelationship_RelatingProductDefinition);
68
69   StepBasic_ProductDefinitionOrReference aProductDefinitionRelationship_RelatedProductDefinition;
70   data->ReadEntity (num, 5, "product_definition_relationship.related_product_definition", ach, aProductDefinitionRelationship_RelatedProductDefinition);
71
72   // Inherited fields of AssemblyComponentUsage
73
74   Handle(TCollection_HAsciiString) aAssemblyComponentUsage_ReferenceDesignator;
75   Standard_Boolean hasAssemblyComponentUsage_ReferenceDesignator = Standard_True;
76   if ( data->IsParamDefined (num,6) ) {
77     data->ReadString (num, 6, "assembly_component_usage.reference_designator", ach, aAssemblyComponentUsage_ReferenceDesignator);
78   }
79   else {
80     hasAssemblyComponentUsage_ReferenceDesignator = Standard_False;
81   }
82
83   // Own fields of SpecifiedHigherUsageOccurrence
84
85   Handle(StepRepr_AssemblyComponentUsage) aUpperUsage;
86   data->ReadEntity (num, 7, "upper_usage", ach, STANDARD_TYPE(StepRepr_AssemblyComponentUsage), aUpperUsage);
87
88   Handle(StepRepr_NextAssemblyUsageOccurrence) aNextUsage;
89   data->ReadEntity (num, 8, "next_usage", ach, STANDARD_TYPE(StepRepr_NextAssemblyUsageOccurrence), aNextUsage);
90
91   // Initialize entity
92   ent->Init(aProductDefinitionRelationship_Id,
93             aProductDefinitionRelationship_Name,
94             hasProductDefinitionRelationship_Description,
95             aProductDefinitionRelationship_Description,
96             aProductDefinitionRelationship_RelatingProductDefinition,
97             aProductDefinitionRelationship_RelatedProductDefinition,
98             hasAssemblyComponentUsage_ReferenceDesignator,
99             aAssemblyComponentUsage_ReferenceDesignator,
100             aUpperUsage,
101             aNextUsage);
102 }
103
104 //=======================================================================
105 //function : WriteStep
106 //purpose  : 
107 //=======================================================================
108
109 void RWStepRepr_RWSpecifiedHigherUsageOccurrence::WriteStep (StepData_StepWriter& SW,
110                                                              const Handle(StepRepr_SpecifiedHigherUsageOccurrence) &ent) const
111 {
112
113   // Inherited fields of ProductDefinitionRelationship
114
115   SW.Send (ent->StepBasic_ProductDefinitionRelationship::Id());
116
117   SW.Send (ent->StepBasic_ProductDefinitionRelationship::Name());
118
119   if ( ent->StepBasic_ProductDefinitionRelationship::HasDescription() ) {
120     SW.Send (ent->StepBasic_ProductDefinitionRelationship::Description());
121   }
122   else SW.SendUndef();
123
124   SW.Send (ent->StepBasic_ProductDefinitionRelationship::RelatingProductDefinitionAP242().Value());
125
126   SW.Send (ent->StepBasic_ProductDefinitionRelationship::RelatedProductDefinitionAP242().Value());
127
128   // Inherited fields of AssemblyComponentUsage
129
130   if ( ent->StepRepr_AssemblyComponentUsage::HasReferenceDesignator() ) {
131     SW.Send (ent->StepRepr_AssemblyComponentUsage::ReferenceDesignator());
132   }
133   else SW.SendUndef();
134
135   // Own fields of SpecifiedHigherUsageOccurrence
136
137   SW.Send (ent->UpperUsage());
138
139   SW.Send (ent->NextUsage());
140 }
141
142 //=======================================================================
143 //function : Share
144 //purpose  : 
145 //=======================================================================
146
147 void RWStepRepr_RWSpecifiedHigherUsageOccurrence::Share (const Handle(StepRepr_SpecifiedHigherUsageOccurrence) &ent,
148                                                          Interface_EntityIterator& iter) const
149 {
150
151   // Inherited fields of ProductDefinitionRelationship
152
153   iter.AddItem (ent->StepBasic_ProductDefinitionRelationship::RelatingProductDefinitionAP242().Value());
154
155   iter.AddItem (ent->StepBasic_ProductDefinitionRelationship::RelatedProductDefinitionAP242().Value());
156
157   // Inherited fields of AssemblyComponentUsage
158
159   // Own fields of SpecifiedHigherUsageOccurrence
160
161   iter.AddItem (ent->UpperUsage());
162
163   iter.AddItem (ent->NextUsage());
164 }