28a73c1f |
1 | // Created on: 2015-07-13 |
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 <RWStepDimTol_RWToleranceZoneDefinition.hxx> |
17 | |
18 | #include <Interface_EntityIterator.hxx> |
19 | #include <StepData_StepReaderData.hxx> |
20 | #include <StepData_StepWriter.hxx> |
21 | #include <StepRepr_HArray1OfShapeAspect.hxx> |
22 | #include <StepDimTol_ToleranceZone.hxx> |
23 | #include <StepDimTol_ToleranceZoneDefinition.hxx> |
92efcf78 |
24 | #include <StepRepr_ShapeAspect.hxx> |
28a73c1f |
25 | |
26 | //======================================================================= |
27 | //function : RWStepDimTol_RWToleranceZoneDefinition |
28 | //purpose : |
29 | //======================================================================= |
30 | |
31 | RWStepDimTol_RWToleranceZoneDefinition::RWStepDimTol_RWToleranceZoneDefinition () |
32 | { |
33 | } |
34 | |
35 | //======================================================================= |
36 | //function : ReadStep |
37 | //purpose : |
38 | //======================================================================= |
39 | |
40 | void RWStepDimTol_RWToleranceZoneDefinition::ReadStep (const Handle(StepData_StepReaderData)& data, |
41 | const Standard_Integer num, |
42 | Handle(Interface_Check)& ach, |
43 | const Handle(StepDimTol_ToleranceZoneDefinition) &ent) const |
44 | { |
45 | // Check number of parameters |
46 | if ( ! data->CheckNbParams(num,2,ach,"tolerance_zone_definition") ) return; |
47 | |
48 | // Own fields of ToleranceZoneDefinition |
49 | |
50 | Handle(StepDimTol_ToleranceZone) aToleranceZone; |
51 | data->ReadEntity (num, 1, "zone", ach, STANDARD_TYPE(StepDimTol_ToleranceZone), aToleranceZone); |
52 | |
53 | Handle(StepRepr_HArray1OfShapeAspect) anItems; |
54 | Handle(StepRepr_ShapeAspect) anEnt; |
55 | Standard_Integer nbSub; |
56 | if (data->ReadSubList (num,2,"boundaries",ach,nbSub)) { |
57 | Standard_Integer nbElements = data->NbParams(nbSub); |
58 | anItems = new StepRepr_HArray1OfShapeAspect (1, nbElements); |
59 | for (Standard_Integer i = 1; i <= nbElements; i++) { |
60 | if (data->ReadEntity(nbSub, i,"shape_aspect", ach, STANDARD_TYPE(StepRepr_ShapeAspect), anEnt)) |
61 | anItems->SetValue(i, anEnt); |
62 | } |
63 | } |
64 | |
65 | // Initialize entity |
66 | ent->Init(aToleranceZone, |
67 | anItems); |
68 | } |
69 | |
70 | //======================================================================= |
71 | //function : WriteStep |
72 | //purpose : |
73 | //======================================================================= |
74 | |
75 | void RWStepDimTol_RWToleranceZoneDefinition::WriteStep (StepData_StepWriter& SW, |
76 | const Handle(StepDimTol_ToleranceZoneDefinition) &ent) const |
77 | { |
78 | // Own fields of ToleranceZoneDefinition |
79 | |
80 | SW.Send (ent->Zone()); |
81 | |
82 | SW.OpenSub(); |
83 | for (Standard_Integer i = 1; i <= ent->NbBoundaries(); i++) { |
84 | SW.Send(ent->BoundariesValue(i)); |
85 | } |
86 | SW.CloseSub(); |
87 | } |
88 | |
89 | //======================================================================= |
90 | //function : Share |
91 | //purpose : |
92 | //======================================================================= |
93 | |
94 | void RWStepDimTol_RWToleranceZoneDefinition::Share (const Handle(StepDimTol_ToleranceZoneDefinition) &ent, |
95 | Interface_EntityIterator& iter) const |
96 | { |
97 | |
98 | // Own fields of ToleranceZoneDefinition |
99 | |
100 | iter.AddItem (ent->Zone()); |
101 | |
102 | Standard_Integer i, nb = ent->NbBoundaries(); |
103 | for (i = 1; i <= nb; i++) |
104 | iter.AddItem (ent->BoundariesValue(i)); |
105 | } |