0026371: Implementation of new entities for GD&T
[occt.git] / src / RWStepRepr / RWStepRepr_RWCompShAspAndDatumFeatAndShAsp.cxx
1 // Created on: 2015-08-11
2 // Created by: Irina KRYLOVA
3 // Copyright (c) 2015 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
17 #include <Interface_Check.hxx>
18 #include <Interface_EntityIterator.hxx>
19 #include <RWStepRepr_RWCompShAspAndDatumFeatAndShAsp.hxx>
20 #include <StepData_StepReaderData.hxx>
21 #include <StepData_StepWriter.hxx>
22 #include <StepRepr_CompShAspAndDatumFeatAndShAsp.hxx>
23 #include <StepRepr_ProductDefinitionShape.hxx>
24
25 //=======================================================================
26 //function : RWStepRepr_RWCompShAspAndDatumFeatAndShAsp
27 //purpose  : 
28 //=======================================================================
29 RWStepRepr_RWCompShAspAndDatumFeatAndShAsp::RWStepRepr_RWCompShAspAndDatumFeatAndShAsp()
30 {
31 }
32
33
34 //=======================================================================
35 //function : ReadStep
36 //purpose  : 
37 //=======================================================================
38
39 void RWStepRepr_RWCompShAspAndDatumFeatAndShAsp::ReadStep
40   (const Handle(StepData_StepReaderData)& data,
41    const Standard_Integer num0, Handle(Interface_Check)& ach,
42    const Handle(StepRepr_CompShAspAndDatumFeatAndShAsp)& ent) const
43 {
44   Standard_Integer num = 0;
45   data->NamedForComplex("SHAPE_ASPECT", num0, num, ach);
46   if (!data->CheckNbParams(num, 4, ach, "shape_aspect")) return;
47
48   Handle(TCollection_HAsciiString) aName;
49   data->ReadString (num, 1, "name", ach, aName);
50
51   Handle(TCollection_HAsciiString) aDescription;
52   if (data->IsParamDefined (num, 2)) {
53     data->ReadString (num, 2, "description", ach, aDescription);
54   }
55   Handle(StepRepr_ProductDefinitionShape) aOfShape;
56   data->ReadEntity(num, 3,"of_shape", ach, STANDARD_TYPE(StepRepr_ProductDefinitionShape), aOfShape);
57
58   StepData_Logical aProductDefinitional;
59   data->ReadLogical (num,4,"product_definitional",ach,aProductDefinitional);
60
61   // Initialize the entity
62   ent->Init(aName, aDescription, aOfShape, aProductDefinitional);
63 }
64
65
66 //=======================================================================
67 //function : WriteStep
68 //purpose  : 
69 //=======================================================================
70
71 void RWStepRepr_RWCompShAspAndDatumFeatAndShAsp::WriteStep
72   (StepData_StepWriter& SW,
73    const Handle(StepRepr_CompShAspAndDatumFeatAndShAsp)& ent) const
74 {
75   SW.StartEntity("COMPOSITE_SHAPE_ASPECT");
76   SW.StartEntity("DATUM_FEATURE");
77   SW.StartEntity("SHAPE_ASPECT");
78   SW.Send(ent->Name());
79   SW.Send(ent->Description());
80   SW.Send(ent->OfShape());
81   SW.SendLogical(ent->ProductDefinitional());
82 }
83
84
85 //=======================================================================
86 //function : Share
87 //purpose  : 
88 //=======================================================================
89
90 void RWStepRepr_RWCompShAspAndDatumFeatAndShAsp::Share
91   (const Handle(StepRepr_CompShAspAndDatumFeatAndShAsp)& ent,
92    Interface_EntityIterator& iter) const
93 {
94   iter.GetOneItem(ent->OfShape());
95 }