0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / RWStepShape / RWStepShape_RWDimensionalLocationWithPath.cxx
1 // Created on: 2000-04-18
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.0
17
18 #include <Interface_Check.hxx>
19 #include <Interface_EntityIterator.hxx>
20 #include <RWStepShape_RWDimensionalLocationWithPath.hxx>
21 #include <StepData_StepReaderData.hxx>
22 #include <StepData_StepWriter.hxx>
23 #include <StepRepr_ShapeAspect.hxx>
24 #include <StepShape_DimensionalLocationWithPath.hxx>
25
26 //=======================================================================
27 //function : RWStepShape_RWDimensionalLocationWithPath
28 //purpose  : 
29 //=======================================================================
30 RWStepShape_RWDimensionalLocationWithPath::RWStepShape_RWDimensionalLocationWithPath ()
31 {
32 }
33
34 //=======================================================================
35 //function : ReadStep
36 //purpose  : 
37 //=======================================================================
38
39 void RWStepShape_RWDimensionalLocationWithPath::ReadStep (const Handle(StepData_StepReaderData)& data,
40                                                           const Standard_Integer num,
41                                                           Handle(Interface_Check)& ach,
42                                                           const Handle(StepShape_DimensionalLocationWithPath) &ent) const
43 {
44   // Check number of parameters
45   if ( ! data->CheckNbParams(num,5,ach,"dimensional_location_with_path") ) return;
46
47   // Inherited fields of ShapeAspectRelationship
48
49   Handle(TCollection_HAsciiString) aShapeAspectRelationship_Name;
50   data->ReadString (num, 1, "shape_aspect_relationship.name", ach, aShapeAspectRelationship_Name);
51
52   Handle(TCollection_HAsciiString) aShapeAspectRelationship_Description;
53   Standard_Boolean hasShapeAspectRelationship_Description = Standard_True;
54   if ( data->IsParamDefined (num,2) ) {
55     data->ReadString (num, 2, "shape_aspect_relationship.description", ach, aShapeAspectRelationship_Description);
56   }
57   else {
58     hasShapeAspectRelationship_Description = Standard_False;
59   }
60
61   Handle(StepRepr_ShapeAspect) aShapeAspectRelationship_RelatingShapeAspect;
62   data->ReadEntity (num, 3, "shape_aspect_relationship.relating_shape_aspect", ach, STANDARD_TYPE(StepRepr_ShapeAspect), aShapeAspectRelationship_RelatingShapeAspect);
63
64   Handle(StepRepr_ShapeAspect) aShapeAspectRelationship_RelatedShapeAspect;
65   data->ReadEntity (num, 4, "shape_aspect_relationship.related_shape_aspect", ach, STANDARD_TYPE(StepRepr_ShapeAspect), aShapeAspectRelationship_RelatedShapeAspect);
66
67   // Own fields of DimensionalLocationWithPath
68
69   Handle(StepRepr_ShapeAspect) aPath;
70   data->ReadEntity (num, 5, "path", ach, STANDARD_TYPE(StepRepr_ShapeAspect), aPath);
71
72   // Initialize entity
73   ent->Init(aShapeAspectRelationship_Name,
74             hasShapeAspectRelationship_Description,
75             aShapeAspectRelationship_Description,
76             aShapeAspectRelationship_RelatingShapeAspect,
77             aShapeAspectRelationship_RelatedShapeAspect,
78             aPath);
79 }
80
81 //=======================================================================
82 //function : WriteStep
83 //purpose  : 
84 //=======================================================================
85
86 void RWStepShape_RWDimensionalLocationWithPath::WriteStep (StepData_StepWriter& SW,
87                                                            const Handle(StepShape_DimensionalLocationWithPath) &ent) const
88 {
89
90   // Inherited fields of ShapeAspectRelationship
91
92   SW.Send (ent->StepRepr_ShapeAspectRelationship::Name());
93
94   if ( ent->StepRepr_ShapeAspectRelationship::HasDescription() ) {
95     SW.Send (ent->StepRepr_ShapeAspectRelationship::Description());
96   }
97   else SW.SendUndef();
98
99   SW.Send (ent->StepRepr_ShapeAspectRelationship::RelatingShapeAspect());
100
101   SW.Send (ent->StepRepr_ShapeAspectRelationship::RelatedShapeAspect());
102
103   // Own fields of DimensionalLocationWithPath
104
105   SW.Send (ent->Path());
106 }
107
108 //=======================================================================
109 //function : Share
110 //purpose  : 
111 //=======================================================================
112
113 void RWStepShape_RWDimensionalLocationWithPath::Share (const Handle(StepShape_DimensionalLocationWithPath) &ent,
114                                                        Interface_EntityIterator& iter) const
115 {
116
117   // Inherited fields of ShapeAspectRelationship
118
119   iter.AddItem (ent->StepRepr_ShapeAspectRelationship::RelatingShapeAspect());
120
121   iter.AddItem (ent->StepRepr_ShapeAspectRelationship::RelatedShapeAspect());
122
123   // Own fields of DimensionalLocationWithPath
124
125   iter.AddItem (ent->Path());
126 }