0026371: Implementation of new entities for GD&T
[occt.git] / src / RWStepRepr / RWStepRepr_RWCentreOfSymmetry.cxx
CommitLineData
28a73c1f 1// Created on: 2015-06-22
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#include <RWStepRepr_RWCentreOfSymmetry.hxx>
17
18#include <Interface_EntityIterator.hxx>
19#include <StepData_StepReaderData.hxx>
20#include <StepData_StepWriter.hxx>
21#include <StepRepr_CentreOfSymmetry.hxx>
22#include <StepRepr_ProductDefinitionShape.hxx>
23
24//=======================================================================
25//function : RWStepRepr_RWCentreOfSymmetry
26//purpose :
27//=======================================================================
28
29RWStepRepr_RWCentreOfSymmetry::RWStepRepr_RWCentreOfSymmetry ()
30{
31}
32
33//=======================================================================
34//function : ReadStep
35//purpose :
36//=======================================================================
37
38void RWStepRepr_RWCentreOfSymmetry::ReadStep (const Handle(StepData_StepReaderData)& data,
39 const Standard_Integer num,
40 Handle(Interface_Check)& ach,
41 const Handle(StepRepr_CentreOfSymmetry) &ent) const
42{
43 // Check number of parameters
44 if ( ! data->CheckNbParams(num,4,ach,"centre_of_symmetry") ) return;
45
46 // Inherited fields of ShapeAspect
47
48 Handle(TCollection_HAsciiString) aShapeAspect_Name;
49 data->ReadString (num, 1, "shape_aspect.name", ach, aShapeAspect_Name);
50
51 Handle(TCollection_HAsciiString) aShapeAspect_Description;
52 if ( data->IsParamDefined (num,2) ) {
53 data->ReadString (num, 2, "shape_aspect.description", ach, aShapeAspect_Description);
54 }
55
56 Handle(StepRepr_ProductDefinitionShape) aShapeAspect_OfShape;
57 data->ReadEntity (num, 3, "shape_aspect.of_shape", ach, STANDARD_TYPE(StepRepr_ProductDefinitionShape), aShapeAspect_OfShape);
58
59 StepData_Logical aShapeAspect_ProductDefinitional;
60 data->ReadLogical (num, 4, "shape_aspect.product_definitional", ach, aShapeAspect_ProductDefinitional);
61
62 // Initialize entity
63 ent->Init(aShapeAspect_Name,
64 aShapeAspect_Description,
65 aShapeAspect_OfShape,
66 aShapeAspect_ProductDefinitional);
67}
68
69//=======================================================================
70//function : WriteStep
71//purpose :
72//=======================================================================
73
74void RWStepRepr_RWCentreOfSymmetry::WriteStep (StepData_StepWriter& SW,
75 const Handle(StepRepr_CentreOfSymmetry) &ent) const
76{
77
78 // Inherited fields of ShapeAspect
79
80 SW.Send (ent->Name());
81
82 SW.Send (ent->Description());
83
84 SW.Send (ent->OfShape());
85
86 SW.SendLogical (ent->ProductDefinitional());
87}
88
89//=======================================================================
90//function : Share
91//purpose :
92//=======================================================================
93
94void RWStepRepr_RWCentreOfSymmetry::Share (const Handle(StepRepr_CentreOfSymmetry) &ent,
95 Interface_EntityIterator& iter) const
96{
97
98 // Inherited fields of ShapeAspect
99
100 iter.AddItem (ent->OfShape());
101}