0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / RWStepRepr / RWStepRepr_RWQuantifiedAssemblyComponentUsage.cxx
CommitLineData
b311480e 1// Created on: 2000-07-03
2// Created by: Andrey BETENEV
973c2be1 3// Copyright (c) 2000-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
7fd59977 16// Generator: ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.1
7fd59977 17
42cf5bc1 18#include <Interface_Check.hxx>
19#include <Interface_EntityIterator.hxx>
20#include <RWStepRepr_RWQuantifiedAssemblyComponentUsage.hxx>
ec357c5c 21#include <StepBasic_MeasureWithUnit.hxx>
42cf5bc1 22#include <StepBasic_ProductDefinition.hxx>
23#include <StepData_StepReaderData.hxx>
24#include <StepData_StepWriter.hxx>
25#include <StepRepr_QuantifiedAssemblyComponentUsage.hxx>
7fd59977 26
27//=======================================================================
28//function : RWStepRepr_RWQuantifiedAssemblyComponentUsage
29//purpose :
30//=======================================================================
7fd59977 31RWStepRepr_RWQuantifiedAssemblyComponentUsage::RWStepRepr_RWQuantifiedAssemblyComponentUsage ()
32{
33}
34
35//=======================================================================
36//function : ReadStep
37//purpose :
38//=======================================================================
39
40void RWStepRepr_RWQuantifiedAssemblyComponentUsage::ReadStep (const Handle(StepData_StepReaderData)& data,
41 const Standard_Integer num,
42 Handle(Interface_Check)& ach,
43 const Handle(StepRepr_QuantifiedAssemblyComponentUsage) &ent) const
44{
45 // Check number of parameters
46 if ( ! data->CheckNbParams(num,7,ach,"quantified_assembly_component_usage") ) return;
47
48 // Inherited fields of ProductDefinitionRelationship
49
50 Handle(TCollection_HAsciiString) aProductDefinitionRelationship_Id;
51 data->ReadString (num, 1, "product_definition_relationship.id", ach, aProductDefinitionRelationship_Id);
52
53 Handle(TCollection_HAsciiString) aProductDefinitionRelationship_Name;
54 data->ReadString (num, 2, "product_definition_relationship.name", ach, aProductDefinitionRelationship_Name);
55
56 Handle(TCollection_HAsciiString) aProductDefinitionRelationship_Description;
57 Standard_Boolean hasProductDefinitionRelationship_Description = Standard_True;
58 if ( data->IsParamDefined (num,3) ) {
59 data->ReadString (num, 3, "product_definition_relationship.description", ach, aProductDefinitionRelationship_Description);
60 }
61 else {
62 hasProductDefinitionRelationship_Description = Standard_False;
63 }
64
d658f275 65 StepBasic_ProductDefinitionOrReference aProductDefinitionRelationship_RelatingProductDefinition;
66 data->ReadEntity (num, 4, "product_definition_relationship.relating_product_definition", ach, aProductDefinitionRelationship_RelatingProductDefinition);
7fd59977 67
d658f275 68 StepBasic_ProductDefinitionOrReference aProductDefinitionRelationship_RelatedProductDefinition;
69 data->ReadEntity (num, 5, "product_definition_relationship.related_product_definition", ach, aProductDefinitionRelationship_RelatedProductDefinition);
7fd59977 70
71 // Inherited fields of AssemblyComponentUsage
72
73 Handle(TCollection_HAsciiString) aAssemblyComponentUsage_ReferenceDesignator;
74 Standard_Boolean hasAssemblyComponentUsage_ReferenceDesignator = Standard_True;
75 if ( data->IsParamDefined (num,6) ) {
76 data->ReadString (num, 6, "assembly_component_usage.reference_designator", ach, aAssemblyComponentUsage_ReferenceDesignator);
77 }
78 else {
79 hasAssemblyComponentUsage_ReferenceDesignator = Standard_False;
80 }
81
82 // Own fields of QuantifiedAssemblyComponentUsage
83
84 Handle(StepBasic_MeasureWithUnit) aQuantity;
85 data->ReadEntity (num, 7, "quantity", ach, STANDARD_TYPE(StepBasic_MeasureWithUnit), aQuantity);
86
87 // Initialize entity
88 ent->Init(aProductDefinitionRelationship_Id,
89 aProductDefinitionRelationship_Name,
90 hasProductDefinitionRelationship_Description,
91 aProductDefinitionRelationship_Description,
92 aProductDefinitionRelationship_RelatingProductDefinition,
93 aProductDefinitionRelationship_RelatedProductDefinition,
94 hasAssemblyComponentUsage_ReferenceDesignator,
95 aAssemblyComponentUsage_ReferenceDesignator,
96 aQuantity);
97}
98
99//=======================================================================
100//function : WriteStep
101//purpose :
102//=======================================================================
103
104void RWStepRepr_RWQuantifiedAssemblyComponentUsage::WriteStep (StepData_StepWriter& SW,
105 const Handle(StepRepr_QuantifiedAssemblyComponentUsage) &ent) const
106{
107
108 // Inherited fields of ProductDefinitionRelationship
109
110 SW.Send (ent->StepBasic_ProductDefinitionRelationship::Id());
111
112 SW.Send (ent->StepBasic_ProductDefinitionRelationship::Name());
113
114 if ( ent->StepBasic_ProductDefinitionRelationship::HasDescription() ) {
115 SW.Send (ent->StepBasic_ProductDefinitionRelationship::Description());
116 }
117 else SW.SendUndef();
118
d658f275 119 SW.Send (ent->StepBasic_ProductDefinitionRelationship::RelatingProductDefinitionAP242().Value());
7fd59977 120
d658f275 121 SW.Send (ent->StepBasic_ProductDefinitionRelationship::RelatedProductDefinitionAP242().Value());
7fd59977 122
123 // Inherited fields of AssemblyComponentUsage
124
125 if ( ent->StepRepr_AssemblyComponentUsage::HasReferenceDesignator() ) {
126 SW.Send (ent->StepRepr_AssemblyComponentUsage::ReferenceDesignator());
127 }
128 else SW.SendUndef();
129
130 // Own fields of QuantifiedAssemblyComponentUsage
131
132 SW.Send (ent->Quantity());
133}
134
135//=======================================================================
136//function : Share
137//purpose :
138//=======================================================================
139
140void RWStepRepr_RWQuantifiedAssemblyComponentUsage::Share (const Handle(StepRepr_QuantifiedAssemblyComponentUsage) &ent,
141 Interface_EntityIterator& iter) const
142{
143
144 // Inherited fields of ProductDefinitionRelationship
145
d658f275 146 iter.AddItem (ent->StepBasic_ProductDefinitionRelationship::RelatingProductDefinitionAP242().Value());
7fd59977 147
d658f275 148 iter.AddItem (ent->StepBasic_ProductDefinitionRelationship::RelatedProductDefinitionAP242().Value());
7fd59977 149
150 // Inherited fields of AssemblyComponentUsage
151
152 // Own fields of QuantifiedAssemblyComponentUsage
153
154 iter.AddItem (ent->Quantity());
155}